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