How to strip out a -D for just one file in a gnu makefile?

Posted by WilliamKF on Stack Overflow See other posts from Stack Overflow or by WilliamKF
Published on 2010-04-28T00:08:43Z Indexed on 2010/04/28 0:13 UTC
Read the original article Hit count: 556

Filed under:
|
|
|

I have '-Wredundant-decls' in my CXXFLAGS but for one file, I want it removed.

In my GNU makefile, how can I structure a rule to remove just that part of the CXXFLAGS.

I know how to add only for that file, I would do something like this:

$O/just_one_file.o: CXXFLAGS += -Wredundant-decls

So, ideally I'd do something like this (which doesn't work) to remove it:

$O/just_one_file.o: CXXFLAGS -= -Wredundant-decls

However, maybe with some $ magic, I can construct some kind of sed or perl script to strip out the -Wredundant-decls and set CXXFLAGS to the stripped value:

$O/just_one_file.o: CXXFLAGS = $(shell strip magic here for $CXXFLAGS)

© Stack Overflow or respective owner

Related posts about gnumake

Related posts about makefile