Fixed Savannah bug #16140.
authorBoris Kolpackov <boris@kolpackov.net>
Wed, 22 Mar 2006 13:16:03 +0000 (13:16 +0000)
committerBoris Kolpackov <boris@kolpackov.net>
Wed, 22 Mar 2006 13:16:03 +0000 (13:16 +0000)
ChangeLog
implicit.c

index 03416b90cc5164f730ef42029f7e0ce1dd471fa3..0440f3e96bd9ad714d1d3f8d0704e47eeb16801f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-03-22  Boris Kolpackov  <boris@kolpackov.net>
+
+       * implicit.c (pattern_search): Call set_file_variables only
+       if we have prerequisites that need second expansion. Fixes
+       Savannah bug #16140.
+
 2006-03-19  Paul D. Smith  <psmith@gnu.org>
 
        * remake.c (update_file): Add alloca(0) to clean up alloca'd
index a5d37008f72aa5faea4da0185e42979a71cbc204..878d154cf6ed77276fe70b70aee1f9b287c145ed 100644 (file)
@@ -442,6 +442,7 @@ pattern_search (struct file *file, int archive,
           struct file *f;
           unsigned int failed = 0;
          int check_lastslash;
+          int file_variables_set = 0;
 
          rule = tryrules[i];
 
@@ -479,9 +480,9 @@ pattern_search (struct file *file, int archive,
           strncpy (stem_str, stem, stemlen);
           stem_str[stemlen] = '\0';
 
-          /* Temporary assign STEM to file->stem and set file variables. */
+          /* Temporary assign STEM to file->stem (needed to set file
+             variables below).   */
           file->stem = stem_str;
-          set_file_variables (file);
 
          /* Try each dependency; see if it "exists".  */
 
@@ -550,6 +551,15 @@ pattern_search (struct file *file, int archive,
                           depname[len] = '\0';
                         }
 
+                      /* Set file variables. Note that we cannot do it once
+                         at the beginning of the function because of the stem
+                         value.  */
+                      if (!file_variables_set)
+                        {
+                          set_file_variables (file);
+                          file_variables_set = 1;
+                        }
+
                       p2 = variable_expand_for_file (depname, file);
                     }
                   else