List Info

Thread: removing compile directive




removing compile directive
user name
2008-04-21 04:35:11
I can use operator "+=" to provide additional
compile directives, like

CFLAGS += -D_EXTRA_

Is there a way to remove compile directive? Something like
this

CFLAGS -= -D_REMOVE_THIS_

I have a source tree being compiled with -O2 option.
However, for debugging 
purpose, I want all files in one directory to compile
without -O2. However, 
Makefile in that directly takes CFLAGS from a parent
Makefile which I can 
not modify !!

Let me know if there a some way to achieve this.

Thanks in advance.

-Mohan 



_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make

Re: removing compile directive
country flaguser name
United States
2008-04-21 12:43:12
Mohan Lal Jangir wrote:

> Is there a way to remove compile directive? Something
like this
> 
> CFLAGS -= -D_REMOVE_THIS_
> 
> I have a source tree being compiled with -O2 option.
However, for debugging
> purpose, I want all files in one directory to compile
without -O2. However,
> Makefile in that directly takes CFLAGS from a parent
Makefile which I can
> not modify !!

CFLAGS = $(filter-out -D_REMOVE_THIS_,$(CFLAGS))

The filter-out function can also take %-style wildcards as
well as
multiple (space separated) patterns, if you need that.

Brian


_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make

Re: removing compile directive
country flaguser name
United States
2008-04-21 12:53:28
On 2008-04-21 09:35Z, Mohan Lal Jangir wrote:
> 
> I have a source tree being compiled with -O2 option.
However, for debugging 
> purpose, I want all files in one directory to compile
without -O2. However, 
> Makefile in that directly takes CFLAGS from a parent
Makefile which I can 
> not modify !!

Try adding '-O0' (letter oh, digit zero) at the end
  CFLAGS += -O0
to cancel an earlier '-O2'.


_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make

Re: removing compile directive
user name
2008-04-22 00:48:08
On Mon, 2008-04-21 at 10:43 -0700, Brian Dessent wrote:
> CFLAGS = $(filter-out -D_REMOVE_THIS_,$(CFLAGS))

You can't do this: recursive variables cannot reference
themselves.
You'd have to use := and change this to a simply-expanded
variable
(which might break other things).

Your best bet, as pointed out by someone else, is to add -O0
(or
whatever) to override the optimizer setting.

-- 
------------------------------------------------------------
-------------------
 Paul D. Smith <psmithgnu.org>          Find
some GNU make tips at:
 http://www.gnu.org        
             http://make.mad-scientis
t.us
 "Please remain calm...I may be mad, but I am a
professional." --Mad Scientist


_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make

[1-4]

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