From 9fcdf1df019d2e7e6a7ccbb8a1e7ff71c299f8fd Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Sun, 8 Aug 2004 19:05:13 +0000 Subject: [PATCH] * automake.in (%am_file_cache): New hash. (make_paragraphs): Cache .am files with comments stripped to save some useless input and substitutions. --- ChangeLog | 4 ++++ automake.in | 38 +++++++++++++++++++++++++------------- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4177e7e99..59caab14d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2004-08-08 Alexandre Duret-Lutz + * 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. diff --git a/automake.in b/automake.in index 39e275a00..074689a19 100755 --- a/automake.in +++ b/automake.in @@ -564,6 +564,12 @@ my $get_object_extension_was_run; # 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) @@ -6171,20 +6177,26 @@ sub make_paragraphs ($%) %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. -- 2.47.2