[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: whether make or the manual on make, a hole this big is a bug
From: |
Paul D. Smith |
Subject: |
Re: whether make or the manual on make, a hole this big is a bug |
Date: |
Wed, 2 Jun 2004 12:49:21 -0400 |
%% "Brian T. Brunner" <address@hidden> writes:
btb> If top and subdir makefiles both have rules named 'clean' that do
btb> different things, that should be fine with make. Whether I make
btb> clean or make target, make warns me that it has a duplicate rule
btb> 'clean' and is overriding the rule for 'clean'. likewise for
btb> 'all'.
You haven't given any concrete example that shows the problem, so we
can't really help. If you have a top makefile which invokes a submake
with a makefile in a subdirectory, then your scenario will never happen:
each instance of make has its own set of rules and they never conflict.
The only way you can get a message like this is if a single instance of
make reads in more than one command script for a target.
btb> I want a means to tell make that I KNOW THERE IS A DUPLICATE RULE
btb> FOR CLEAN! just do it quietly please.
What do you want make to do with the duplicate rule? Run only the last
one? Only the first one? Run some random particular one? Run all of
them? There's no way for make to know.
If you want to run all of them you can turn them into double-colon
rules. If you want one of the other ones you'll have to change your
makefiles to ensure it's the only one that exists.
The easiest thing to do depends on the situation. For "clean" type
rules you can add files and directories to be cleaned to a variable,
then have the one "master" clean rule remove the contents of that
variable.
For "all" type rules often you just add your own rule as a prerequisite
of "all", like:
all: local-all
local-all:
<do my stuff>
You can define the same target multiple times in a makefile, and add
prerequisites to it as often as you like. But, every singe target can
have one and only one set of commands to be run.
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> 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