mirror of
https://github.com/mirror/make.git
synced 2025-03-24 00:30:31 +08:00
[SV 59230] Preserve export settings for target-specific vars
* src/read.c (record_target_var): Don't overwrite pre-existing export flag unless we're changing it. * tests/scripts/features/targetvars: Add a test.
This commit is contained in:
parent
19ae6fe72a
commit
90959b8b70
@ -1832,7 +1832,8 @@ record_target_var (struct nameseq *filenames, char *defn,
|
||||
/* Set up the variable to be *-specific. */
|
||||
v->per_target = 1;
|
||||
v->private_var = vmod->private_v;
|
||||
v->export = vmod->export_v ? v_export : v_default;
|
||||
if (vmod->export_v)
|
||||
v->export = v_export;
|
||||
|
||||
/* If it's not an override, check to see if there was a command-line
|
||||
setting. If so, reset the value. */
|
||||
|
@ -86,7 +86,6 @@ run_make_test(undef, "foo.q bar.q", "qvar = rvar\nqvar =\n");
|
||||
|
||||
run_make_test(undef, "foo.t bar.s", "qvar = qvar\nqvar =\n");
|
||||
|
||||
|
||||
# TEST #8
|
||||
# For PR/1378: Target-specific vars don't inherit correctly
|
||||
|
||||
@ -291,6 +290,17 @@ dummy: hello?=world
|
||||
!,
|
||||
'', 'hello=moon');
|
||||
|
||||
# SV 59230: Assignment of a global variable should not affect export of a
|
||||
# target specific variable.
|
||||
|
||||
$ENV{hello} = "moon";
|
||||
run_make_test(q!
|
||||
all:; @echo hello=$$hello
|
||||
hello=sun
|
||||
dummy: hello?=world
|
||||
!,
|
||||
'', 'hello=sun');
|
||||
|
||||
# TEST #19: Test define/endef variables as target-specific vars
|
||||
|
||||
# run_make_test('
|
||||
|
Loading…
Reference in New Issue
Block a user