summaryrefslogtreecommitdiff
path: root/automake.in
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2010-12-23 21:41:45 +0100
committerStefano Lattarini <stefano.lattarini@gmail.com>2010-12-23 21:41:45 +0100
commit3fe9baba0f1645f69bb5b404d4e580f2dba65bb2 (patch)
tree4c543e3ab89f47e9c97bd9497ab371f722cbb93f /automake.in
parent7e7a8a6497cbc2473a3e25dd1067f2d44346325e (diff)
parentd47051ef10f0f2bea552a8084edb70eff779fa72 (diff)
downloadautomake-3fe9baba0f1645f69bb5b404d4e580f2dba65bb2.tar.gz
Merge branch 'tests-suffix-extend'
Conflicts: tests/suffix10.test
Diffstat (limited to 'automake.in')
-rw-r--r--automake.in26
1 files changed, 18 insertions, 8 deletions
diff --git a/automake.in b/automake.in
index 27904f01e..bb30c738b 100644
--- a/automake.in
+++ b/automake.in
@@ -2118,14 +2118,24 @@ sub handle_single_transform ($$$$$%)
# Transform .o or $o file into .P file (for automatic
# dependency code).
- if ($lang && $lang->autodep ne 'no')
- {
- my $depfile = $object;
- $depfile =~ s/\.([^.]*)$/.P$1/;
- $depfile =~ s/\$\(OBJEXT\)$/o/;
- $dep_files{dirname ($depfile) . '/$(DEPDIR)/'
- . basename ($depfile)} = 1;
- }
+ # Properly flatten multiple adjacent slashes, as Solaris 10 make
+ # might fail over them in an include statement.
+ # Leading double slashes may be special, as per Posix, so deal
+ # with them carefully.
+ if ($lang && $lang->autodep ne 'no')
+ {
+ my $depfile = $object;
+ $depfile =~ s/\.([^.]*)$/.P$1/;
+ $depfile =~ s/\$\(OBJEXT\)$/o/;
+ my $maybe_extra_leading_slash = '';
+ $maybe_extra_leading_slash = '/' if $depfile =~ m,^//[^/],;
+ $depfile =~ s,/+,/,g;
+ my $basename = basename ($depfile);
+ # This might make $dirname empty, but we account for that below.
+ (my $dirname = dirname ($depfile)) =~ s/\/*$//;
+ $dirname = $maybe_extra_leading_slash . $dirname;
+ $dep_files{$dirname . '/$(DEPDIR)/' . $basename} = 1;
+ }
}
return @result;