5 # This used to be a wrapper around cc -M; however, this is a very slow
6 # operation and we don't conditionally include our own files often enough
7 # to justify the full preprocesor invocation for all ~200 files.
14 my $basedir = $f =~ m#(.*)/# ? $1 : '.';
15 return $f2dep{$f} if exists $f2dep{$f};
20 if (/^\s*#\s*include\s*"([^"]+)"/) {
22 for my $loc ("$basedir/$inc", "../include/$inc") {
25 $dep{$_}++ for split / /, gendep $loc;
30 $f2dep{$f} = join ' ', sort keys %dep;
34 for my $file (@ARGV) {
35 next unless $file =~ /cpp$/;
37 my($path,$base) = $file =~ m#^((?:.*/)?)([^/]+)\.cpp#;
38 my $cmd = "$path.$base.d";
39 my $ext = $path eq 'modules/' || $path eq 'commands/' ? '.so' : '.o';
40 my $out = "$path$base$ext";
43 print OUT "$out: $file $f2dep{$file}\n";
44 print OUT "\t@../make/unit-cc.pl \$(VERBOSE) $file $out\n";
45 print OUT "$cmd: $file $f2dep{$file}\n";
46 print OUT "\t../make/calcdep.pl $file\n";