Lines Matching defs:empty

1 # $NetBSD: cond-func-empty.mk,v 1.24 2023/12/19 19:33:40 rillig Exp $
3 # Tests for the empty() function in .if conditions, which tests an
11 EMPTY= # empty
16 # An undefined variable counts as empty.
17 .if !empty(UNDEF)
21 # An undefined variable has the empty string as the value, and the :M
24 .if !empty(UNDEF:M*)
28 # The :S modifier replaces the empty value with an actual word. After
29 # applying the :S modifier to the expression, its value is 'empty', so it is
30 # no longer empty, but it is still based on an undefined variable. There are
34 # empty string.
39 .if !empty(UNDEF:S,^$,value,W)
47 .if empty(UNDEF:S,^$,value,W:Ufallback)
53 # expression makes its value non-empty, but doesn't change that the expression
67 # The variable EMPTY is completely empty (0 characters).
68 .if !empty(EMPTY)
72 # The variable SPACE has a single space, which counts as being empty.
73 .if !empty(SPACE)
77 # The variable .newline has a single newline, which counts as being empty.
78 .if !empty(.newline)
82 # The variable ZERO has the numeric value 0, but is not empty. This is a
83 # subtle difference between using either 'empty(ZERO)' or the expression
85 .if empty(ZERO)
94 # and the value " ". This expression counts as empty since the value contains
101 .if !empty(:U )
105 # Now the variable named " " gets a non-empty value, which demonstrates that
110 # would be returned as an empty string.
112 .if empty( )
116 # The value of the following expression is " word", which is not empty. To be
117 # empty, _all_ characters in the expression value have to be whitespace, not
119 .if empty(:U word)
125 # empty.
126 .if empty(VAR:L)
130 # The variable WORD has the value "word", which does not count as empty.
131 .if empty(WORD)
135 # The expression ${} for a variable with the empty name always evaluates
136 # to an empty string (see Var_Parse, varUndefined).
137 .if !empty()
149 .if empty(W${:UOR}D)
155 .if ! empty ( WORD )
161 # Now there is a variable named " WORD ", and it is not empty.
162 .if empty ( WORD )
167 # expect+1: Malformed conditional (empty(WORD)
168 .if empty(WORD
188 # side containing the '!empty' was evaluated though, as it had always been.
190 # When evaluating the !empty condition, the variable name was parsed as
192 # this case the ${:U2}. The expression '${:U2}' was replaced with an empty
200 # expanded to an empty string. This in turn created the seemingly recursive
207 .if defined(VARNAME${:U2}) && !empty(VARNAME${:U2})
211 # If the word 'empty' is not followed by '(', it is not a function call but an
212 # ordinary bare word. This bare word is interpreted as 'defined(empty)', and
213 # since there is no variable named 'empty', the condition evaluates to false.
214 .if empty
218 empty= # defined but empty
219 .if empty