]>
Commit | Line | Data |
---|---|---|
d02b48c6 RE |
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 | ||
83084112 | 7 | while ($ARGV[0] =~ /^([^\s=]+)\s*=\s*(.*)$/) |
7b0d591d BL |
8 | { |
9 | $sym{$1} = $2; | |
10 | shift; | |
11 | } | |
12 | ||
d02b48c6 RE |
13 | $s=""; |
14 | while (<>) | |
15 | { | |
16 | chop; | |
17 | s/#.*//; | |
83084112 | 18 | if (/^([^\s=]+)\s*=\s*(.*)$/) |
d02b48c6 RE |
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; | |
7b0d591d | 42 | $sym{$s}=$o if !exists $sym{$s}; |
d02b48c6 RE |
43 | } |
44 | } | |
45 | ||
46 | $pwd=`pwd`; chop($pwd); | |
47 | ||
48 | if ($sym{'TOP'} eq ".") | |
49 | { | |
50 | $n=0; | |
51 | $dir="."; | |
52 | } | |
53 | else { | |
54 | $n=split(/\//,$sym{'TOP'}); | |
55 | @_=split(/\//,$pwd); | |
56 | $z=$#_-$n+1; | |
57 | foreach $i ($z .. $#_) { $dir.=$_[$i]."/"; } | |
58 | chop($dir); | |
59 | } | |
60 | ||
61 | print "RELATIVE_DIRECTORY=$dir\n"; | |
62 | ||
63 | foreach (sort keys %sym) | |
64 | { | |
65 | print "$_=$sym{$_}\n"; | |
66 | } | |
67 | print "RELATIVE_DIRECTORY=\n"; |