1$AWK ' 2BEGIN{ 3 var["dev"] = "DEVS="; 4 var["vga"] = "VGAS="; 5 var["ether"] = "ETHERS="; 6 var["init"] = "INIT="; 7 var["ip"] = "IP="; 8 var["port"] = "PORT="; 9 var["misc"] = "MISC="; 10 var["lib"] = "LIBS="; 11 var["link"] = "LINKS="; 12 var["root"] = "ROOTFILES="; 13 infernoroot = ENVIRON["ROOT"]; 14} 15/^$/{ next; 16} 17/^#/{ next; 18} 19/^env/{ 20 inenv = 1; 21 next; 22} 23inenv != 0 && /^[ ]/{ 24 sub("^[ ]*", "", $0) 25 printf "%s\n", $0 26 next 27} 28/^(code|dev|ether|init|ip|lib|link|mod|misc|port|root|vga)/{ 29 inenv = 0; 30 if(current != "") 31 print current; 32 current = var[$1]; 33 type = $1; 34 next; 35} 36/^[^ ]/ { 37 inenv = 0; 38 if(current != "") 39 print current; 40 current = ""; 41} 42current && /^[ ]/{ 43 if(type == "dev") 44 file = "dev" $1; 45 else if(type == "root"){ 46 if (NF > 1) 47 file = $2; 48 else if ($1 == "/osinit.dis") 49 next; # handled via explicit dependency 50 else 51 file = $1; 52 if(have[file] == 0){ 53 current = current " " infernoroot file; 54 have[file]++; 55 } 56 next; 57 } 58 else 59 file = $1; 60 if(type == "init" || type == "lib") 61 current = current " " file; 62 else if(have[file] == 0){ 63 if(type == "lib") 64 current = current " " file; 65 else 66 current = current " " file "'.$O'"; 67 have[file]++; 68 } 69 for(i = 2; i <= NF; i++){ 70 if($i !~ "^[+=-].*"){ 71 if(have[$i] == 0){ 72 others[++nothers] = $i; 73 have[$i]++; 74 } 75 } 76 } 77 next; 78} 79END{ 80 if(current != "") 81 print current; 82 for(i = 1; i <= nothers; i++) 83 x = x " " others[i] "'.$O' "; 84 if(x) 85 printf("OTHERS=%s\n", x); 86}' $* 87