summaryrefslogtreecommitdiff
path: root/implicit.c
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@kolpackov.net>2009-10-05 14:40:18 +0000
committerBoris Kolpackov <boris@kolpackov.net>2009-10-05 14:40:18 +0000
commit174e910a1d73f6b12338b6bd0a0727085b041f22 (patch)
tree827783310224c81157dbd8970905471a7919949b /implicit.c
parentacbdc33e1c82aaf9d229042d1955ea7a11c8bd45 (diff)
downloadgunmake-174e910a1d73f6b12338b6bd0a0727085b041f22.tar.gz
Performance improvements
Diffstat (limited to 'implicit.c')
-rw-r--r--implicit.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/implicit.c b/implicit.c
index 8ad6395..08e56bc 100644
--- a/implicit.c
+++ b/implicit.c
@@ -247,6 +247,9 @@ pattern_search (struct file *file, int archive,
/* Nonzero if should consider intermediate files as dependencies. */
int intermed_ok;
+ /* Nonzero if we have initialized file variables for this target. */
+ int file_vars_initialized = 0;
+
/* Nonzero if we have matched a pattern-rule target
that is not just `%'. */
int specific_rule_matched = 0;
@@ -431,10 +434,6 @@ pattern_search (struct file *file, int archive,
}
}
- /* We are going to do second expansion so initialize file variables
- for the rule. */
- initialize_file_variables (file, 0);
-
/* Try each rule once without intermediate files, then once with them. */
for (intermed_ok = 0; intermed_ok < 2; ++intermed_ok)
{
@@ -613,6 +612,14 @@ pattern_search (struct file *file, int archive,
add_dir = 1;
}
+ /* Initialize file variables if we haven't already
+ done so. */
+ if (!file_vars_initialized)
+ {
+ initialize_file_variables (file, 0);
+ file_vars_initialized = 1;
+ }
+
/* Set file variables. Note that we cannot do it once at the
beginning of the function because the stem value changes
for each rule. */