export FOO=' ' is the same as export FOO=" " as far as the shell is concerned: both work fine with make
In the process of testing with your examples, however, it has helped add new information on the occurence of this odd behavior.
Here is a restatement of the problem, with a simpler makefile this time.
# Makefile
.PHONY: test
# test if FOO is empty
ifeq ($(FOO),)
result:=FOO is empty
else
result:=FOO is not empty
endif
test:
@echo origin of FOO is: $(origin FOO)
@echo $(result)
#eof
First, the environment results; all are satisfactory
[greg@p3 junk]$ export FOO=" ";make
origin of FOO is: environment
FOO is not empty
[greg@p3 junk]$ export FOO=' ';make
origin of FOO is: environment
FOO is not empty
[greg@p3 junk]$ export FOO=\ ;make
origin of FOO is: environment
FOO is not empty
Now for the command line - INCONSISTENT!
Only backslash, followed by a space, followed by a make OPTION causes make to recognize the non-empty variable, FOO as being non-empty.
[greg@p3 junk]$ make FOO=' '
origin of FOO is: command line
FOO is empty
[greg@p3 junk]$ make FOO=" "
origin of FOO is: command line
FOO is empty
[greg@p3 junk]$ make FOO=\ -r
origin of FOO is: command line
FOO is not empty
[greg@p3 junk]$ make FOO=' ' -r
origin of FOO is: command line
FOO is empty
[greg@p3 junk]$ make FOO=\
origin of FOO is: command line
FOO is empty
NOTE: I left a space after the backslash on the command line above; make still thinks it is empty, but thinks it is NOT EMPTY if an option follows the escaped space!
[greg@p3 junk]$ make -r FOO=\
origin of FOO is: command line
FOO is empty
[greg@p3 junk]$
Is this a shell problem?
Consider how the shell handles parameters assigned in exactly the same way.
#!/bin/bash
# test.sh
if test -z "$1";then
echo "${1}:param is empty"
else
echo "${1}:param is not empty"
fi
# eof
[greg@p3 junk]$ ./test.sh FOO=' '
FOO= :param is not empty
[greg@p3 junk]$ ./test.sh ' '
:param is not empty
[greg@p3 junk]$
At 02:10 PM 1/28/2003 +0100, Der Herr Hofrat wrote:
> If forgot to add the following result, when FOO is set in the environment > it works as you would hope: > > [greg@p3 junk]$ export FOO=' '; make > > FOO: origin=environment > > This seems to indicate that the command line behavior is an anomaly/bug.thats a shell problem not make - do export FOO=\ ; make ^- there is a blank behind the backslash... or export FOO=" " ; make then make will see the " " and pass it on - hofrat _______________________________________________ Help-make mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/help-make
- Greg Keraunen http://www.xmake.org http://www.xmlmake.com _______________________________________________ Help-make mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/help-make
