Chen Jun (陈军) wrote:
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?
Sorry to bother you all. I figure out the reason myself. The doc say condition is first strip-ed, followed by variable expansion. The most important point: after expansion, it will not strip a second time. So the result.
_______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
