help-make
[Top][All Lists]
Advanced

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

Re: append to/from command line variable


From: Martin d'Anjou
Subject: Re: append to/from command line variable
Date: Mon, 7 Nov 2005 07:42:37 -0500 (EST)

> When do you append it?  To what value?  In other words, given the
> following makefile:
> 
>     $(warning FOO = $(FOO))
> 
>     FOO := bar
> 
>     $(warning FOO = $(FOO))
> 
>     FOO += biz
> 
>     $(warning FOO = $(FOO))
> 
>     all: FOO := boz
>     all: FOO += baz
>     all: ; @echo FOO = $(FOO) / '$$FOO' = $$FOO
> 
> What does make print out when you run:
> 
>     make FOO+=foo

First, I need to undertstand what happens when I do this:

$ make
makefile:2: FOO = foo
makefile:5: FOO = foo bar
makefile:9: FOO = foo bar biz
FOO = boz baz / $FOO =

$ setenv FOO gig
$ make
makefile:2: FOO = gig foo
makefile:5: FOO = gig foo bar
makefile:9: FOO = gig foo bar biz
FOO = boz baz / $FOO = boz baz

Why in the second case "/ $FOO" prints "boz baz" and not the empty string? 
When I do "make -e":

$ make -e
makefile:2: FOO = gig
makefile:5: FOO = gig
makefile:9: FOO = gig
FOO = gig / $FOO = gig

Thanks,
Martin





reply via email to

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