X-Git-Url: https://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=build-aux%2Fprefix-gnulib-mk;h=4d0518fa1f2bcffb9a61dd52538b52b341381ec5;hb=9a52d861868c8d787c66b75753a747e5c1ebedc6;hp=9b23245b9c9ebd6aafa0d005784bcfccfdbef86b;hpb=0e9bac3a27f8e956911b787329bec6bf81d9c004;p=gnulib.git diff --git a/build-aux/prefix-gnulib-mk b/build-aux/prefix-gnulib-mk index 9b23245b9..4d0518fa1 100755 --- a/build-aux/prefix-gnulib-mk +++ b/build-aux/prefix-gnulib-mk @@ -147,7 +147,11 @@ sub prefix ($) {prefix_assignment($1, $2)}gem; # These three guys escape all the other regular rules. - s{(charset\.alias|ref-add\.sed|ref-del\.sed)}{$prefix$1}g; + # Require the leading white space to avoid inserting the prefix + # on a line like this: + # charset_alias = $(DESTDIR)$(libdir)/charset.alias + # With $(libdir), it would be erroneous. + s{(\s)(charset\.alias|ref-add\.sed|ref-del\.sed)}{$1$prefix$2}g; # Unfortunately, as a result we sometimes have lib/lib. s{($prefix){2}}{$1}g; @@ -185,10 +189,11 @@ sub process ($) { my ($file) = @_; my ($bak) = "$file.bak"; - rename ($file, $bak) or die; + rename ($file, $bak) or die "$ME: rename $file $bak failed: $!\n"; my $contents = contents ($bak); $contents = prefix ($contents); - my $out = new IO::File(">$file") or die; + my $out = new IO::File(">$file") + or die "$ME: $file: failed to open for writing: $!\n"; print $out $contents; }