summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2002-09-17 21:52:45 +0000
committerPaul Smith <psmith@gnu.org>2002-09-17 21:52:45 +0000
commitdac7b49de4b935db71d7b4257c6354f16fe41cfa (patch)
treef82cb34b108309d38903bd4d1695942e0b79e951 /variable.c
parentd7ebcadadbfc100af64cc4c18580a6373bd52738 (diff)
downloadgunmake-dac7b49de4b935db71d7b4257c6354f16fe41cfa.tar.gz
Fix bug #940 (from the Savannah bug tracker): make sure that target-
specific variables work correctly in conjunction with double-colon targets.
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/variable.c b/variable.c
index 27a38e2..308ad75 100644
--- a/variable.c
+++ b/variable.c
@@ -372,9 +372,12 @@ lookup_variable_in_set (name, length, set)
/* Initialize FILE's variable set list. If FILE already has a variable set
list, the topmost variable set is left intact, but the the rest of the
- chain is replaced with FILE->parent's setlist. If we're READing a
- makefile, don't do the pattern variable search now, since the pattern
- variable might not have been defined yet. */
+ chain is replaced with FILE->parent's setlist. If FILE is a double-colon
+ rule, then we will use the "root" double-colon target's variable set as the
+ parent of FILE's variable set.
+
+ If we're READing a makefile, don't do the pattern variable search now,
+ since the pattern variable might not have been defined yet. */
void
initialize_file_variables (file, reading)
@@ -389,10 +392,21 @@ initialize_file_variables (file, reading)
xmalloc (sizeof (struct variable_set_list));
l->set = (struct variable_set *) xmalloc (sizeof (struct variable_set));
hash_init (&l->set->table, PERFILE_VARIABLE_BUCKETS,
- variable_hash_1, variable_hash_2, variable_hash_cmp);
+ variable_hash_1, variable_hash_2, variable_hash_cmp);
file->variables = l;
}
+ /* If this is a double-colon, then our "parent" is the "root" target for
+ this double-colon rule. Since that rule has the same name, parent,
+ etc. we can just use its variables as the "next" for ours. */
+
+ if (file->double_colon && file->double_colon != file)
+ {
+ initialize_file_variables (file->double_colon, reading);
+ l->next = file->double_colon->variables;
+ return;
+ }
+
if (file->parent == 0)
l->next = &global_setlist;
else