[kaffe] build process

Helmer Krämer hkraemer at freenet.de
Sun Jun 27 10:14:52 PDT 2004


Hi all,

the attached patch modifies kaffe's build process a little bit,
so that it executes in roughly four steps:

* build kaffeh, libkaffevm, standard libtool -modules and kaffe
  executable

* build rt.jar

* build optional libtool -modules (like awt, sound, libxmlj)
  [including generation of required headers]

* relink kaffe executable using all libtool -modules
  [required for systems that can't dlopen libtool -modules]

Since the jni headers for the optional libtool -modules are
generated after rt.jar has been built, we no longer have to
include classes of optional packages in Klasses.jar.bootstrap.

If nobody has any objections, I'll check it in during next
week.

Regards,
Helmer
-------------- next part --------------
Index: configure.ac
===================================================================
RCS file: /cvs/kaffe/kaffe/configure.ac,v
retrieving revision 1.37
diff -u -r1.37 configure.ac
--- configure.ac	23 Jun 2004 15:36:42 -0000	1.37
+++ configure.ac	27 Jun 2004 17:02:36 -0000
@@ -1727,8 +1727,11 @@
       AC_MSG_ERROR([unable to locate libxml.]))
     AM_PATH_XSLT([1.0.24],[CFLAGS="${XSLT_CFLAGS} ${CFLAGS}"] [CPPFLAGS="${XSLT_CFLAGS} ${CPPFLAGS}"] [LIBS="${XSLT_LIBS} ${LIBS}"] ,
       AC_MSG_ERROR([unable to locate libxslt.]))
+    LIBXMLJ_LIB="\$(top_builddir)/libraries/clib/libxmlj/libxmlj.la"
   else
     AC_MSG_ERROR([Not building libxmlj - only available with pthreads.])
+    enable_libxmlj="no"
+    LIBXMLJ_LIB=""
   fi
 fi
 
@@ -1771,12 +1774,8 @@
 \$(top_builddir)/libraries/clib/io/libio.la \
 \$(top_builddir)/libraries/clib/nio/libnio.la \
 \$(top_builddir)/libraries/clib/zip/libzip.la \
-$MATH_LIB \
-$ALSA_LIB \
-$ESD_LIB \
 \$(top_builddir)/libraries/clib/management/libmanagement.la \
 \$(top_builddir)/libraries/clib/security/libsecurity.la \
-$AWT_LIB \
 $JAVA_LIBS \
 "
 
@@ -1785,6 +1784,21 @@
   DLOPEN_JAVA_LIBS="$DLOPEN_JAVA_LIBS -dlopen $lib"
 done
 AC_SUBST(DLOPEN_JAVA_LIBS)
+
+
+OPT_JAVA_LIBS=" \
+$ALSA_LIB \
+$ESD_LIB \
+$LIBXMLJ_LIB \
+$AWT_LIB \
+"
+
+OPT_DLOPEN_JAVA_LIBS=
+for lib in $OPT_JAVA_LIBS; do
+  OPT_DLOPEN_JAVA_LIBS="$OPT_DLOPEN_JAVA_LIBS -dlopen $lib"
+done
+AC_SUBST(OPT_DLOPEN_JAVA_LIBS)
+
 
 if test x"$dynamic_libraries" = x"no"; then
 	KLIBFLAGS=-static
Index: Makefile.am
===================================================================
RCS file: /cvs/kaffe/kaffe/Makefile.am,v
retrieving revision 1.68
diff -u -r1.68 Makefile.am
--- Makefile.am	22 Jun 2004 12:21:27 -0000	1.68
+++ Makefile.am	27 Jun 2004 17:02:37 -0000
@@ -14,8 +14,7 @@
 
 AUTOMAKE_OPTIONS = foreign 1.3e
 
-SUBDIRS = . config include replace libltdl kaffe/kaffevm libraries/clib libraries/extensions kaffe libraries/javalib tools test po
-
+SUBDIRS =
 DIST_SUBDIRS = . config include replace libltdl kaffe libraries tools test po
 
 EXTRA_DIST = \
@@ -171,3 +170,77 @@
 # Regenerate HTML docs and copy them to source tree
 docs-regen: docs-docbook-html
 	cp -f target/docs/docbook/*.html $(srcdir)/docs/html
+
+
+#
+# things we need to compile before we can compile rt.jar 
+#
+DIRECTORIES_BEFORE_RTJAR = \
+	config \
+	include \
+	replace \
+	libltdl \
+	kaffe/kaffevm \
+	libraries/clib \
+	kaffe
+
+#
+# things we need to compile after we have compiled rt.jar 
+#
+DIRECTORIES_AFTER_RTJAR = \
+	tools \
+	test \
+	po \
+	libraries/clib/awt
+
+if COND_LIBXMLJ
+DIRECTORIES_AFTER_RTJAR += libraries/clib/libxmlj
+endif
+
+if COND_SOUND_ALSA
+DIRECTORIES_AFTER_RTJAR += libraries/clib/sound
+else 
+if COND_SOUND_ESD
+DIRECTORIES_AFTER_RTJAR += libraries/clib/sound
+endif
+endif
+
+all-local:
+	@list="$(DIRECTORIES_BEFORE_RTJAR)"; for subdir in $$list; do \
+		$(MAKE) -C $$subdir all || exit $$? ; \
+	done; \
+	$(MAKE) -C libraries/javalib all || exit $$? ; \
+	list="$(DIRECTORIES_AFTER_RTJAR)"; for subdir in $$list; do \
+		$(MAKE) -C $$subdir all || exit $$? ; \
+	done ; \
+	$(MAKE) -C kaffe/kaffe final-executable
+
+install-exec-hook:
+	@list="$(DIRECTORIES_BEFORE_RTJAR)"; for subdir in $$list; do \
+		$(MAKE) -C $$subdir install-exec || exit $$? ; \
+	done; \
+	$(MAKE) -C libraries/javalib install-exec || exit $$? ; \
+	list="$(DIRECTORIES_AFTER_RTJAR)"; for subdir in $$list; do \
+		$(MAKE) -C $$subdir install-exec || exit $$? ; \
+	done 
+
+install-data-hook:
+	@list="$(DIRECTORIES_BEFORE_RTJAR)"; for subdir in $$list; do \
+		$(MAKE) -C $$subdir install-data || exit $$? ; \
+	done; \
+	$(MAKE) -C libraries/javalib install-data || exit $$? ; \
+	list="$(DIRECTORIES_AFTER_RTJAR)"; for subdir in $$list; do \
+		$(MAKE) -C $$subdir install-data || exit $$? ; \
+	done 
+
+uninstall-hook:
+	@list="$(DIRECTORIES_BEFORE_RTJAR)"; for subdir in $$list; do \
+		$(MAKE) -C $$subdir uninstall || exit $$? ; \
+	done; \
+	$(MAKE) -C libraries/javalib uninstall || exit $$? ; \
+	list="$(DIRECTORIES_AFTER_RTJAR)"; for subdir in $$list; do \
+		$(MAKE) -C $$subdir uninstall || exit $$? ; \
+	done 
+
+check-local:
+	$(MAKE) -C test check
Index: include/Makefile.am
===================================================================
RCS file: /cvs/kaffe/kaffe/include/Makefile.am,v
retrieving revision 1.62
diff -u -r1.62 Makefile.am
--- include/Makefile.am	23 Jun 2004 09:11:41 -0000	1.62
+++ include/Makefile.am	27 Jun 2004 17:02:37 -0000
@@ -106,23 +106,6 @@
 INSTALL_JNI_DERIVED_HDRS =
 
 NOINSTALL_JNI_DERIVED_HDRS = \
-	gnu_xml_libxmlj_dom_GnomeAttr.h \
-	gnu_xml_libxmlj_dom_GnomeDocument.h \
-	gnu_xml_libxmlj_dom_GnomeDocumentBuilder.h \
-	gnu_xml_libxmlj_dom_GnomeDocumentType.h	\
-	gnu_xml_libxmlj_dom_GnomeElement.h \
-	gnu_xml_libxmlj_dom_GnomeEntity.h \
-	gnu_xml_libxmlj_dom_GnomeNamedNodeMap.h \
-	gnu_xml_libxmlj_dom_GnomeNode.h \
-	gnu_xml_libxmlj_dom_GnomeNodeList.h \
-	gnu_xml_libxmlj_dom_GnomeProcessingInstruction.h \
-	gnu_xml_libxmlj_dom_MatchingNodeList.h \
-	gnu_xml_libxmlj_sax_GnomeLocator.h \
-	gnu_xml_libxmlj_sax_GnomeXMLReader.h \
-	gnu_xml_libxmlj_transform_LibxsltStylesheet.h \
-	gnu_xml_libxmlj_transform_TransformerFactoryImpl.h \
-	gnu_xml_libxmlj_transform_JavaContext.h \
-	gnu_xml_libxmlj_transform_LibxmlDocument.h \
 	java_math_BigInteger.h \
 	gnu_java_nio_channels_FileChannelImpl.h \
 	gnu_java_nio_NIOServerSocket.h \
@@ -141,11 +124,13 @@
 	kaffe_security_provider_MD2.h \
 	kaffe_security_provider_MD4.h \
 	kaffe_security_provider_MD5.h \
-	kaffe_security_provider_SHA.h \
-	org_tritonus_lowlevel_esd_Esd.h \
-	org_tritonus_lowlevel_esd_EsdRecordingStream.h \
-	org_tritonus_lowlevel_esd_EsdSample.h \
-	org_tritonus_lowlevel_esd_EsdStream.h \
+	kaffe_security_provider_SHA.h
+
+
+JNI_DERIVED_HDRS = $(INSTALL_JNI_DERIVED_HDRS) $(NOINSTALL_JNI_DERIVED_HDRS)
+
+
+LIBTRITONUSALSA_JNI_HDRS = \
 	org_tritonus_lowlevel_alsa_AlsaCtlCardInfo.h \
 	org_tritonus_lowlevel_alsa_AlsaCtl.h \
 	org_tritonus_lowlevel_alsa_Alsa.h \
@@ -167,7 +152,37 @@
 	org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents.h \
 	org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo.h
 
-JNI_DERIVED_HDRS = $(INSTALL_JNI_DERIVED_HDRS) $(NOINSTALL_JNI_DERIVED_HDRS)
+
+LIBTRITONUSESD_JNI_HDRS = \
+	org_tritonus_lowlevel_esd_Esd.h \
+	org_tritonus_lowlevel_esd_EsdRecordingStream.h \
+	org_tritonus_lowlevel_esd_EsdSample.h \
+	org_tritonus_lowlevel_esd_EsdStream.h \
+	org_tritonus_lowlevel_esd_Esd.h \
+	org_tritonus_lowlevel_esd_EsdRecordingStream.h \
+	org_tritonus_lowlevel_esd_EsdSample.h \
+	org_tritonus_lowlevel_esd_EsdStream.h
+
+
+LIBXMLJ_JNI_HDRS = \
+	gnu_xml_libxmlj_dom_GnomeAttr.h \
+	gnu_xml_libxmlj_dom_GnomeDocument.h \
+	gnu_xml_libxmlj_dom_GnomeDocumentBuilder.h \
+	gnu_xml_libxmlj_dom_GnomeDocumentType.h	\
+	gnu_xml_libxmlj_dom_GnomeElement.h \
+	gnu_xml_libxmlj_dom_GnomeEntity.h \
+	gnu_xml_libxmlj_dom_GnomeNamedNodeMap.h \
+	gnu_xml_libxmlj_dom_GnomeNode.h \
+	gnu_xml_libxmlj_dom_GnomeNodeList.h \
+	gnu_xml_libxmlj_dom_GnomeProcessingInstruction.h \
+	gnu_xml_libxmlj_dom_MatchingNodeList.h \
+	gnu_xml_libxmlj_sax_GnomeLocator.h \
+	gnu_xml_libxmlj_sax_GnomeXMLReader.h \
+	gnu_xml_libxmlj_transform_LibxsltStylesheet.h \
+	gnu_xml_libxmlj_transform_TransformerFactoryImpl.h \
+	gnu_xml_libxmlj_transform_JavaContext.h \
+	gnu_xml_libxmlj_transform_LibxmlDocument.h
+
 
 if USE_COMPAT_IFADDRS
 ifaddrs_compat = ifaddrs.h
@@ -246,19 +261,15 @@
 	done
 	@echo timestamp > $@
 
-$(JNI_DERIVED_HDRS): stamp-h1all
-	@if test -f $@; then :; else \
-## If this file is removed after stamp-h1all is built, force its rebuild.
-	  rm -f stamp-h1all; $(MAKE) JNI_DERIVED_HDRS=$@ stamp-h1all; \
-	fi
 
-stamp-h1all: stamp-kaffeh $(KLASSES_JAR)
+.PHONY: rebuild-jni-hdrs
+rebuild-jni-hdrs: stamp-kaffeh $(KLASSES_JAR)
 ## Then, generate each header file,
 ## but if it does not change, do not touch it
-	@set -e; for f in $(JNI_DERIVED_HDRS); do \
+	@set -e; for f in $(HDRS); do \
 	  class=`echo $$f | sed -e 's%.*/%%g' -e 's%\.h$$%%' -e 's%_%/%g'`; \
-	  echo "$(KAFFEH) -jni -classpath $(KLASSES_JAR) -o $$f $$class"; \
-	  $(KAFFEH) -jni -classpath $(KLASSES_JAR) -o stamp-h1$$f $$class; \
+	  echo "$(KAFFEH) -jni -classpath $(KLASSES_JAR):$(top_builddir)/libraries/javalib/lib -o $$f $$class"; \
+	  $(KAFFEH) -jni -classpath $(KLASSES_JAR):$(top_builddir)/libraries/javalib/lib -o stamp-h1$$f $$class; \
 	  if test -f $$f && cmp $$f stamp-h1$$f >/dev/null; then \
 	    echo "$$f is already up-to-date"; \
 	    rm -f stamp-h1$$f; \
@@ -268,14 +279,70 @@
 	done
 	@echo timestamp > $@
 
-CLEANFILES = $(DERIVED_HDRS) $(JNI_DERIVED_HDRS) stamp-kaffeh
+
+#
+# jni headers of the core libraries
+#
+$(JNI_DERIVED_HDRS): stamp-h1all
+	@if test -f $@; then :; else \
+	  rm -f stamp-h1all; $(MAKE) JNI_DERIVED_HDRS=$@ stamp-h1all; \
+	fi
+
+stamp-h1all: HDRS = $(JNI_DERIVED_HDRS)
+stamp-h1all: rebuild-jni-hdrs
+
+#
+# header files for alsa backend of tritonus
+#
+libtritonusalsa_headers: stamp-libtritonusalsa
+	@if test -f $@; then :; else \
+	  rm -f stamp-libtritonusalsa; $(MAKE) JNI_DERIVED_HDRS=$@ stamp-libtritonusalsa; \
+	fi
+
+stamp-libtritonusalsa: HDRS = $(LIBTRITONUSALSA_JNI_HDRS)
+stamp-libtritonusalsa: rebuild-jni-hdrs
+
+#
+# header files for esd backend of tritonus
+#
+libtritonusesd_headers: stamp-libtritonusesd
+	@if test -f $@; then :; else \
+	  rm -f stamp-libtritonusesd; $(MAKE) JNI_DERIVED_HDRS=$@ stamp-libtritonusesd; \
+	fi
+
+stamp-libtritonusesd: HDRS = $(LIBTRITONUSESD_JNI_HDRS)
+stamp-libtritonusesd: rebuild-jni-hdrs
+
+#
+# header files for libxmlj
+#
+libxmlj_headers: stamp-libxmlj
+	@if test -f $@; then :; else \
+	  rm -f stamp-libxmlj; $(MAKE) JNI_DERIVED_HDRS=$@ stamp-libxmlj; \
+	fi
+
+stamp-libxmlj: HDRS = $(LIBXMLJ_JNI_HDRS)
+stamp-libxmlj: rebuild-jni-hdrs
+
+
+
+CLEANFILES = \
+	$(DERIVED_HDRS) \
+	$(JNI_DERIVED_HDRS) \
+	$(LIBTRITONUSALSA_JNI_HDRS) \
+	$(LIBTRITONUSESD_JNI_HDRS) \
+	$(LIBXMLJ_JNI_HDRS) \
+	stamp-kaffeh
 
 DISTCLEANFILES = \
 	$(DERIVED_HDRS) \
 	$(JNI_DERIVED_HDRS) \
 	kaffe/jtypes.h \
 	stamp-h0all \
-	stamp-h1all
+	stamp-h1all \
+	stamp-libtritonusalsa \
+	stamp-libtritonusesd \
+	stamp-libxmlj
 
 dist-hook:
 	@for file in $(DISTCLEANFILES); do \
Index: libraries/clib/Makefile.am
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/Makefile.am,v
retrieving revision 1.7
diff -u -r1.7 Makefile.am
--- libraries/clib/Makefile.am	28 Apr 2004 20:42:57 -0000	1.7
+++ libraries/clib/Makefile.am	27 Jun 2004 17:02:37 -0000
@@ -20,4 +20,6 @@
   MAYBE_LIBXMLJ =
 endif
 
-SUBDIRS = native io nio net zip $(MAYBE_NATIVE_MATH) $(MAYBE_LIBXMLJ) security management awt sound
+DIST_SUBDIRS = native io nio net zip math libxmlj security management awt sound
+
+SUBDIRS = native io nio net zip $(MAYBE_NATIVE_MATH) security management
Index: libraries/clib/libxmlj/Makefile.am
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/libxmlj/Makefile.am,v
retrieving revision 1.3
diff -u -r1.3 Makefile.am
--- libraries/clib/libxmlj/Makefile.am	3 Jun 2004 18:56:06 -0000	1.3
+++ libraries/clib/libxmlj/Makefile.am	27 Jun 2004 17:02:37 -0000
@@ -51,3 +51,8 @@
 	-Wall \
 	-fbounds-check
 
+
+$(libxmlj_la_SOURCES): libxmlj_headers
+.PHONY:libxmlj_headers
+libxmlj_headers:
+	@$(MAKE) -C $(top_builddir)/include libxmlj_headers
\ No newline at end of file
Index: libraries/clib/sound/alsa/Makefile.am
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/sound/alsa/Makefile.am,v
retrieving revision 1.1
diff -u -r1.1 Makefile.am
--- libraries/clib/sound/alsa/Makefile.am	28 Apr 2004 20:42:58 -0000	1.1
+++ libraries/clib/sound/alsa/Makefile.am	27 Jun 2004 17:02:37 -0000
@@ -46,3 +46,8 @@
 	constants_check.h
 
 CLEANFILES = so_locations
+
+$(libtritonusalsa_la_SOURCES): libtritonusalsa_headers
+.PHONY: libtritonusalsa_headers
+libtritonusalsa_headers:
+	@$(MAKE) -C $(top_builddir)/include libtritonusalsa_headers
\ No newline at end of file
Index: libraries/clib/sound/esd/Makefile.am
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/sound/esd/Makefile.am,v
retrieving revision 1.1
diff -u -r1.1 Makefile.am
--- libraries/clib/sound/esd/Makefile.am	28 Apr 2004 20:43:00 -0000	1.1
+++ libraries/clib/sound/esd/Makefile.am	27 Jun 2004 17:02:37 -0000
@@ -27,3 +27,8 @@
 	common.h 
 
 CLEANFILES = so_locations
+
+$(libtritonusesd_la_SOURCES): libtritonusesd_headers
+.PHONY: libtritonusesd_headers
+libtritonusesd_headers:
+	@$(MAKE) -C $(top_builddir)/include libtritonusesd_headers
\ No newline at end of file
Index: kaffe/kaffe/Makefile.am
===================================================================
RCS file: /cvs/kaffe/kaffe/kaffe/kaffe/Makefile.am,v
retrieving revision 1.24
diff -u -r1.24 Makefile.am
--- kaffe/kaffe/Makefile.am	22 Jun 2004 15:35:42 -0000	1.24
+++ kaffe/kaffe/Makefile.am	27 Jun 2004 17:02:37 -0000
@@ -78,6 +78,14 @@
 
 DISTCLEANFILES = version-info.h
 
+#
+# relink the kaffe binary including the optinal java libs
+#
+final-executable: 
+	@rm -f kaffe-bin$(EXEEXT)
+	@$(MAKE) kaffe-bin$(EXEEXT) kaffe_bin_LDADD="$(OPT_DLOPEN_JAVA_LIBS) $(kaffe_bin_LDADD)"
+
+
 dist-hook:
 	@for file in $(DISTCLEANFILES); do \
 	  rm -f $(distdir)/$$file; \


More information about the kaffe mailing list