1#!/usr/local/bin/perl 2# 3# used to generate the file MINFO for use by util/mk1mf.pl 4# It is basically a list of all variables from the passed makefile 5# 6 7while ($ARGV[0] =~ /^(\S+)\s*=(.*)$/) 8 { 9 $sym{$1} = $2; 10 shift; 11 } 12 13$s=""; 14while (<>) 15 { 16 chop; 17 s/#.*//; 18 if (/^(\S+)\s*=\s*(.*)$/) 19 { 20 $o=""; 21 ($s,$b)=($1,$2); 22 for (;;) 23 { 24 if ($b =~ /\\$/) 25 { 26 chop($b); 27 $o.=$b." "; 28 $b=<>; 29 chop($b); 30 } 31 else 32 { 33 $o.=$b." "; 34 last; 35 } 36 } 37 $o =~ s/^\s+//; 38 $o =~ s/\s+$//; 39 $o =~ s/\s+/ /g; 40 41 $o =~ s/\$[({]([^)}]+)[)}]/$sym{$1}/g; 42 $sym{$s}=$o if !exists $sym{$s}; 43 } 44 } 45 46$pwd=`pwd`; chop($pwd); 47 48if ($sym{'TOP'} eq ".") 49 { 50 $n=0; 51 $dir="."; 52 } 53else { 54 $n=split(/\//,$sym{'TOP'}); 55 @_=split(/\//,$pwd); 56 $z=$#_-$n+1; 57 foreach $i ($z .. $#_) { $dir.=$_[$i]."/"; } 58 chop($dir); 59 } 60 61print "RELATIVE_DIRECTORY=$dir\n"; 62 63foreach (sort keys %sym) 64 { 65 print "$_=$sym{$_}\n"; 66 } 67print "RELATIVE_DIRECTORY=\n"; 68