help-make
[Top][All Lists]
Advanced

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

Re: inconsistency of 'emptiness'?


From: gk
Subject: Re: inconsistency of 'emptiness'?
Date: Tue, 28 Jan 2003 08:17:39 -0800

I think you misunderstood the situation: there is no bug when FOO is exported from environment; only when FOO is set to a space on the make COMMAND LINE.

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
address@hidden junk]$ export FOO=" ";make
origin of FOO is: environment
FOO is not empty
address@hidden junk]$ export FOO=' ';make
origin of FOO is: environment
FOO is not empty
address@hidden 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.

address@hidden junk]$ make FOO=' '
origin of FOO is: command line
FOO is empty
address@hidden junk]$ make FOO=" "
origin of FOO is: command line
FOO is empty
address@hidden junk]$ make FOO=\ -r
origin of FOO is: command line
FOO is not empty
address@hidden junk]$ make FOO=' ' -r
origin of FOO is: command line
FOO is empty
address@hidden 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!

address@hidden junk]$ make -r FOO=\
origin of FOO is: command line
FOO is empty
address@hidden 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

address@hidden junk]$ ./test.sh FOO=' '
FOO= :param is not empty
address@hidden junk]$ ./test.sh ' '
 :param is not empty
address@hidden 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:
>
> address@hidden 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
address@hidden
http://mail.gnu.org/mailman/listinfo/help-make

- Greg Keraunen
http://www.xmake.org
http://www.xmlmake.com





reply via email to

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