aboutsummaryrefslogtreecommitdiff
path: root/scripts/abi-versions.awk
blob: 0cceaad66a315cfecf39cbf441812148e25553b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Script to generate <abi-versions.h> header file from Versions.all list.
# See include/shlib-compat.h comments for explanation.

BEGIN {
  print "/* This file is automatically generated by abi-versions.awk.";
  print "   It defines symbols used by shlib-compat.h, which see.  */";
  print "\n#ifndef _ABI_VERSIONS_H\n#define _ABI_VERSIONS_H";
}

NF == 2 && $2 == "{" {
  thislib = $1;
  gsub(/[^A-Za-z0-9_ 	]/, "_"); libid = $1;
  printf "\n/* start %s */\n", thislib;
  next;
}
$1 == "}" {
  printf "/* end %s */\n", thislib;
  next;
}

$2 == "=" {
  new = $3;
  gsub(/[^A-Za-z0-9_ 	]/, "_"); id = $1;
  printf "#define ABI_%s_%s\t0\t/* earliest supported %s */\n", libid, id, new;
  printf "#define VERSION_%s_%s\t%s\n", libid, id, new;
  next;
}

{
  vers = $1;
  gsub(/[^A-Za-z0-9_ 	]/, "_"); id = $1;
  printf "#define ABI_%s_%s\t1\t/* support %s */\n", libid, id, vers;
  printf "#define VERSION_%s_%s\t%s\n", libid, id, vers;
  next;
}

END {
  print "\n#endif /* abi-versions.h */";
}