.
[glibc/history.git] / scripts / abi-versions.awk
blobab98d78e544d736f19369190c62f69db795b4181
1 # Script to generate <abi-versions.h> header file from Versions.all list.
2 # See include/shlib-compat.h comments for explanation.
4 # This script expects the following variables to be defined:
5 # oldest_abi the oldest ABI supported
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";
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;
21 $1 == "}" {
22 printf "/* end %s */\n", thislib;
23 next;
26 $2 == "=" {
27 old = $1; new = $3;
28 gsub(/[^A-Za-z0-9_ ]/, "_");
29 oldid = $1; newid = $3;
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 next;
37 vers = $1;
38 gsub(/[^A-Za-z0-9_ ]/, "_");
39 versid = $1;
41 printf "#define ABI_%s_%s\t%d\t/* support %s */\n", libid, versid, ++n, vers;
42 printf "#define VERSION_%s_%s\t%s\n", libid, versid, vers;
43 if ("GLIBC_" oldest_abi == vers)
44 start = 1;
45 if (start == 0 && oldest_abi != "default")
46 --n;
47 next;
50 END {
51 print "\n#endif /* abi-versions.h */";