Module Name: src
Committed By: rillig
Date: Fri Oct 23 14:48:49 UTC 2020
Modified Files:
src/usr.bin/make/unit-tests: deptgt-makeflags.exp deptgt-makeflags.mk
Log Message:
make(1): add test for dollar in .MAKEFLAGS target
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/deptgt-makeflags.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/deptgt-makeflags.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/deptgt-makeflags.exp
diff -u src/usr.bin/make/unit-tests/deptgt-makeflags.exp:1.1 src/usr.bin/make/unit-tests/deptgt-makeflags.exp:1.2
--- src/usr.bin/make/unit-tests/deptgt-makeflags.exp:1.1 Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/deptgt-makeflags.exp Fri Oct 23 14:48:49 2020
@@ -1 +1,9 @@
+Global:delete DOLLAR (not found)
+Command:DOLLAR = $$$$
+Global:.MAKEOVERRIDES = VAR DOLLAR
+CondParser_Eval: ${DOLLAR} != "\$\$"
+Var_Parse: ${DOLLAR} != "\$\$" with VARE_UNDEFERR|VARE_WANTRES
+lhs = "$$", rhs = "$$", op = !=
+Global:.MAKEFLAGS = -r -k -D VAR -D VAR -d cv -d
+Global:.MAKEFLAGS = -r -k -D VAR -D VAR -d cv -d 0
exit status 0
Index: src/usr.bin/make/unit-tests/deptgt-makeflags.mk
diff -u src/usr.bin/make/unit-tests/deptgt-makeflags.mk:1.3 src/usr.bin/make/unit-tests/deptgt-makeflags.mk:1.4
--- src/usr.bin/make/unit-tests/deptgt-makeflags.mk:1.3 Thu Sep 10 21:22:07 2020
+++ src/usr.bin/make/unit-tests/deptgt-makeflags.mk Fri Oct 23 14:48:49 2020
@@ -1,4 +1,4 @@
-# $NetBSD: deptgt-makeflags.mk,v 1.3 2020/09/10 21:22:07 rillig Exp $
+# $NetBSD: deptgt-makeflags.mk,v 1.4 2020/10/23 14:48:49 rillig Exp $
#
# Tests for the special target .MAKEFLAGS in dependency declarations,
# which adds command line options later, at parse time.
@@ -37,5 +37,15 @@
. error
.endif
+# When parsing this line, each '$$' becomes '$', resulting in '$$$$'.
+# This is assigned to the variable DOLLAR.
+# In the condition, that variable is expanded, and at that point, each '$$'
+# becomes '$' again, the final expression is thus '$$'.
+.MAKEFLAGS: -dcv
+.MAKEFLAGS: DOLLAR=$$$$$$$$
+.if ${DOLLAR} != "\$\$"
+.endif
+.MAKEFLAGS: -d0
+
all:
@:;