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 dollar in .MAK...



details:   https://anonhg.NetBSD.org/src/rev/bb3f0f34ebc3
branches:  trunk
changeset: 941513:bb3f0f34ebc3
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Oct 23 14:48:49 2020 +0000

description:
make(1): add test for dollar in .MAKEFLAGS target

diffstat:

 usr.bin/make/unit-tests/deptgt-makeflags.exp |   8 ++++++++
 usr.bin/make/unit-tests/deptgt-makeflags.mk  |  12 +++++++++++-
 2 files changed, 19 insertions(+), 1 deletions(-)

diffs (38 lines):

diff -r d1cccfe2a562 -r bb3f0f34ebc3 usr.bin/make/unit-tests/deptgt-makeflags.exp
--- a/usr.bin/make/unit-tests/deptgt-makeflags.exp      Fri Oct 23 14:38:39 2020 +0000
+++ b/usr.bin/make/unit-tests/deptgt-makeflags.exp      Fri Oct 23 14:48:49 2020 +0000
@@ -1,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
diff -r d1cccfe2a562 -r bb3f0f34ebc3 usr.bin/make/unit-tests/deptgt-makeflags.mk
--- a/usr.bin/make/unit-tests/deptgt-makeflags.mk       Fri Oct 23 14:38:39 2020 +0000
+++ b/usr.bin/make/unit-tests/deptgt-makeflags.mk       Fri Oct 23 14:48:49 2020 +0000
@@ -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:
        @:;



Home | Main Index | Thread Index | Old Index