]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - make/calcdep.pl
Fix build of m_spanningtree and display of dependency regeneration
[user/henk/code/inspircd.git] / make / calcdep.pl
1 #!/usr/bin/perl
2 use strict;
3 BEGIN { push @INC, '..'; }
4 use make::configure;
5
6 my $file = shift;
7
8 $file =~ /(.*)\.cpp$/ or die "Cannot process $file";
9 my $base = $1;
10
11 my $out = "$base.d";
12
13 open IN, '<', $file or die "Could not read $file: $!";
14 open OUT, '>', $out or die "Could not write $out: $!";
15
16 my $cc_deps = qx($ENV{CC} $ENV{FLAGS} -MM $file);
17 $cc_deps =~ s/.*?:\s*//;
18
19 my $ext = $file =~ m#(modules|commands)/[^/]+$# ? '.so' : '.o';
20 print OUT "$base$ext: $cc_deps";
21 print OUT "\t@../make/unit-cc.pl \$(VERBOSE) $file $base$ext\n";
22 print OUT "$base.d: $cc_deps";
23 print OUT "\t\@\$(VDEP_IN)\n";
24 print OUT "\t../make/calcdep.pl $file\n";
25 print OUT "\t\@\$(VDEP_OUT)\n";