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 .MAKEFLAGS



details:   https://anonhg.NetBSD.org/src/rev/bc5a4af8cb47
branches:  trunk
changeset: 954767:bc5a4af8cb47
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Sep 10 21:22:07 2020 +0000

description:
make(1): add test for .MAKEFLAGS

diffstat:

 usr.bin/make/unit-tests/deptgt-makeflags.mk |  39 ++++++++++++++++++++++++++--
 1 files changed, 36 insertions(+), 3 deletions(-)

diffs (48 lines):

diff -r 2fc6ff65ae64 -r bc5a4af8cb47 usr.bin/make/unit-tests/deptgt-makeflags.mk
--- a/usr.bin/make/unit-tests/deptgt-makeflags.mk       Thu Sep 10 17:40:34 2020 +0000
+++ b/usr.bin/make/unit-tests/deptgt-makeflags.mk       Thu Sep 10 21:22:07 2020 +0000
@@ -1,8 +1,41 @@
-# $NetBSD: deptgt-makeflags.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: deptgt-makeflags.mk,v 1.3 2020/09/10 21:22:07 rillig Exp $
 #
-# Tests for the special target .MAKEFLAGS in dependency declarations.
+# Tests for the special target .MAKEFLAGS in dependency declarations,
+# which adds command line options later, at parse time.
+
+# The -D option sets a variable in the "Global" scope and thus can be
+# undefined later.
+.MAKEFLAGS: -D VAR
+
+.if ${VAR} != 1
+.  error
+.endif
+
+.undef VAR
+
+.if defined(VAR)
+.  error
+.endif
 
-# TODO: Implementation
+.MAKEFLAGS: -D VAR
+
+.if ${VAR} != 1
+.  error
+.endif
+
+.MAKEFLAGS: VAR="value"' with'\ spaces
+
+.if ${VAR} != "value with spaces"
+.  error
+.endif
+
+# Variables set on the command line as VAR=value are placed in the
+# "Command" scope and thus cannot be undefined.
+.undef VAR
+
+.if ${VAR} != "value with spaces"
+.  error
+.endif
 
 all:
        @:;



Home | Main Index | Thread Index | Old Index