[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: possible simplification?
From: |
Paul D. Smith |
Subject: |
Re: possible simplification? |
Date: |
Tue, 10 Sep 2002 23:30:18 -0400 |
%% Charles Owen <address@hidden> writes:
co> I wonder if there is a simpler, more direct way to do the following:
co> package := example
co> $(classfiles)/$(package)/%.class: $(src)/$(package)/%.java
co> @echo "Compiling address@hidden"
co> @$(javac) $^
co> $(classfiles)/$(package)/%.class: $(tests)/$(package)/%.java
co> @echo "Compiling address@hidden"
co> @$(javac) $^
co> package := util
co> $(classfiles)/$(package)/%.class: $(src)/$(package)/%.java
co> @echo "Compiling address@hidden"
co> @$(javac) $^
co> $(classfiles)/$(package)/%.class: $(tests)/$(package)/%.java
co> @echo "Compiling address@hidden"
co> @$(javac) $^
Since $(package) is the same in the target and prerequisite, why not
just write:
$(classfiles)/%.class : $(src)/%.java
@echo "Compiling address@hidden"
@$(javac) $^
$(classfiles)/%.class : $(tests)/%.java
@echo "Compiling address@hidden"
@$(javac) $^
? Now these rules will work regardless of the value of $(package) for a
particular target.
Remember that "%" is a text matching token; it doesn't know anything
about directory separators and is not limited by them.
--
-------------------------------------------------------------------------------
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