[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Compiling multiple sources at once
From: |
Paul D. Smith |
Subject: |
Re: Compiling multiple sources at once |
Date: |
Tue, 4 Sep 2001 14:59:27 -0400 |
%% Ray Ontko <address@hidden> writes:
ro> The basic problem is this: It's much faster to compile many java
ro> (or c) programs at once than it is to compile each separately.
For Java, I believe it. For C, I doubt the speed increase is all that
great; some compilers won't even let you build multiple .o's with one
invocation of the compiler.
ro> What I want to do is compile all files that are out of date at
ro> once.
ro> My Makefile looks something like this:
ro> %.class : %.java
ro> javac $@
ro> JAVA_FILES = a.java b.java c.java
ro> CLASS_FILES = $(JAVA_FILES:.java=.class)
ro> all : $(CLASS_FILES)
ro> What happens:
ro> javac a.java
ro> javac b.java
ro> javac c.java
ro> What I want to have happen:
ro> javac a.java b.java c.java
ro> When I do a "make all", I want the a _single_ javac command to be
ro> executed, but only for those .class files which are out of date
ro> with respect to their .java files. It takes about 10 times as
ro> long to do a separate javac for each file as it does to do a
ro> javac for all files.
ro> Has anyone got a clever solution that allows multiple targets to
ro> be coallesced into a single implicit rule? Are there other
ro> work-arounds?
There is no direct support in make for this.
You can hack it, but you cannot use implicit rules. You'll have to do
something like this:
JAVA_FILES = a.java b.java c.java
all : .built_java_classes
.built_java_classes : $(JAVA_FILES)
javac $?
@touch $@
--
-------------------------------------------------------------------------------
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Compiling multiple sources at once,
Paul D. Smith <=