my $m4output = undef;
my $m4macro = "DX_FIX_GNULIB";
+my $line = 0;
+
Getopt::Long::Configure("gnu_getopt", "no_auto_abbrev");
GetOptions(
"o|output=s" => \$output,
# Fix up things that look like filenames.
$word = "lib/$word";
} else {
- print STDERR "$0: warning: unrecognized source file: $word\n";
+ print STDERR "$0:$line: warning: unrecognized source file: $word\n";
}
return "$word";
sub mangle_variable {
my $raw = shift;
- $raw =~ /([^=]+=)[[:space:]]*(.*)/;
+ $raw =~ /([^=]+=)[[:space:]]*(.*)/s;
my ($left, @right) = ($1, split(/[[:space:]]+/, $2));
return join(" ", ($left, map(mangle_file($_), @right))) . "\n";
sub mangle_target {
my $raw = shift;
- $raw =~ /([^:]+):[[:space:]]*(.*)/;
+ $raw =~ /([^:]+):[[:space:]]*(.*)/s;
my @left = split(/[[:space:]]+/, $1);
my @right = split(/[[:space:]]+/, $2);
}
while (<STDIN>) {
+ $line++;
+
+ # Combine line splices.
+ while (s/\\$//) {
+ $line++;
+ $_ = $_ . <STDIN>
+ }
+
next if (/^#/);
if (!$printed_header) {
# Targets are similar to variables: the target and its dependencies
# need to be mangled.
- if (/:/) {
+ if (/^[^\t].*:/) {
$_ = mangle_target($_);
}
# Finally, references to $(srcdir) and $(builddir) need to be fixed up.
s:\$\(srcdir\):\$\(top_srcdir\)/lib:g;
s:\$\(builddir\):\$\(top_builddir\)/lib:g;
-} continue { print };
+} continue { s/(\n.)/\\\1/g; print; };
print <<'EOF';
gnulib_lt_objects = $(libgnu_la_OBJECTS) $(gl_LTLIBOBJS)