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 setting a vari...



details:   https://anonhg.NetBSD.org/src/rev/adf8dc1d6a3f
branches:  trunk
changeset: 941611:adf8dc1d6a3f
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Oct 25 09:46:25 2020 +0000

description:
make(1): add test for setting a variable in a GNode context

This edge case is probably not used widely.  The local variables of a
GNode should only ever be the predefined variables.

diffstat:

 usr.bin/make/unit-tests/var-class-local.exp |  1 +
 usr.bin/make/unit-tests/var-class-local.mk  |  7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r 0494b23cdd0d -r adf8dc1d6a3f usr.bin/make/unit-tests/var-class-local.exp
--- a/usr.bin/make/unit-tests/var-class-local.exp       Sun Oct 25 09:30:45 2020 +0000
+++ b/usr.bin/make/unit-tests/var-class-local.exp       Sun Oct 25 09:46:25 2020 +0000
@@ -1,1 +1,2 @@
+: all overwritten
 exit status 0
diff -r 0494b23cdd0d -r adf8dc1d6a3f usr.bin/make/unit-tests/var-class-local.mk
--- a/usr.bin/make/unit-tests/var-class-local.mk        Sun Oct 25 09:30:45 2020 +0000
+++ b/usr.bin/make/unit-tests/var-class-local.mk        Sun Oct 25 09:46:25 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: var-class-local.mk,v 1.3 2020/10/23 17:21:22 rillig Exp $
+# $NetBSD: var-class-local.mk,v 1.4 2020/10/25 09:46:25 rillig Exp $
 #
 # Tests for target-local variables, such as ${.TARGET} or $@.
 
@@ -25,4 +25,7 @@
 .endif
 
 all:
-       @:;
+       # The ::= modifier overwrites the .TARGET variable in the node
+       # 'all', not in the global scope.  This can be seen with the -dv
+       # option, looking for "all:@ = overwritten".
+       : ${.TARGET} ${.TARGET::=overwritten}${.TARGET}



Home | Main Index | Thread Index | Old Index