From c86ac40d1ad92e37a4fdf6011fb4f3c3e22b5f70 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 15 Dec 2021 22:36:40 +0100 Subject: [PATCH] automake-subdir support: Support arbitrary --source-base value. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reported by Marc Nieper-Wißkirchen in . * build-aux/prefix-gnulib-mk ($canon_prefix): New variable. (prefix): Initialize it. (prefix_assignment): Use it. --- ChangeLog | 9 +++++++++ build-aux/prefix-gnulib-mk | 9 ++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index dafd27b663..197d497f89 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2021-12-15 Bruno Haible + + automake-subdir support: Support arbitrary --source-base value. + Reported by Marc Nieper-Wißkirchen in + . + * build-aux/prefix-gnulib-mk ($canon_prefix): New variable. + (prefix): Initialize it. + (prefix_assignment): Use it. + 2021-12-15 Bruno Haible automake-subdir support: Look for 'subdir-objects' also in configure.ac. diff --git a/build-aux/prefix-gnulib-mk b/build-aux/prefix-gnulib-mk index 36f7527fcd..4f300c4433 100755 --- a/build-aux/prefix-gnulib-mk +++ b/build-aux/prefix-gnulib-mk @@ -40,6 +40,7 @@ use File::Basename; # for dirname (my $ME = $0) =~ s|.*/||; my $prefix; +my $canon_prefix; my $lib_name; sub usage ($) @@ -171,7 +172,7 @@ sub prefix_assignment ($$) # Variables whose name depend on the location: libbison_a_SOURCES => # lib_libbison_a_SOURCES. - $lhs_and_assign_op =~ s/($lib_name)/lib_$1/g; + $lhs_and_assign_op =~ s/($lib_name)/$canon_prefix$1/g; $lhs_and_assign_op . $rhs; } @@ -187,6 +188,12 @@ sub prefix ($) # Work on $_. local ($_) = @_; + # $canon_prefix is derived from $prefix in the same way as Automake + # derives %canon_reldir% from %reldir%. See + # . + $canon_prefix = $prefix; + $canon_prefix =~ s/[^a-zA-Z0-9_]/_/g; + # Prefix all the occurrence of files in rules. If there is nothing # after in the :, it's probably a phony target, or a suffix rule. # Don't touch it. -- 2.39.5