Kaydet (Commit) da6c3d4b authored tarafından Michael Meeks's avatar Michael Meeks

re-work to test the effect of boost elision.

Change-Id: Idef032c08c097e04fcf0cae3d184ceb660b65949
üst 0f12c5de
......@@ -24,21 +24,9 @@ my @depfiles = read_depfiles (shift @ARGV);
my %rules;
print "# concatenated, reduced dependencies generated by solenv/bin/concat-deps.pl\n";
print "# generated with \$(SRCDIR) = $ENV{SRCDIR}\n";
print "# generated with \$(OUTDIR) = $ENV{OUTDIR}\n";
sub canonicalize_path($)
{
my $line = shift;
$line =~ /^(\s*)([^\s\n:]*)(.*\n?)$/;
my $pre = $1;
my $path = $2;
my $post =$3;
if (length($path) > 0 && index($path,$ENV{SRCDIR}) == 0) {
$path = File::Spec->rel2abs($2);
$path = "\$(SRCDIR)" . substr($path, length($ENV{SRCDIR}));
}
#print "## $pre$path$post";
return "$pre$path$post";
}
my $boost_path = $ENV{OUTDIR} . '/inc/boost/';
for my $fname (@depfiles) {
my $fileh;
......@@ -47,20 +35,46 @@ for my $fname (@depfiles) {
open ($fileh, $fname) || die "Can't open $fname: $!\n";
my $last = '';
my $rule_count = 0;
my $with_boost_count = 0;
while (<$fileh>) {
my $line = canonicalize_path($_);
# print "# $line";
if ($line eq "\n") {
if ($last =~ /^(.*):\s*$/) {
if (defined $rules{$1}) {
$last = '';
next;
}
$rules{$1} = 1;
}
}
print $last;
$last = $line;
# canonicalise path
m/^(\s*)([^\s\n:]*)(.*\n?)$/;
my $pre = $1;
my $path = $2;
my $post = $3;
$rule_count++ if ($post =~ m/:/);
if (length($path) > 0 && index($path,$ENV{SRCDIR}) == 0) {
$path = File::Spec->rel2abs($2);
if (index($path,$ENV{OUTDIR}) == 0) {
my $solverpath = substr($path, length($ENV{OUTDIR}));
if ($solverpath =~ m|/inc/boost/|) {
if ($with_boost_count != $rule_count || !($post =~ m/\\/)) {
$path = '$(OUTDIR)/inc/boost/deliver.log';
$with_boost_count = $rule_count;
} else { # elide it
$path = ''; $pre = ''; $post = '';
}
} else {
$path = "\$(OUTDIR)" . $solverpath;
}
} else {
$path = "\$(SRCDIR)" . substr($path, length($ENV{SRCDIR}));
}
}
$line = "$pre$path$post";
if ($line eq "\n") {
if ($last =~ /^(.*):\s*$/) {
if (defined $rules{$1}) {
$last = '';
next;
}
$rules{$1} = 1;
}
}
print $last;
$last = $line;
}
print "$last\n"; # in case of missing newline
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment