Module Name: src
Committed By: rillig
Date: Thu Sep 10 21:22:08 UTC 2020
Modified Files:
src/usr.bin/make/unit-tests: deptgt-makeflags.mk
Log Message:
make(1): add test for .MAKEFLAGS
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 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.mk
diff -u src/usr.bin/make/unit-tests/deptgt-makeflags.mk:1.2 src/usr.bin/make/unit-tests/deptgt-makeflags.mk:1.3
--- src/usr.bin/make/unit-tests/deptgt-makeflags.mk:1.2 Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/deptgt-makeflags.mk Thu Sep 10 21:22:07 2020
@@ -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.
-# TODO: Implementation
+# 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
+
+.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:
@:;