2004-08-08 Alexandre Duret-Lutz <adl@gnu.org>
+ * automake.in (%am_file_cache): New hash.
+ (make_paragraphs): Cache .am files with comments stripped to save
+ some useless input and substitutions.
+
* lib/Automake/Variable.pm (%_primary_dict): New hash.
(_new, variable_delete): Update %_primary_dict.
(variables): Accept an optional $suffix argument.
# Record each file processed by make_paragraphs.
my %transformed_files;
+# Cache each file processed by make_paragraphs.
+# (This is different from %transformed_files because
+# %transformed_files is reset for each file while %am_file_cache
+# it global to the run.)
+my %am_file_cache;
+
################################################################
# var_SUFFIXES_trigger ($TYPE, $VALUE)
%transform);
$transformed_files{$file} = 1;
+ $_ = $am_file_cache{$file};
+
+ if (! defined $_)
+ {
+ verb "reading $file";
+ # Swallow the whole file.
+ my $fc_file = new Automake::XFile "< $file";
+ my $saved_dollar_slash = $/;
+ undef $/;
+ $_ = $fc_file->getline;
+ $/ = $saved_dollar_slash;
+ $fc_file->close;
+
+ # Remove ##-comments.
+ # Besides we don't need more than two consecutive new-lines.
+ s/(?:$IGNORE_PATTERN|(?<=\n\n)\n+)//gom;
+
+ $am_file_cache{$file} = $_;
+ }
- # Swallow the file and apply the COMMAND.
- my $fc_file = new Automake::XFile "< $file";
- # Looks stupid?
- verb "reading $file";
- my $saved_dollar_slash = $/;
- undef $/;
- $_ = $fc_file->getline;
- $/ = $saved_dollar_slash;
- $fc_file->close;
-
- # Remove ##-comments.
- # Besides we don't need more than two consecutive new-lines.
- s/(?:$IGNORE_PATTERN|(?<=\n\n)\n+)//gom;
# Substitute Automake template tokens.
s/(?:%\??[\w\-]+%|\?!?[\w\-]+\?)/transform($&, \%transform)/ge;
# transform() may have added some ##%-comments to strip.