]> git.ipfire.org Git - thirdparty/glibc.git/blame - scripts/soversions.awk
[BZ #632]
[thirdparty/glibc.git] / scripts / soversions.awk
CommitLineData
91adb529 1# awk script for shlib-versions.v -> soversions.i; see Makeconfig.
6d864d15 2
91adb529
RM
3BEGIN {
4 config = cpu "-" vendor "-" os;
5 configs[config] = "DEFAULT";
6}
7
8{ thiscf = $1 }
9
10$2 ~ /WORDSIZE[3264]/ {
11 if (config ~ thiscf) {
12 othercf = $3;
13 sub(/@CPU@/, cpu, othercf);
14 sub(/@VENDOR@/, vendor, othercf);
15 sub(/@OS@/, os, othercf);
16 configs[othercf] = $2;
17 }
18 next;
19}
6d864d15
RM
20
21# Obey the first matching DEFAULT line.
22$2 == "DEFAULT" {
91adb529
RM
23 if (!matched_default[thiscf]) {
24 matched_default[thiscf] = 1;
a334319f 25 $1 = $2 = "";
91adb529 26 default_set[thiscf] = $0;
a334319f 27 }
6d864d15
RM
28 next
29}
30
31# Collect all lib lines before emitting anything, so DEFAULT
32# can be interspersed.
33{
34 lib = number = $2;
35 sub(/=.*$/, "", lib);
36 sub(/^.*=/, "", number);
91adb529
RM
37 if ((thiscf FS lib) in numbers) next;
38 numbers[thiscf FS lib] = number;
39 order[thiscf FS lib] = ++order_n;
6d864d15
RM
40 if (NF > 2) {
41 $1 = $2 = "";
91adb529 42 versions[thiscf FS lib] = $0
6d864d15
RM
43 }
44}
45
46END {
91adb529
RM
47 for (elt in numbers) {
48 split(elt, x);
49 cf = x[1];
50 lib = x[2];
51 if (default_setname && !(cf in default_set) && config ~ cf)
52 default_set[cf] = default_setname;
53 set = (elt in versions) ? versions[elt] : default_set[cf];
54 line = set ? (lib FS numbers[elt] FS set) : (lib FS numbers[elt]);
55 for (c in configs)
56 if (c ~ cf) {
57 if (!((c FS lib) in lineorder) || order[elt] < lineorder[c FS lib]) {
58 lineorder[c FS lib] = order[elt];
59 lines[c FS lib] = configs[c] FS line;
60 }
61 }
62 }
63 for (c in lines) {
64 print lines[c]
6d864d15
RM
65 }
66}