[SV 59870] define/undefine prerequisites are not target-specific vars

* src/read.c (parse_var_assignment): If called in a target-specific
variable context don't allow define/undefine as variable assignments.
* test/scripts/variables/define: Add a test.
* test/scripts/variables/undefine: Add a test.
This commit is contained in:
Paul Smith
2021-03-14 16:32:47 -04:00
parent d9aff6b817
commit da6fc6aae2
3 changed files with 41 additions and 5 deletions

View File

@@ -279,4 +279,22 @@ hello
world
');
# Ensure that define can be a target when not appearing in a variable
# definition context. See SV 59870
run_make_test(q!
define = define
$(define) : ;@echo $@
%:define
all: define foo
%.x : define
foo:;
!,
'', "define\n");
1;