3 # reads a list of dependency files from a file, opens and
4 # concatenates them, while eliding duplicate nop rules.
12 open ($depfh, $name) || die "Can't open list of dependencies: $name: $!";
14 push @files, split(/\s+/, $_);
18 # print STDERR "dep files: " . join ("'", @files) . "\n";
22 my @depfiles = read_depfiles
(shift @ARGV);
25 print "# concatenated, reduced dependencies generated by solenv/bin/concat-deps.pl\n";
26 print "# generated with \$(SRCDIR) = $ENV{SRCDIR}\n";
28 sub canonicalize_path
($)
31 $line =~ /^(\s*)([^\s\n:]*)(.*\n?)$/;
35 if (length($path) > 0 && index($path,$ENV{SRCDIR
}) == 0) {
36 $path = File
::Spec
->rel2abs($2);
37 $path = "\$(SRCDIR)" . substr($path, length($ENV{SRCDIR
}));
39 #print "## $pre$path$post";
40 return "$pre$path$post";
43 for my $fname (@depfiles) {
46 next if ($fname eq '');
47 open ($fileh, $fname) || die "Can't open $fname: $!\n";
51 my $line = canonicalize_path
($_);
54 if ($last =~ /^(.*):\s*$/) {
55 if (defined $rules{$1}) {
65 print "$last\n"; # in case of missing newline