On Tue, 2007-01-09 at 11:47 -0800, Vincent Castellano wrote:
> Hello,
> 
> I was wondering if there is any method to suppress the following type
> of messages:
> 
> Makefile:98: warning: overriding commands for target `lib'
> Makefile:50: warning: ignoring old commands for target `lib'
> Makefile:98: warning: overriding commands for target `cli'
> Makefile:60: warning: ignoring old commands for target `cli'
> Makefile:98: warning: overriding commands for target `debug'
> Makefile:54: warning: ignoring old commands for target `debug'
> Makefile:98: warning: overriding commands for target `cli-debug'
> Makefile:66: warning: ignoring old commands for target `cli-debug'

The only way is to avoid declaring two targets with commands in both.

> # This will override the targets for make's without a CFG=
> # Will generate warnings for override and ignore, may be ignored.
> # Update this when adding new targets
> ifndef CFG
> lib cli debug cli-debug dll dll-debug distro main cli-distro dll-distro:
>       $(foreach cfg,$(cfg_list), $(MAKE) CFG=$(cfg) $@;)
> endif

You could do something like this:

.PRE :=
ifndef CFG
lib cli debug cli-debug dll dll-debug distro main cli-distro dll-distro:
        $(foreach cfg,$(cfg_list), $(MAKE) CFG=$(cfg) $@;)
.PRE := foo-
endif
...
$(.PRE)lib:
        ...
$(.PRE)cli:
        ...
...

That way when CFG is not defined the "original" targets will be changed
to "foo-lib", etc. (or use whatever prefix you like--the goal is just to
change them so they don't conflict).

It looks a bit gross in the makefile but it's better (IMO) than seeing
the warnings printed out.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[EMAIL PROTECTED]>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist


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

Reply via email to