[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question on building a multple-target rule
From: |
Paul D. Smith |
Subject: |
Re: Question on building a multple-target rule |
Date: |
Mon, 18 Jun 2001 13:35:03 -0400 |
%% "Jeff Vincent" <address@hidden> writes:
jv> <Is there a mailing list I need to subscribe to?>
You _can_ subscribe to help-make and/or bug-make, but you don't _need_
to do so.
http://savannah.gnu.org/mail/?group_id=71
jv> #RULE 1
jv> all: javaClasses
jv> #RULE 2
jv> javaClasses : $(subst $(SRC_DIR),$(DEST_DIR),$(SRC_JAVA:.java=.class))
jv> #RULE 3
jv> $(subst $(SRC_DIR),$(DEST_DIR),$(SRC_JAVA:.java=.class)) : $(SRC_JAVA)
jv> $(JAVA_C_TOOL) $(JAVA_C_OPTS) -d $(DEST_PATH) $?
jv> The problem is that because the way multiple target rules and
jv> multiple dependencies are expanded, RULE 3 gets called for EACH
jv> item in the dependency list for RULE 2.
Yes.
jv> Is there a way for RULE 3 to get called ONLY ONCE for ALL
jv> out-of-date targets?
Not exactly.
You have to use a "fake" target. Combine rule 2 and rule 3 into one
rule (make sure javaClasses is not .PHONY, of course, if it was
previously!):
#RULE 2
javaClasses : $(SRC_JAVA)
$(JAVA_C_TOOL) $(JAVA_C_OPTS) -d $(DEST_PATH) $?
@touch $@
jv> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
Posting HTML to the mailing lists is not necessary; thanks.
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://www.paulandlesley.org/gmake/
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist