This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch for Review: Build all libjava .class files at once (Updated)


Hi Tom,

While I am waiting for this:

http://gcc.gnu.org/ml/java-patches/2003-q3/msg00395.html

...I thought I'd another swing at this:

http://gcc.gnu.org/ml/java-patches/2003-q2/msg00181.html

I decided to take an entirely different approach which eliminates
any recursion or phony targets.

These are the tricks:

- make all-recursive depend on libgcj.jar instead of $(all_java_class_files)
- make libgcj.jar depend on the <i>source</i> files instead of the classfiles

I've taken this for a spin and it seems to work beautifully(!) It eliminates
the parallel make issues as well as another flaw in my previous patch
where I was having real targets depend on phony ones, thereby forcing
a repeated relink of libgcj.a.

The only question I have is whether it is well-founded for libgcj.jar to
depend on the source files. The only reason I can think of that this
could go awry is if the classfiles could change through some supernatural
means (i.e. some future funky bytecode postprocessing) independently
of their sourcefiles. At present, though, this seems a bit far-fetched.

Tested on (i686-pc-linux-gnu,i686-pc-linux-gnu,i686-pc-linux-gnu) and
(i686-pc-linux-gnu,i686-pc-linux-gnu,i686-pc-mingw32).

-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/

ChangeLog
2003-08-16  Mohan Embar  <gnustuff@thisiscool.com>

	* Makefile.am: (all_java_class_files): Removed definition.
	(.java.class) Removed.target.
	(libgcj-@gcc_version@.jar): Changed dependency to
	$(all_java_source_files); added compilation step which compiles
	all changed source files in one pass.
	(all-recursive): Changed dependency from $(all_java_class_files)
	to libgcj-@gcc_version@.jar
	* Makefile.in: Rebuilt.

Index: Makefile.am
===================================================================
RCS file: /cvsroot/gcc/gcc/libjava/Makefile.am,v
retrieving revision 1.313
diff -u -2 -r1.313 Makefile.am
--- Makefile.am	8 Aug 2003 16:25:57 -0000	1.313
+++ Makefile.am	16 Aug 2003 15:55:27 -0000
@@ -331,12 +331,9 @@
     $(x_java_source_files)
 
-all_java_class_files = $(all_java_source_files:.java=.class)
-
-.java.class:
-	$(JAVAC) $(JCFLAGS) -classpath '' -bootclasspath $(here):$(srcdir) \
-             -d $(here) $<
-
-libgcj-@gcc_version@.jar: $(all_java_class_files)
+libgcj-@gcc_version@.jar: $(all_java_source_files)
 	-@rm -f libgcj-@gcc_version@.jar
+	@: $(shell echo $? | tr ' ' '\n' > libgcj.sourcelist)
+	@echo Compiling Java sourcefiles...
+	$(JAVAC) $(JCFLAGS) -classpath '' -bootclasspath $(here):$(srcdir) -d $(here) @libgcj.sourcelist
 ## Note that we explicitly want to include directory information.
 	find java gnu javax org -type d -o -type f -name '*.class' | \
@@ -2731,5 +2728,5 @@
 ## Also force all the class files to build first. This makes them build in
 ## the right order to improve performance.
-all-recursive: $(all_java_class_files) $(nat_headers) $(x_nat_headers)
+all-recursive: libgcj-@gcc_version@.jar $(nat_headers) $(x_nat_headers)
 
 ## ################################################################





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]