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/b7ca2200898c
branches:  trunk
changeset: 974258:b7ca2200898c
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 4a378673dc72 -r b7ca2200898c 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 4a378673dc72 -r b7ca2200898c 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