* automake.in (read_am_file): Adjust function prototype (was requiring only two arguments, rather than three). Rename the parameter '$curdir' to the more correct '$reldir'. Rename the local variable '$cur_dir' to the more appropriate and less confusing '$reldir_canon', and avoid continuously re-computing it in the loop on input lines, since it is fixed per-Makefile. When processing an include directive, store the computed new relative dir path in a variable named '$new_reldir' rather than '$new_curdir'.
Signed-off-by: Stefano Lattarini <stefano.lattar...@gmail.com> --- automake.in | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/automake.in b/automake.in index 5bfc0d1..9133117 100644 --- a/automake.in +++ b/automake.in @@ -6330,15 +6330,16 @@ sub check_trailing_slash ($\$) } -# &read_am_file ($AMFILE, $WHERE, $CURDIR) +# &read_am_file ($AMFILE, $WHERE, $RELDIR) # ---------------------------------------- # Read Makefile.am and set up %contents. Simultaneously copy lines # from Makefile.am into $output_trailer, or define variables as # appropriate. NOTE we put rules in the trailer section. We want # user rules to come after our generated stuff. -sub read_am_file ($$) +sub read_am_file ($$$) { - my ($amfile, $where, $curdir) = @_; + my ($amfile, $where, $reldir) = @_; + my $canon_reldir = &canonicalize ($reldir); my $am_file = new Automake::XFile ("< $amfile"); verb "reading $amfile"; @@ -6423,17 +6424,16 @@ sub read_am_file ($$) my $new_saw_bk = check_trailing_slash ($where, $_); - my $cur_dir = &canonicalize ($curdir); - if ($curdir eq '.') + if ($reldir eq '.') { # If present, eat the following '_' or '/', converting # "{RELDIR}/foo" and "{CANON_RELDIR}_foo" into plain "foo" - # when $curdir is '.'. + # when $reldir is '.'. $_ =~ s,\{(D|RELDIR)\}/,,g; $_ =~ s,\{(C|CANON_RELDIR)\}_,,g; } - $_ =~ s/\{(D|RELDIR)\}/${curdir}/g; - $_ =~ s/\{(C|CANON_RELDIR)\}/${cur_dir}/g; + $_ =~ s/\{(D|RELDIR)\}/${reldir}/g; + $_ =~ s/\{(C|CANON_RELDIR)\}/${canon_reldir}/g; if (/$IGNORE_PATTERN/o) { @@ -6596,10 +6596,10 @@ sub read_am_file ($$) push_dist_common ("\$\(srcdir\)/$path"); $path = $relative_dir . "/" . $path if $relative_dir ne '.'; } - my $new_curdir = File::Spec->abs2rel ($path, $relative_dir); - $new_curdir = '.' if $new_curdir !~ s,/[^/]*$,,; + my $new_reldir = File::Spec->abs2rel ($path, $relative_dir); + $new_reldir = '.' if $new_reldir !~ s,/[^/]*$,,; $where->push_context ("'$path' included from here"); - &read_am_file ($path, $where, $new_curdir); + &read_am_file ($path, $where, $new_reldir); $where->pop_context; } else -- 1.8.1.1.473.g9a6c84e