'DISTRMS' => join ("\n", @dist_rms)
);
- my @paragraphs = make_paragraphs ($filename, %transform);
+ my @paragraphs = make_paragraphs (preprocess_file ($filename, %transform));
my ($coms, $vars, $rules) =
file_contents_internal (1, $filename, new Automake::Location,
\@paragraphs, %transform);
my $saved_output_vars = $output_vars;
my $filename = "$libdir/am/header-vars.am";
- my @paragraphs = make_paragraphs ($filename);
+ my $preprocessed_file = preprocess_file ($filename);
+ my @paragraphs = make_paragraphs ($preprocessed_file);
my ($comments, undef, $rules) =
file_contents_internal (1, $filename, new Automake::Location,
{
my ($file, %transform) = @_;
+ $transform{FIRST} = !$transformed_files{$file};
+ $transformed_files{$file} = 1;
+
# Complete %transform with global options.
# Note that %transform goes last, so it overrides global options.
%transform = ( 'MAINTAINER-MODE'
# @PARAGRAPHS
-# make_paragraphs ($MAKEFILE, [%TRANSFORM])
-# -----------------------------------------
-# Load a $MAKEFILE, apply the %TRANSFORM, and return it as a list of
-# paragraphs.
+# make_paragraphs ($MAKEFILE)
+# ---------------------------
+# Load a preprocessed $MAKEFILE and return it as a list of paragraphs
sub make_paragraphs
{
- my ($file, %transform) = @_;
- $transform{FIRST} = !$transformed_files{$file};
- $transformed_files{$file} = 1;
-
- my @lines = split /(?<!\\)\n/, preprocess_file ($file, %transform);
+ my ($preprocessed_file) = shift;
+ my @lines = split /(?<!\\)\n/, $preprocessed_file;
my @res;
while (defined ($_ = shift @lines))
{
my $filename = ($is_am ? "$libdir/am/" : '') . $1;
$where->push_context ("'$filename' included from here");
- my @paragraphs = make_paragraphs ($filename, %transform);
+ my @paragraphs = make_paragraphs (preprocess_file ($filename, %transform));
# N-ary '.=' fails.
my ($com, $vars, $rules) =
file_contents_internal ($is_am, $filename, $where,
sub file_contents
{
my ($basename, $where, %transform) = @_;
- my @paragraphs = make_paragraphs ("$libdir/am/$basename.am", %transform);
+ my @paragraphs = make_paragraphs (preprocess_file ("$libdir/am/$basename.am", %transform));
my ($comments, $variables, $rules) =
file_contents_internal (1, $basename, $where,
\@paragraphs, %transform);