jengelh-datetimespielwiese
Last change
on this file since dccceb was
dccceb,
checked in by Oleksandr Motsak <motsak@…>, 11 years ago
|
moved libfac under factory/
CHG: moved libfac/ under factory/
Note: starting to merge libfac into factory (as a private library)
|
-
Property mode set to
100755
|
File size:
1.4 KB
|
Rev | Line | |
---|
[1a80b4] | 1 | #!/usr/local/bin/perl |
---|
| 2 | |
---|
| 3 | # Usage: makedep [options] [files] |
---|
| 4 | |
---|
| 5 | # Configuration parameters. |
---|
| 6 | |
---|
| 7 | $CPP = "gcc -E"; |
---|
| 8 | # $CPP = "cc -P"; |
---|
| 9 | # $CPP = "/lib/cpp"; |
---|
| 10 | |
---|
| 11 | # Process switches. |
---|
| 12 | |
---|
| 13 | $noglobincludes = 1; |
---|
| 14 | $prefix = ""; |
---|
| 15 | |
---|
| 16 | while ($ARGV[0] =~ /^-/) { |
---|
| 17 | $_ = shift; |
---|
| 18 | if (/^-D(.*)/) { |
---|
| 19 | $defines .= " -D" . ($1 ? $1 : shift); |
---|
| 20 | } |
---|
| 21 | elsif (/^-I(.*)/) { |
---|
| 22 | $includes .= " -I" . ($1 ? $1 : shift); |
---|
| 23 | } |
---|
| 24 | elsif (/^-d(.*)/) { |
---|
| 25 | $dir = ($1 ? $1 : shift); |
---|
| 26 | } |
---|
| 27 | elsif (/^-G/) { |
---|
| 28 | $noglobincludes = 0; |
---|
| 29 | } |
---|
| 30 | elsif (/^-P/) { |
---|
| 31 | $prefix .= ($1 ? $1 : shift) . "/"; |
---|
| 32 | } |
---|
| 33 | else { |
---|
| 34 | die "Unrecognized switch: $_\n"; |
---|
| 35 | } |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | # Do each file on command line. |
---|
| 39 | |
---|
| 40 | foreach $file (@ARGV) { |
---|
| 41 | open(CPP,"$CPP $defines $includes $file|") |
---|
| 42 | || die "Can't run cpp: $!\n"; |
---|
| 43 | |
---|
| 44 | # Scan output for line directives. |
---|
| 45 | |
---|
| 46 | %seen = (); |
---|
| 47 | while (<CPP>) { |
---|
| 48 | next unless /^#/; |
---|
| 49 | next unless ($filename) = /^# \d.*"(.*)"/; |
---|
| 50 | $seen{$filename}++; |
---|
| 51 | } |
---|
| 52 | close CPP; |
---|
| 53 | |
---|
| 54 | # Figure out the corresponding object file name. |
---|
| 55 | |
---|
| 56 | ($ofile = $file) =~ s/\.c$/.o/; |
---|
| 57 | ($ofile = $ofile) =~ s/\.C$/.o/; |
---|
| 58 | ($ofile = $ofile) =~ s/\.cpp$/.o/; |
---|
| 59 | ($ofile = $ofile) =~ s/\.cxx$/.o/; |
---|
| 60 | ($ofile = $ofile) =~ s/\.cc$/.o/; |
---|
| 61 | $ofile =~ s#.*/##; |
---|
| 62 | $ofile = "$dir/$ofile" if $dir; |
---|
| 63 | |
---|
| 64 | # Print out the dependencies. |
---|
| 65 | |
---|
| 66 | foreach (sort keys(%seen)) { |
---|
| 67 | print "$prefix$ofile: $_\n" unless ( /^\// && $noglobincludes ); |
---|
| 68 | } |
---|
| 69 | print "\n"; |
---|
| 70 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.