$transform{FIRST} = !$transformed_files{$file};
$transformed_files{$file} = 1;
- my @lines = split /(?<!\\)\n/, preprocess_file ($file, %transform);
- my @res;
+ my @lines = split /\n/, preprocess_file ($file, %transform);
+
+ # A line starting with '!' must be passed verbatim to the output
+ # Makefile, placed after the variables' definitions and before the
+ # Makefile targets. This is an hack to allow us to use tricky GNU
+ # make constructs (on which the dumb Automake parser would choke).
+ # It is not perfect, but seems good enough for the moment.
+ my @verbatim_lines = grep /^!/, @lines;
+ foreach (@verbatim_lines)
+ {
+ s/^!//;
+ $output_verbatim .= "$_\n";
+ }
+ @lines = grep !/^!/, @lines;
+
+ # Handle line continuations.
+ # FIXME: this could probably be done more efficiently, but I'd rather
+ # FIXME: not change working (and trickish) code for the moment.
+ @lines = split /(?<!\\)\n/, join ("\n", @lines);
+ my @res;
while (defined ($_ = shift @lines))
{
my $paragraph = $_;
# FIXME: no line number available.
$where->set ($file);
- # A line starting with '!' must be passed verbatim to the output
- # Makefile, placed after the variables' definitions and before the
- # Makefile targets.
- if (s/^!//)
- {
- $output_verbatim .= "$_\n";
- }
-
# Sanity checks.
- elsif (/\\$/)
+ if (/\\$/)
{
error $where, "blank line following trailing backslash:\n$_"
}
## FIXME: this will pick up the default from the environment; are we sure
## FIXME: we want that?
!TEST_EXTENSIONS ?= .test
-!$(call am__maybe_invalid_test_extensions,$(filter-out .%,$(TEST_EXTENSIONS)))
-## FIXME: it would be nice to break these on multiple lines. Unfortunately,
-## FIXME: our '!' is not yet smart enough to handle that :-(
-!$(foreach am__e,$(TEST_EXTENSIONS), $(eval $(call am__handle_per_suffix_test,$(am__e))))
+!$(call am__maybe_invalid_test_extensions,\
+! $(filter-out .%,$(TEST_EXTENSIONS)))
+!$(foreach am__e,$(TEST_EXTENSIONS), \
+! $(eval $(call am__handle_per_suffix_test,$(am__e))))
## It is *imperative* that the "empty" suffix goes last. Otherwise, a
## declaration like "TESTS = all.test" would cause GNU make to mistakenly
## try to build the 'all.log' and 'all.trs' files from a non-existent