Module Name: src Committed By: rillig Date: Mon Dec 27 20:17:35 UTC 2021
Modified Files: src/usr.bin/make/unit-tests: varname-makeflags.mk Log Message: tests/make: test MAKEFLAGS in POSIX mode This test covers the function 'explode' in main.c, the case in which the flags are actually expanded. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varname-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/varname-makeflags.mk diff -u src/usr.bin/make/unit-tests/varname-makeflags.mk:1.3 src/usr.bin/make/unit-tests/varname-makeflags.mk:1.4 --- src/usr.bin/make/unit-tests/varname-makeflags.mk:1.3 Tue Dec 1 20:37:30 2020 +++ src/usr.bin/make/unit-tests/varname-makeflags.mk Mon Dec 27 20:17:35 2021 @@ -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.4 2021/12/27 20:17:35 rillig 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} -f /dev/null -v .MAKEFLAGS +.if ${OUTPUT} != " -V .MAKEFLAGS" +. error ${OUTPUT} +.endif + + all: