help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Does $if function really do a $strip before checking condition?


From: Chen Jun (陈军)
Subject: Does $if function really do a $strip before checking condition?
Date: Wed, 23 Dec 2009 12:43:18 +0800
User-agent: Thunderbird 2.0.0.23 (Windows/20090812)

Hello. I have such a makefile

##############################
var=
var+=
       # var contains a space


all:
@$(if $(var),echo "direct: var is NOT empty",echo "direct: var is empty")
##############################

On make 3.80 & 3.81, it both outputs

direct: var is NOT empty

However, make 3.81 doc ch 8.4 says

{quote}

|$(if condition,then-part[,else-part])|

...

The first argument, condition, first has all preceding and trailing whitespace stripped, then is expanded. If it expands to any non-empty string, then the condition is considered to be true. If it expands to an empty string, the condition is considered to be false.
{quote}

Then why my makefile outputs "var is NOT empty" when $(var) would definitely strip down to a null string? Can someone help explain this?






reply via email to

[Prev in Thread] Current Thread [Next in Thread]