summaryrefslogtreecommitdiff
path: root/emu/port/mkdevlist
diff options
context:
space:
mode:
authorCharles.Forsyth <devnull@localhost>2006-12-22 17:07:39 +0000
committerCharles.Forsyth <devnull@localhost>2006-12-22 17:07:39 +0000
commit37da2899f40661e3e9631e497da8dc59b971cbd0 (patch)
treecbc6d4680e347d906f5fa7fca73214418741df72 /emu/port/mkdevlist
parent54bc8ff236ac10b3eaa928fd6bcfc0cdb2ba46ae (diff)
20060303a
Diffstat (limited to 'emu/port/mkdevlist')
-rw-r--r--emu/port/mkdevlist75
1 files changed, 75 insertions, 0 deletions
diff --git a/emu/port/mkdevlist b/emu/port/mkdevlist
new file mode 100644
index 00000000..eea5ae16
--- /dev/null
+++ b/emu/port/mkdevlist
@@ -0,0 +1,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]
+}' $*