Re: GNU Make: Add something to CXXFLAGS when invoking make

Henrik Carlqvist <[email protected]>
Newsgroups gmane.comp.gnu.utils
Organization SunSITE.dk - Supporting Open source
Message-ID <[email protected]>
"Eric Lilja" <[email protected]> wrote:
> $ make CXXFLAGS+='-DFRIEND
> but instead of adding -DFRIEND to CXXFLAGS, it replaced it...

When I did some experiments with this I found the same:

-8<---------------------------
TEST += world
 
all:
        echo $(TEST)
-8<---------------------------

$ make
echo world
world
$ make TEST=hello
echo hello
hello
$ make TEST+=hello
echo hello
hello

So I had to use an extra variable:

-8<---------------------------
TEST2 += $(TEST) world

all:
	echo $(TEST2)
-8<---------------------------

$ make
echo  world
world
$ make TEST=hello
echo hello world
hello world

regards Henrik
-- 
The address in the header is only to prevent spam. My real address is:
hc8(at)uthyres.com Examples of addresses which go to spammers:
[email protected] root@localhost
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.