1 # $NetBSD: cond-token-plain.mk,v 1.4 2020/09/12 17:47:24 rillig Exp $
3 # Tests for plain tokens (that is, string literals without quotes)
8 .if ${:Uvalue} != value
12 # Malformed condition since comment parsing is done in an early phase
13 # and removes the '#' and everything behind it long before the condition
14 # parser gets to see it.
16 # XXX: The error message is missing for this malformed condition.
17 # The right-hand side of the comparison is just a '"'.
22 # To get a '#' into a condition, it has to be escaped using a backslash.
23 # This prevents the comment parser from removing it, and in turn, it becomes
24 # visible to CondParser_String.
25 .if ${:U\#hash} != "\#hash"
29 # Since 2002-12-30, and still as of 2020-09-11, CondParser_Token handles
30 # the '#' specially, even though at this point, there should be no need for
31 # comment handling anymore. The comments are supposed to be stripped off
32 # in a very early parsing phase.
34 # XXX: Missing error message for the malformed condition. The right-hand
35 # side is double-quotes, backslash, backslash.
36 # XXX: It is unexpected that the right-hand side evaluates to a single
38 .if ${:U\\} != "\\#hash"
42 # The right-hand side of a comparison is not parsed as a token, therefore
43 # the code from CondParser_Token does not apply to it.
44 .if ${:U\#hash} != \#hash
48 # XXX: What is the purpose of treating an escaped '#' in the following
49 # condition as a comment? And why only at the beginning of a token,
50 # just as in the shell?
51 .if 0 \# This is treated as a comment, but why?
55 # Ah, ok, this can be used to add an end-of-condition comment. But does
56 # anybody really use this? This is neither documented nor obvious since
57 # the '#' is escaped. It's much clearer to write a comment in the line
58 # above the condition.
59 .if ${0 \# comment :?yes:no} != no
62 .if ${1 \# comment :?yes:no} != yes
66 # Usually there is whitespace around the comparison operator, but this is
68 .if ${UNDEF:Uundefined}!=undefined
71 .if ${UNDEF:U12345}>12345
74 .if ${UNDEF:U12345}<12345
81 # Only the comparison operator terminates the comparison operand, and it's
82 # a coincidence that the '!' is both used in the '!=' comparison operator
83 # as well as for negating a comparison result.
85 # The boolean operators '&' and '|' don't terminate a comparison operand.
86 .if ${:Uvar}&&name != "var&&name"
89 .if ${:Uvar}||name != "var||name"