help-make
[Top][All Lists]
Advanced

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

Re: adding to existing makefile variables


From: Edward Peschko
Subject: Re: adding to existing makefile variables
Date: Wed, 4 Jun 2003 13:33:01 -0700
User-agent: Mutt/1.3.22i

On Wed, Jun 04, 2003 at 02:06:28AM -0400, Paul D. Smith wrote:

> %% "Peschko, Edward" <address@hidden> writes:
> 
>   pe> How do you 'reach in and grab' a makefile variable, and then add
>   pe> to it?
> 
> You can't, not that way.  Command line settings, even if done with +=,
> take complete precedence over makefile settings.  You _can_ do this in
> your makefile:
> 
>   override CFLAGS += -O
> 
> then no matter what you add on the command line:
> 
>   make CFLAGS=-g
> 
> you'll still get the values in the makefile.  But if you use override
> there's no way to override it from the command line.
> 
> 
> Typically people reserve variables like CFLAGS, etc. for users to use
> and don't set them inside their makefiles, but instead use other
> variables for those, then include both in the compile line.

But that's the problem... 'typically' they do this. What if you don't control 
the 
makefile? That's no good - I want to be able to add to the defaults that people 
put
*in* the makefile.

Here's what I want to do: I want to develop a generic 'debug mode' for 
compiling my apps,
where I can, on the fly, switch between a debugging version and a non-debugging 
one. And 
I don't want to have to modify every single Makefile in order to do it.

Anyways, I propose the following syntax:

CFLAGS = '$(CFLAGS) -g'

to add to an existing CFLAGS entry inside a makefile, and append '-g'. I'm not 
sure if 
this is the right place to do it, though, and I don't see a developers mailing 
list. 
Where would you post feature requests?

Ed




reply via email to

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