From: Bruno Haible Date: Wed, 15 Dec 2021 21:36:40 +0000 (+0100) Subject: automake-subdir support: Support arbitrary --source-base value. X-Git-Tag: v1.0~2519 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=c86ac40d1ad92e37a4fdf6011fb4f3c3e22b5f70;p=gnulib.git 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. --- 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.