Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make/unit-tests make(1): add test for expanding dyna...
details: https://anonhg.NetBSD.org/src/rev/16edaea5e88f
branches: trunk
changeset: 936431:16edaea5e88f
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Jul 26 20:30:42 2020 +0000
description:
make(1): add test for expanding dynamic variables
diffstat:
usr.bin/make/unit-tests/varmisc.exp | 1 +
usr.bin/make/unit-tests/varmisc.mk | 20 +++++++++++++++++++-
2 files changed, 20 insertions(+), 1 deletions(-)
diffs (47 lines):
diff -r e655c06f9610 -r 16edaea5e88f usr.bin/make/unit-tests/varmisc.exp
--- a/usr.bin/make/unit-tests/varmisc.exp Sun Jul 26 20:21:31 2020 +0000
+++ b/usr.bin/make/unit-tests/varmisc.exp Sun Jul 26 20:30:42 2020 +0000
@@ -43,4 +43,5 @@
export-appended: env
export-appended: env
export-appended: env mk
+parse-dynamic: parse-dynamic parse-dynamic before
exit status 0
diff -r e655c06f9610 -r 16edaea5e88f usr.bin/make/unit-tests/varmisc.mk
--- a/usr.bin/make/unit-tests/varmisc.mk Sun Jul 26 20:21:31 2020 +0000
+++ b/usr.bin/make/unit-tests/varmisc.mk Sun Jul 26 20:30:42 2020 +0000
@@ -1,4 +1,4 @@
-# $Id: varmisc.mk,v 1.14 2020/07/26 11:10:29 rillig Exp $
+# $Id: varmisc.mk,v 1.15 2020/07/26 20:30:42 rillig Exp $
#
# Miscellaneous variable tests.
@@ -6,6 +6,7 @@
strftime cmpv manok
all: save-dollars
all: export-appended
+all: parse-dynamic
unmatched_var_paren:
@echo ${foo::=foo-text}
@@ -156,3 +157,20 @@
@echo $@: "$$FROM_ENV"
@echo $@: "$$FROM_ENV_BEFORE"
@echo $@: "$$FROM_ENV_AFTER"
+
+# begin parse-dynamic
+#
+# Demonstrate that the target-specific variables are not evaluated in
+# the global context. They are preserved until there is a local context
+# in which resolving them makes sense.
+
+${:U>}= before
+G_TARGET:= $@
+G_MEMBER:= $%
+G_PREFIX:= $*
+G_ARCHIVE:= $!
+G_ALLSRC:= $>
+${:U>}= after
+
+parse-dynamic:
+ @echo $@: ${G_TARGET} ${G_MEMBER} ${G_PREFIX} ${G_ARCHIVE} ${G_ALLSRC}
Home |
Main Index |
Thread Index |
Old Index