From 341312cc57eba0a1888b3dc89510894e3e7e42c9 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 27 Sep 2004 18:09:52 +0000 Subject: [PATCH] bugfix for exported pattern-specific variables --- ChangeLog | 5 +++++ tests/ChangeLog | 4 ++++ tests/scripts/features/patspecific_vars | 9 +++++++++ variable.c | 15 +++++++++++---- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index bbedcd5..7ad0ab8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-09-27 Boris Kolpackov + + * variable.c (initialize_file_variables): Mark pattern-specific + variable as a per-target and copy export status. + 2004-09-21 Boris Kolpackov * file.c (snap_deps): Mark .PHONY prerequisites as targets. diff --git a/tests/ChangeLog b/tests/ChangeLog index 542194e..8420705 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,7 @@ +2004-09-27 Boris Kolpackov + + * scripts/features/patspecific_vars: Test exported variables. + 2004-09-22 Paul D. Smith * run_make_tests.pl (run_make_test): Don't add newlines to the diff --git a/tests/scripts/features/patspecific_vars b/tests/scripts/features/patspecific_vars index 9ace5c4..74de9bb 100644 --- a/tests/scripts/features/patspecific_vars +++ b/tests/scripts/features/patspecific_vars @@ -61,4 +61,13 @@ $answer = "baz: foo two baz\nfour.x: foo two baz\n"; $answer = "aaa bbb\nccc ddd\n"; &compare_output($answer,&get_logfile(1)); +# TEST #5 -- test pattern-specific exported variables +# +run_make_test(' +/%: export foo := foo + +/bar: + @test "$(foo)" == "$$foo" +', '', ''); + 1; diff --git a/variable.c b/variable.c index 7b9d0d8..f6cca0d 100644 --- a/variable.c +++ b/variable.c @@ -493,10 +493,17 @@ initialize_file_variables (struct file *file, int reading) current_variable_set_list = file->pat_variables; do - /* We found one, so insert it into the set. */ - do_variable_definition (&p->variable.fileinfo, p->variable.name, - p->variable.value, p->variable.origin, - p->variable.flavor, 1); + { + /* We found one, so insert it into the set. */ + struct variable *v = do_variable_definition ( + &p->variable.fileinfo, p->variable.name, + p->variable.value, p->variable.origin, + p->variable.flavor, 1); + + /* Also mark it as a per-target and copy export status. */ + v->per_target = p->variable.per_target; + v->export = p->variable.export; + } while ((p = lookup_pattern_var (p, file->name)) != 0); current_variable_set_list = global; -- 2.7.4