List Info

Thread: make question (environment variable)




make question (environment variable)
country flaguser name
United States
2007-02-14 12:03:24
A sample makefile
VAR=abc
all:
      echo $(VAR)

In unix/bash, to override the variable defined in the
makefile,
make VAR=123
works.

However
export VAR=123; make
or
VAR=123 make
does not seem to work.

Is there a way to override using export variable method?

Thanks.
James

_______________________________________________
help-gnu-utils mailing list
help-gnu-utilsgnu.org

http://lists.gnu.org/mailman/listinfo/help-gnu-utils

Re: make question (environment variable)
country flaguser name
Sweden
2007-02-14 15:59:29
"James" <hslee911yahoo.com> wrote:
> VAR=abc
> all:
>       echo $(VAR)
> 
> In unix/bash, to override the variable defined in the
makefile,
> make VAR=123
> works.
> 
> However
> export VAR=123; make
> or
> VAR=123 make
> does not seem to work.
> 
> Is there a way to override using export variable
method?

You can allow environment variables to override an
assignment by using the
following construction:

VAR ?= abc

regards Henrik
-- 
The address in the header is only to prevent spam. My real
address is:
hc1(at)poolhem.se Examples of addresses which go to
spammers:
rootlocalhost postmasterlocalhost

_______________________________________________
help-gnu-utils mailing list
help-gnu-utilsgnu.org

http://lists.gnu.org/mailman/listinfo/help-gnu-utils

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )