]>
Commit | Line | Data |
---|---|---|
b977bf01 | 1 | #! /usr/bin/awk -f |
2 | # | |
3 | # Copyright (C) 2006 Free Software Foundation, Inc. | |
4 | # | |
5 | # This genmoddep.awk is free software; the author | |
6 | # gives unlimited permission to copy and/or distribute it, | |
7 | # with or without modifications, as long as this notice is preserved. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without | |
11 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A | |
12 | # PARTICULAR PURPOSE. | |
13 | ||
14 | # Read defined symbols from stdin. | |
15 | BEGIN { | |
16 | while (getline <"/dev/stdin") { | |
17 | symtab[$1] = $2 | |
18 | } | |
19 | } | |
20 | ||
21 | # The first line contains a module name. | |
22 | FNR == 1 { | |
23 | module = $1 | |
24 | next | |
25 | }; | |
26 | ||
27 | # The rest is undefined symbols. | |
28 | { | |
29 | if ($1 in symtab) { | |
30 | modtab[module] = modtab[module] " " symtab[$1]; | |
31 | } | |
6abdf8e2 | 32 | else if ($1 != "__gnu_local_gp") { |
b977bf01 | 33 | printf "%s in %s is not defined\n", $1, module >"/dev/stderr"; |
34 | error++; | |
b977bf01 | 35 | } |
36 | } | |
37 | ||
38 | # Output the result. | |
39 | END { | |
1f15fc1e | 40 | if (error >= 1) |
b977bf01 | 41 | exit 1; |
b39f9d20 | 42 | |
b977bf01 | 43 | for (mod in modtab) { |
44 | # Remove duplications. | |
45 | split(modtab[mod], depmods, " "); | |
46 | for (depmod in uniqmods) { | |
47 | delete uniqmods[depmod]; | |
48 | } | |
49 | for (i in depmods) { | |
50 | depmod = depmods[i]; | |
51 | # Ignore kernel, as always loaded. | |
fb14123e | 52 | if (depmod != "kernel" && depmod != mod) |
b977bf01 | 53 | uniqmods[depmod] = 1; |
54 | } | |
55 | modlist = "" | |
56 | for (depmod in uniqmods) { | |
57 | modlist = modlist " " depmod; | |
58 | } | |
59 | printf "%s:%s\n", mod, modlist; | |
60 | } | |
61 | } |