Dear all,

I hope you can help my effort to use an environment variable within the
condition directive ifeq within a makefile.

My code is to be run twice, setting 
export DONOTREDOAOD := 0
during the first run and
export DONOTREDOAOD := 1
during the second one (in the theaodanalysisdatadir% rule).

The environment variable is retrieved in another rule:

theaodanalysis%: donotredoaod = $(shell echo ${DONOTREDOAOD})
theaodanalysis%: remake_jobids theaodanalysisdatadir%
        echo ${donotredoaod}
        @echo TEST
        @echo $(shell if [ '$(donotredoaod)' == '1' ]; then echo 1; else echo 0;
fi)
ifeq ($(shell if [ '$(donotredoaod)' == '1' ]; then echo 1; else echo 0;
fi),1)
ifeq ($(thetest),)
        @echo true
else
        @echo false

The two runs yield the following output:
----- 1 -----
echo 0
0
TEST
0
false
----- 2 -----
echo 1
1
TEST
1
false
------------

In a perfect world, which is a place in which I'm a better programmer, the
second 'false' would read 'true'. While you cannot change the world, you
could still help me by explaining to me what I'm doing wrong. It has to be
something like how make expands variables in certain contexts, etc.

Thank you for your replies!

Cheers
Holger
-- 
View this message in context: 
http://www.nabble.com/Problem-with-conditional-directive-ifeq-and-variables-tp16351282p16351282.html
Sent from the Gnu - Make - Help mailing list archive at Nabble.com.



_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to