| lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | # Script to generate <abi-versions.h> header file from Versions.all list. | 
|  | 2 | # See include/shlib-compat.h comments for explanation. | 
|  | 3 |  | 
|  | 4 | BEGIN { | 
|  | 5 | print "/* This file is automatically generated by abi-versions.awk."; | 
|  | 6 | print "   It defines symbols used by shlib-compat.h, which see.  */"; | 
|  | 7 | print "\n#ifndef _ABI_VERSIONS_H\n#define _ABI_VERSIONS_H"; | 
|  | 8 | } | 
|  | 9 |  | 
|  | 10 | NF == 2 && $2 == "{" { | 
|  | 11 | thislib = $1; | 
|  | 12 | gsub(/[^A-Za-z0-9_ 	]/, "_"); libid = $1; | 
|  | 13 | printf "\n/* start %s */\n", thislib; | 
|  | 14 | n = 0; | 
|  | 15 | start = 0; | 
|  | 16 | next; | 
|  | 17 | } | 
|  | 18 | $1 == "}" { | 
|  | 19 | printf "/* end %s */\n", thislib; | 
|  | 20 | next; | 
|  | 21 | } | 
|  | 22 |  | 
|  | 23 | $2 == "=" { | 
|  | 24 | old = $1; new = $3; | 
|  | 25 | gsub(/[^A-Za-z0-9_ 	]/, "_"); | 
|  | 26 | oldid = $1; newid = $3; | 
|  | 27 |  | 
|  | 28 | printf "#define ABI_%s_%s\tABI_%s_%s\n", libid, oldid, libid, newid; | 
|  | 29 | printf "#define VERSION_%s_%s\t%s\n", libid, oldid, new; | 
|  | 30 |  | 
|  | 31 | next; | 
|  | 32 | } | 
|  | 33 |  | 
|  | 34 | { | 
|  | 35 | vers = $1; | 
|  | 36 | gsub(/[^A-Za-z0-9_ 	]/, "_"); | 
|  | 37 | versid = $1; | 
|  | 38 |  | 
|  | 39 | printf "#define ABI_%s_%s\t%d\t/* support %s */\n", libid, versid, ++n, vers; | 
|  | 40 | printf "#define VERSION_%s_%s\t%s\n", libid, versid, vers; | 
|  | 41 | next; | 
|  | 42 | } | 
|  | 43 |  | 
|  | 44 | END { | 
|  | 45 | print "\n#endif /* abi-versions.h */"; | 
|  | 46 | } |