blob: eea5ae1673b82240f2b453b12fb1987dc1821640 (
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
$AWK '
BEGIN{
var["init"] = "INIT=";
var["ip"] = "IP=";
var["lib"] = "LIBS=";
var["root"] = "ROOTFILES=";
infernoroot = ENVIRON["ROOT"];
}
/^$/{ next;
}
/^#/{ next;
}
/^env/{
inenv = 1;
next;
}
inenv != 0 && /^[ ]/{
sub("^[ ]*", "", $0)
printf "%s\n", $0
next
}
/^(code|dev|init|ip|lib|link|mod|misc|port|root)/{
inenv = 0;
type = $1;
next;
}
/^[^ ]/ {
inenv = 0;
}
type && /^[ ]/{
if(type == "code")
next;
if(type == "root"){
if (NF > 1)
file = $2;
else if ($1 == "/osinit.dis")
next; # handled via explicit dependency
else
file = $1;
if(rootfile[file] == 0){
var[type] = var[type] " " infernoroot file;
rootfile[file]++;
}
next;
}
if(type == "init" || type == "lib"){
var[type] = var[type] " " $1;
next;
}
file = $1 "'.$O'"
if(type == "port")
port[file]++;
else if(type == "dev")
obj["dev" file]++;
else if(type != "mod")
obj[file]++;
for(i = 2; i <= NF; i++){
if($i !~ "^[+=-].*")
obj[$i "'.$O'"]++;
}
next;
}
END{
x = ""
for(i in obj)
x = x " " i
printf "DEVS=%s\n", x;
x = ""
for(i in port)
x = x " " i
printf "PORT=%s\n", x
for(v in var)
printf "%s\n", var[v]
}' $*
|