aboutsummaryrefslogtreecommitdiff
path: root/contrib/bmake/unit-tests/varname-makeflags.mk
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bmake/unit-tests/varname-makeflags.mk')
-rw-r--r--contrib/bmake/unit-tests/varname-makeflags.mk20
1 files changed, 19 insertions, 1 deletions
diff --git a/contrib/bmake/unit-tests/varname-makeflags.mk b/contrib/bmake/unit-tests/varname-makeflags.mk
index 3b4fd91c3f57..f7840c2eb7a5 100644
--- a/contrib/bmake/unit-tests/varname-makeflags.mk
+++ b/contrib/bmake/unit-tests/varname-makeflags.mk
@@ -1,4 +1,4 @@
-# $NetBSD: varname-makeflags.mk,v 1.3 2020/12/01 20:37:30 rillig Exp $
+# $NetBSD: varname-makeflags.mk,v 1.5 2022/01/16 18:16:06 sjg Exp $
#
# Tests for the special MAKEFLAGS variable, which is basically just a normal
# environment variable. It is closely related to .MAKEFLAGS but captures the
@@ -23,4 +23,22 @@
. error
.endif
+
+# In POSIX mode, the environment variable MAKEFLAGS can contain letters only,
+# for compatibility. These letters are exploded to form regular options.
+OUTPUT!= env MAKEFLAGS=ikrs ${MAKE} -f /dev/null -v .MAKEFLAGS
+.if ${OUTPUT} != " -i -k -r -s -V .MAKEFLAGS"
+. error
+.endif
+
+# As soon as there is a single non-alphabetic character in the environment
+# variable MAKEFLAGS, it is no longer split. In this example, the word
+# "d0ikrs" is treated as a target, but the option '-v' prevents any targets
+# from being built.
+OUTPUT!= env MAKEFLAGS=d0ikrs ${MAKE} -r -f /dev/null -v .MAKEFLAGS
+.if ${OUTPUT} != " -r -V .MAKEFLAGS"
+. error ${OUTPUT}
+.endif
+
+
all: