[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
¨make -e" : Bug or Feature?
From: |
Arnd Kohrs |
Subject: |
¨make -e" : Bug or Feature? |
Date: |
13 Apr 2001 12:56:39 +0200 |
User-agent: |
Gnus/5.090001 (Oort Gnus v0.01) Emacs/20.7 |
Hi,
I am assuming that "make -e" will let all environment variables override
variables in the makefile. Make seems to be inconsistent in setting
variables:
My makefile: bug2.mk
----SNIP---SNAP---
doit: V = Tomato
doit: F = Apple
doitagain: V = Carrot
F = Cherry
doitagain:
@echo "V= $V"
@echo "F= $F"
export V F
doit:
$(MAKE) -f bug2.mk -e doitagain
----SNIP---SNAP---
Now I call make with the following output:
> $ make -s -f bug2.mk doit
> V= Carrot
> F= Apple
This is odd since I expected ¨V¨ to be set to ¨Tomato¨ (overridden by
the exported environment variable ¨V¨ of the calling make). However,
the value of ¨F¨ was set as expected. I conclude that target specific
variables take precedence over environment variables even if the
sub-make is instructed to give precedence to environment variables by
the ¨-e¨ flag.
Now I can verify hypothesis by issuing the following command:
> $ F=Mango make -esf bug2.mk doit
> V= Carrot
> F= Apple
And voila ¨F¨ was not overridden by the environment variable ¨F¨.
A last experiment using the command-line:
> $ make -esf bug2.mk doit F=Mango
> V= Carrot
> F= Mango
Hm, this is kind of incoherent with previous observations. What is the
conceptual difference between command-line variable settings and
environment variable settings? The command-line seems to be more
powerful for setting variable and may even override target specific
variable of sub-makes:
> $ make -sf bug2.mk doit V=Bean
> V= Bean
> F= Apple
I am confused. I would have expected, that ¨make -e¨ with an
environment variable have the same effect as command-line variable
definitions. Should ¨-e¨ also override target specific variables?
If yes then there is a severe bug in the code. If not the documentation
should be clear about this behavior. If this is undefined territory,
I prefer that the behavior of ¨-e¨ with environment variables is
equivalent to passing a variable on the command-line.
Cheers,
Arnd.
--
Arnd Kohrs - Institut Eurecom - http://www.eurecom.fr/~kohrs
The Active WebMuseum: Your personalized access to art paintings.
Visit now -> http://www.eurecom.fr/~kohrs/museum.html
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- ¨make -e" : Bug or Feature?,
Arnd Kohrs <=