]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
* automake.in (%am_file_cache): New hash.
authorAlexandre Duret-Lutz <adl@gnu.org>
Sun, 8 Aug 2004 19:05:13 +0000 (19:05 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Sun, 8 Aug 2004 19:05:13 +0000 (19:05 +0000)
(make_paragraphs): Cache .am files with comments stripped to save
some useless input and substitutions.

ChangeLog
automake.in

index 4177e7e9955b5e96dadf2ee0304695808c56a226..59caab14d61f6156deb44ec640065b935e402e96 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 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.
index 39e275a002d541daef08f01f869ed62c8906adde..074689a194ce3931aa0a61d8d40e538bebd3eed4 100755 (executable)
@@ -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.