help-make
[Top][All Lists]
Advanced

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

argument 'v=x' does not appear to work as in the manual ?


From: Mark Galeck (CW)
Subject: argument 'v=x' does not appear to work as in the manual ?
Date: Thu, 25 Nov 2010 20:13:35 -0800

Hello,

The GNU make manual says :

" An argument that contains '=' specifies the value of a variable: 'v=x' sets 
the value of the variable v to x. If you specify a value in this way, all 
ordinary assignments of the same variable in the makefile are ignored; we say 
they have been overridden by the command line argument."


This does not appear to work, here is my makefile:

CFLAGS+ =foo#
$(info $(CFLAGS+))

And there is my interaction with the Windows shell (I don't think this has 
anything to do with Windows, please correct me if I am wrong).  Since CFLAGS+ 
is a legitimate make variable name, as shown in the first interaction, then the 
second interation should print "bar".

C:\Temp>make
foo
make: *** No targets.  Stop.

C:\Temp>make CFLAGS+=bar
foo
make: *** No targets.  Stop.


In fact, what is happening, make CFLAGS+=bar, behaves exactly like make 
CFLAGS=bar.  Please explain?  In any case, how to work around this if I want to 
have a variable name with "+" overridden on command line, can I?  I implemented 
a workaround in Windows shell to replace "+" with P, but I would rather do this 
in  make syntax.  

Thank you,

Mark 




reply via email to

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