chiark / gitweb /
eglibc (2.11.3-4+deb6u3) squeeze-lts; urgency=medium
[eglibc.git] / scripts / abi-versions.awk
1 # Script to generate <abi-versions.h> header file from Versions.all list.
2 # See include/shlib-compat.h comments for explanation.
3
4 # This script expects the following variables to be defined:
5 # oldest_abi            the oldest ABI supported
6
7 BEGIN {
8   print "/* This file is automatically generated by abi-versions.awk.";
9   print "   It defines symbols used by shlib-compat.h, which see.  */";
10   print "\n#ifndef _ABI_VERSIONS_H\n#define _ABI_VERSIONS_H";
11 }
12
13 NF == 2 && $2 == "{" {
14   thislib = $1;
15   gsub(/[^A-Za-z0-9_    ]/, "_"); libid = $1;
16   printf "\n/* start %s */\n", thislib;
17   n = 0;
18   start = 0;
19   next;
20 }
21 $1 == "}" {
22   printf "/* end %s */\n", thislib;
23   next;
24 }
25
26 $2 == "=" {
27   old = $1; new = $3;
28   gsub(/[^A-Za-z0-9_    ]/, "_");
29   oldid = $1; newid = $3;
30
31   printf "#define ABI_%s_%s\tABI_%s_%s\n", libid, oldid, libid, newid;
32   printf "#define VERSION_%s_%s\t%s\n", libid, oldid, new;
33
34   if ("GLIBC_" oldest_abi == old)
35     oldest_abi = "default";
36   next;
37 }
38
39 {
40   vers = $1;
41   gsub(/[^A-Za-z0-9_    ]/, "_");
42   versid = $1;
43
44   printf "#define ABI_%s_%s\t%d\t/* support %s */\n", libid, versid, ++n, vers;
45   printf "#define VERSION_%s_%s\t%s\n", libid, versid, vers;
46   if ("GLIBC_" oldest_abi == vers)
47     start = 1;
48   if (start == 0 && oldest_abi != "default")
49     --n;
50   next;
51 }
52
53 END {
54   print "\n#endif /* abi-versions.h */";
55 }