From 95f6f1e60d69ebb2119294df5843bb46f14d31da Mon Sep 17 00:00:00 2001 From: sjg Date: Mon, 31 Aug 2020 16:20:00 +0000 Subject: [PATCH] Add test case for FLAGS dependent on .TARGET --- usr.bin/make/unit-tests/varmisc.exp | 2 ++ usr.bin/make/unit-tests/varmisc.mk | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/usr.bin/make/unit-tests/varmisc.exp b/usr.bin/make/unit-tests/varmisc.exp index c1c982770418..e8f88d9ca51f 100644 --- a/usr.bin/make/unit-tests/varmisc.exp +++ b/usr.bin/make/unit-tests/varmisc.exp @@ -69,4 +69,6 @@ make: Unclosed variable "UNCLOSED.3" make: Unclosed variable "UNCLOSED_ORIG" varerror-unclosed:end +target1-flags: we have: one two +target2-flags: we have: one two three four exit status 0 diff --git a/usr.bin/make/unit-tests/varmisc.mk b/usr.bin/make/unit-tests/varmisc.mk index 46d902065209..1371fbd5e11c 100644 --- a/usr.bin/make/unit-tests/varmisc.mk +++ b/usr.bin/make/unit-tests/varmisc.mk @@ -1,4 +1,4 @@ -# $Id: varmisc.mk,v 1.22 2020/08/23 19:30:13 rillig Exp $ +# $Id: varmisc.mk,v 1.23 2020/08/31 16:20:00 sjg Exp $ # # Miscellaneous variable tests. @@ -198,6 +198,20 @@ parse-dynamic: UNCLOSED_INDIR_1= ${UNCLOSED_ORIG UNCLOSED_INDIR_2= ${UNCLOSED_INDIR_1} +FLAGS= one two +FLAGS+= ${FLAGS.${.ALLSRC:M*.c:T:u}} +FLAGS.target2.c = three four + +target1.c: +target2.c: + +all: target1-flags target2-flags +target1-flags: target1.c + @echo $@: we have: ${FLAGS} + +target2-flags: target2.c + @echo $@: we have: ${FLAGS} + varerror-unclosed: @echo $@:begin @echo $(