diff options
Diffstat (limited to 'contrib/bmake/unit-tests/deptgt-makeflags.mk')
-rw-r--r-- | contrib/bmake/unit-tests/deptgt-makeflags.mk | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/contrib/bmake/unit-tests/deptgt-makeflags.mk b/contrib/bmake/unit-tests/deptgt-makeflags.mk index 0a0f410e14c4..2f8b00743e3f 100644 --- a/contrib/bmake/unit-tests/deptgt-makeflags.mk +++ b/contrib/bmake/unit-tests/deptgt-makeflags.mk @@ -1,4 +1,4 @@ -# $NetBSD: deptgt-makeflags.mk,v 1.6 2020/11/15 20:20:58 rillig Exp $ +# $NetBSD: deptgt-makeflags.mk,v 1.9 2023/11/19 22:32:44 rillig Exp $ # # Tests for the special target .MAKEFLAGS in dependency declarations, # which adds command line options later, at parse time. @@ -65,9 +65,9 @@ .endif # Next try at defining another newline variable. Since whitespace around the -# variable value is trimmed, two empty variable expressions surround the +# variable value is trimmed, two empty expressions ${:U} surround the # literal newline now. This prevents the newline from being skipped during -# parsing. The ':=' assignment operator expands the empty variable +# parsing. The ':=' assignment operator expands the empty # expressions, leaving only the newline as the variable value. # # This is one of the very few ways (maybe even the only one) to inject literal @@ -81,6 +81,31 @@ .endif #.MAKEFLAGS: -d0 +# Now do the same for the other escape sequences; see Substring_Words. +.MAKEFLAGS: CHAR_BS:="$${:U}\b$${:U}" +.MAKEFLAGS: CHAR_FF:="$${:U}\f$${:U}" +.MAKEFLAGS: CHAR_NL:="$${:U}\n$${:U}" +.MAKEFLAGS: CHAR_CR:="$${:U}\r$${:U}" +.MAKEFLAGS: CHAR_TAB:="$${:U}\t$${:U}" + +# Note: backspace is not whitespace, it is a control character. +.if ${CHAR_BS:C,^[[:cntrl:]]$,found,W} != "found" +. error +.endif +.if ${CHAR_FF:C,^[[:space:]]$,found,W} != "found" +. error +.endif +.if ${CHAR_NL:C,^[[:space:]]$,found,W} != "found" +. error +.endif +.if ${CHAR_CR:C,^[[:space:]]$,found,W} != "found" +. error +.endif +.if ${CHAR_TAB:C,^[[:space:]]$,found,W} != "found" +. error +.endif + + # Unbalanced quotes produce an error message. If they occur anywhere in the # command line, the whole command line is skipped. .MAKEFLAGS: VAR=previous |