summaryrefslogtreecommitdiff
path: root/os/port/mkdevlist
diff options
context:
space:
mode:
Diffstat (limited to 'os/port/mkdevlist')
-rw-r--r--os/port/mkdevlist86
1 files changed, 86 insertions, 0 deletions
diff --git a/os/port/mkdevlist b/os/port/mkdevlist
new file mode 100644
index 00000000..6fdc6866
--- /dev/null
+++ b/os/port/mkdevlist
@@ -0,0 +1,86 @@
+$AWK '
+BEGIN{
+ var["dev"] = "DEVS=";
+ var["vga"] = "VGAS=";
+ var["ether"] = "ETHERS=";
+ var["init"] = "INIT=";
+ var["ip"] = "IP=";
+ var["port"] = "PORT=";
+ var["misc"] = "MISC=";
+ var["lib"] = "LIBS=";
+ var["link"] = "LINKS=";
+ var["root"] = "ROOTFILES=";
+ infernoroot = ENVIRON["ROOT"];
+}
+/^$/{ next;
+}
+/^#/{ next;
+}
+/^env/{
+ inenv = 1;
+ next;
+}
+inenv != 0 && /^[ ]/{
+ sub("^[ ]*", "", $0)
+ printf "%s\n", $0
+ next
+}
+/^(code|dev|ether|init|ip|lib|link|mod|misc|port|root|vga)/{
+ inenv = 0;
+ if(current != "")
+ print current;
+ current = var[$1];
+ type = $1;
+ next;
+}
+/^[^ ]/ {
+ inenv = 0;
+ if(current != "")
+ print current;
+ current = "";
+}
+current && /^[ ]/{
+ if(type == "dev")
+ file = "dev" $1;
+ else if(type == "root"){
+ if (NF > 1)
+ file = $2;
+ else if ($1 == "/osinit.dis")
+ next; # handled via explicit dependency
+ else
+ file = $1;
+ if(have[file] == 0){
+ current = current " " infernoroot file;
+ have[file]++;
+ }
+ next;
+ }
+ else
+ file = $1;
+ if(type == "init" || type == "lib")
+ current = current " " file;
+ else if(have[file] == 0){
+ if(type == "lib")
+ current = current " " file;
+ else
+ current = current " " file "'.$O'";
+ have[file]++;
+ }
+ for(i = 2; i <= NF; i++){
+ if($i !~ "^[+=-].*"){
+ if(have[$i] == 0){
+ others[++nothers] = $i;
+ have[$i]++;
+ }
+ }
+ }
+ next;
+}
+END{
+ if(current != "")
+ print current;
+ for(i = 1; i <= nothers; i++)
+ x = x " " others[i] "'.$O' ";
+ if(x)
+ printf("OTHERS=%s\n", x);
+}' $*