3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 # reads a list of dependency files from a file, opens and
11 # concatenates them, while eliding duplicate nop rules.
19 open ($depfh, $name) || die "Can't open list of dependencies: $name: $!";
21 push @files, split(/\s+/, $_);
25 # print STDERR "dep files: " . join ("'", @files) . "\n";
29 my @depfiles = read_depfiles
(shift @ARGV);
32 print "# concatenated, reduced dependencies generated by solenv/bin/concat-deps.pl\n";
33 print "# generated with \$(SRCDIR) = $ENV{SRCDIR}\n";
34 print "# generated with \$(OUTDIR) = $ENV{OUTDIR}\n";
36 my $boost_path = $ENV{OUTDIR
} . '/inc/boost/';
38 for my $fname (@depfiles) {
41 next if ($fname eq '');
42 open ($fileh, $fname) || die "Can't open $fname: $!\n";
46 my $with_boost_count = 0;
49 m/^(\s*)([^\s\n:]*)(.*\n?)$/;
53 $rule_count++ if ($post =~ m/:/);
54 if (length($path) > 0 && index($path,$ENV{SRCDIR
}) == 0) {
55 $path = File
::Spec
->rel2abs($2);
56 if (index($path,$ENV{OUTDIR
}) == 0) {
57 my $solverpath = substr($path, length($ENV{OUTDIR
}));
58 if ($solverpath =~ m
|/inc/boost
/|) {
59 if ($with_boost_count != $rule_count || !($post =~ m/\\/)) {
60 $path = '$(OUTDIR)/inc/boost/deliver.log';
61 $with_boost_count = $rule_count;
63 $path = ''; $pre = ''; $post = '';
66 $path = "\$(OUTDIR)" . $solverpath;
69 $path = "\$(SRCDIR)" . substr($path, length($ENV{SRCDIR
}));
72 $line = "$pre$path$post";
75 if ($last =~ /^(.*):\s*$/) {
76 if (defined $rules{$1}) {
86 print "$last\n"; # in case of missing newline