conditionals not working for conditional variables in sub-make?

2009-05-07 Thread Szekeres István
Please see the makefile attached. by running it it outputs: VAR=foo VAR2=bar VAR3=foo but I think VAR2 should be foo. Bug or do I misunderstand something? thanks, Istvan ifeq ($(VAR),foo) VAR2=foo else VAR2=bar endif VAR3=$(VAR) all: make var1 make var2 var1: VAR=foo

RE: conditionals not working for conditional variables in sub-make?

2009-05-07 Thread Martin Dorey
You misunderstand something. it outputs: VAR=foo VAR2=bar VAR3=foo That's only a small fraction of what I see, with make-3.81. This is what I see: mart...@whitewater:~/tmp/bug-make-2009-05-07$ make make var1 make[1]: Entering directory `/home/martind/tmp/bug-make-2009-05-07' VAR=foo

Re: conditionals not working for conditional variables in sub-make?

2009-05-07 Thread Szekeres István
Hi, 2009/5/7 Martin Dorey mdo...@bluearc.com: That's only a small fraction of what I see, with make-3.81.  This is what I see: [...] VAR=foo VAR2=bar VAR3=foo But here VAR2 should be foo As VAR=foo, the ifeq then-branch should set it to foo, but it goes into the else branch - which I

RE: conditionals not working for conditional variables in sub-make?

2009-05-07 Thread Martin Dorey
But here VAR2 should be foo! No, it shouldn't, for exactly the same reason that VAR2 isn't foo here: mart...@whitewater:~/tmp/bug-make-2009-05-07$ make var1 VAR=foo VAR2=bar VAR3=foo mart...@whitewater:~/tmp/bug-make-2009-05-07$ Despite the number of exclamation marks, it's not clear why you

RE: conditionals not working for conditional variables in sub-make?

2009-05-07 Thread Martin Dorey
VAR become foo when the var1 rule was executed. it reevaluates because of the explicit make commands in the all rule. Think about the order in which those two things happen. The second one happens before the first and hence doesn't see the first's effect. A thought experiment might help you

RE: conditionals not working for conditional variables in sub-make?

2009-05-07 Thread Martin Dorey
(Re-adding list.) First run Second run Make is run three times, once by the human, twice by the makefile. I'm not sure what you mean with this numbering. I think you mean the first and second runs of the echo command in the do-echo rule but please correct me if I'm wrong. These can

Re: conditionals not working for conditional variables in sub-make?

2009-05-07 Thread Szekeres István
2009/5/7 Martin Dorey mdo...@bluearc.com: But here VAR2 should be foo! No, it shouldn't, for exactly the same reason that VAR2 isn't foo here: mart...@whitewater:~/tmp/bug-make-2009-05-07$ make var1 VAR=foo VAR2=bar VAR3=foo mart...@whitewater:~/tmp/bug-make-2009-05-07$ Despite the number