Module Name:    src
Committed By:   rillig
Date:           Sun Oct 25 09:46:25 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: var-class-local.exp var-class-local.mk

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/var-class-local.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/var-class-local.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/var-class-local.exp
diff -u src/usr.bin/make/unit-tests/var-class-local.exp:1.1 src/usr.bin/make/unit-tests/var-class-local.exp:1.2
--- src/usr.bin/make/unit-tests/var-class-local.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/var-class-local.exp	Sun Oct 25 09:46:25 2020
@@ -1 +1,2 @@
+: all overwritten
 exit status 0

Index: src/usr.bin/make/unit-tests/var-class-local.mk
diff -u src/usr.bin/make/unit-tests/var-class-local.mk:1.3 src/usr.bin/make/unit-tests/var-class-local.mk:1.4
--- src/usr.bin/make/unit-tests/var-class-local.mk:1.3	Fri Oct 23 17:21:22 2020
+++ src/usr.bin/make/unit-tests/var-class-local.mk	Sun Oct 25 09:46:25 2020
@@ -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}

Reply via email to