]> git.proxmox.com Git - grub2.git/blob - genmoddep.awk
build fixes for real platforms
[grub2.git] / genmoddep.awk
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 }
32 else if ($1 != "__gnu_local_gp") {
33 printf "%s in %s is not defined\n", $1, module >"/dev/stderr";
34 error++;
35 }
36 }
37
38 # Output the result.
39 END {
40 if (error >= 1)
41 exit 1;
42
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.
52 if (depmod != "kernel" && depmod != mod)
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 }