help-make
[Top][All Lists]
Advanced

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

RE: How to limit the assignment of variable from command line only to th


From: Warlich, Christof
Subject: RE: How to limit the assignment of variable from command line only to the current makefile?
Date: Thu, 14 Jul 2011 07:43:10 +0200

> The variable assigned in the parent makefile will be carried on to the
> child makefile.
This is only true if the variable is exported (export XXX:=abc) or, as
in your example, if it is passed as a command line parameter.

> I'm wondering if there is a way to localize this
> effect only to the parent.
Yes, there is a way, in case of the command line parameter you need
the override directive:
override(XX=whatever else) 

-----Original Message-----
From: address@hidden [mailto:address@hidden On Behalf Of Peng Yu
Sent: Mittwoch, 13. Juli 2011 18:07
To: make-help mailing list
Subject: How to limit the assignment of variable from command line only to the 
current makefile?

Hi,

The variable assigned in the parent makefile will be carried on to the
child makefile. I'm wondering if there is a way to localize this
effect only to the parent.

$ cat Makefile
.PHONY: all

XX:=abc

$(info $(XX))

all:
        $(MAKE) -C dir

$ cat dir/Makefile
.PHONY: all

XX:=abc

$(info $(XX))

all:

$ make XX=100
100
make -C dir
100
make[1]: Entering directory `/tmp/cmdl_arg/dir'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/tmp/cmdl_arg/dir'


-- 
Regards,
Peng

_______________________________________________
Help-make mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-make



reply via email to

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