[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug #49093] ifdef checks for non-empty value, not definition
From: |
Philip Guenther |
Subject: |
Re: [bug #49093] ifdef checks for non-empty value, not definition |
Date: |
Wed, 14 Sep 2016 15:16:14 -0700 |
On Wed, Sep 14, 2016 at 3:13 PM, Paul D. Smith <address@hidden> wrote:
...
> Probably an example like this would help make the doc more clear.
There *is* an example like that in the doc in at least version 4.2.1!
Note that `ifdef' only tests whether a variable has a value. It
does not expand the variable to see if that value is nonempty.
Consequently, tests using `ifdef' return true for all definitions
except those like `foo ='. To test for an empty value, use
`ifeq ($(foo),)'. For example,
bar =
foo = $(bar)
ifdef foo
frobozz = yes
else
frobozz = no
endif
sets `frobozz' to `yes', while:
foo =
ifdef foo
frobozz = yes
else
frobozz = no
endif
sets `frobozz' to `no'.