This is the mail archive of the java-patches@sources.redhat.com 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]

Don't exceed command-line length limits


Some OSs on which I've been building libjava impose limits on
command-line lengths that libjava Makefiles used to exceed.  Here's a
patch that reworks the Makefiles so as to avoid emitting exceedingly
long command lines, and to give feedback to the user as each Java
source file is compiled.  Unfortunately, it introduces yet another
dependency on GNU make, but since we already had some, I thought it
wouldn't hurt too much.  Ok to install?

Index: libjava/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>
	* Makefile.am: Re-work shell commands that exceeded length limits
	on command lines.

Index: libjava/Makefile.am
===================================================================
RCS file: /cvs/java/libgcj/libjava/Makefile.am,v
retrieving revision 1.88
diff -u -p -r1.88 Makefile.am
--- libjava/Makefile.am 2000/09/07 12:09:40 1.88
+++ libjava/Makefile.am 2000/09/10 09:44:58
@@ -147,8 +147,11 @@ $(built_java_source_files:.java=.class):
 ## This little nastiness is here so that the backquoted stuff in the
 ## GCJ definition can be correctly expanded, if required.
 	javac="$(JAVAC)"; \
-	$$javac -L$(here) $(JCFLAGS) -classpath $(here):`cd $(srcdir) && /bin/pwd` \
-	  -d $(here) $?
+	for f in $?; do \
+	  echo Compiling $$f...; \
+	  $$javac -L$(here) $(JCFLAGS) -classpath $(here):`cd $(srcdir) && /bin/pwd` \
+	  -d $(here) $$f; \
+	done
 
 ## We have the zip file depend on the java sources and not the class
 ## files, because we don't know the names of all the class files.
@@ -157,20 +160,24 @@ $(built_java_source_files:.java=.class):
 ## `make libgcj.zip' will not rebuilt foo.class.  That's because
 ## libgcj.zip is not out-of-date with respect to foo.java.
 libgcj.zip: $(java_source_files)
+## Create a list of all Java sources, without exceeding any shell limits.
+	@: $(shell echo Creating list of files to compile...) $(shell rm -f list || :) $(shell touch list) $(foreach source,$(subst $(srcdir)/,,$?),$(shell echo $(source) >> tmp-list))
 ## FIXME: this ought to depend on built_java_source_files, but right
 ## now it can't.  Ugly.
 	$(MAKE) $(built_java_source_files:.java=.class)
 ## This little nastiness is here so that the backquoted stuff in the
 ## GCJ definition can be correctly expanded, if required.
-	javac="$(JAVAC)"; cd $(srcdir); \
-	  $$javac $(JCFLAGS) -classpath $(here):`/bin/pwd` -d $(here) \
-	    $(subst $(srcdir)/,,$?)
-	-@rm -f libgcj.zip
+	javac="$(JAVAC)"; dir=`/bin/pwd`; cd $(srcdir); \
+	  for f in `cat $$dir/tmp-list`; do \
+	    echo Compiling $$f...; \
+	    $$javac $(JCFLAGS) -classpath $(here):`/bin/pwd` -d $(here) $$f; \
+	done
+	-@rm -f tmp-list libgcj.zip
 ## Note that we explicitly want to include directory information.
 	$(ZIP) -r libgcj java gnu -n .class -i '*.class' -i '*/'
 
 MOSTLYCLEANFILES = $(javao_files) $(nat_files) $(nat_headers) $(c_files)
-CLEANFILES = libgcj.zip
+CLEANFILES = tmp-list libgcj.zip
 
 clean-local:
 ## We just remove every .class file that was created.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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