From 2a528c217513ef581b196490d50fbbe63ad1fb58 Mon Sep 17 00:00:00 2001 From: helge Date: Fri, 31 Mar 2006 00:10:41 +0000 Subject: [PATCH] added basic GCJ compilation support git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1237 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- gnustep-make/ChangeLog | 8 +++ gnustep-make/GNUmakefile.in | 6 +- gnustep-make/Instance/gcj-tool.make | 91 +++++++++++++++++++++++++++++ gnustep-make/Instance/rules.make | 12 +++- gnustep-make/Master/gcj-tool.make | 55 +++++++++++++++++ gnustep-make/Master/java-tool.make | 2 +- gnustep-make/common.make | 12 ++++ gnustep-make/gcj-tool.make | 31 ++++++++++ gnustep-make/rules.make | 14 +++++ 9 files changed, 226 insertions(+), 5 deletions(-) create mode 100644 gnustep-make/Instance/gcj-tool.make create mode 100644 gnustep-make/Master/gcj-tool.make create mode 100644 gnustep-make/gcj-tool.make diff --git a/gnustep-make/ChangeLog b/gnustep-make/ChangeLog index c7f596ca..a1fa37a4 100644 --- a/gnustep-make/ChangeLog +++ b/gnustep-make/ChangeLog @@ -1,3 +1,11 @@ +2006-03-31 Helge Hess + + * gcj-tool.make, Instance/gcj-tool.make, Master/gcj-tool.make, + GNUmakefile.in: added special AOT tool makefile + + * Instance/rules.make, common.make, rules.make: added support for + ahead-of-time Java compilation (AOT_JAVA_FILES), aka GCJ compilation + 2005-08-29 Helge Hess * Instance/subproject.make: moved include of Shared/pch.make up (to diff --git a/gnustep-make/GNUmakefile.in b/gnustep-make/GNUmakefile.in index d75305a1..322af784 100644 --- a/gnustep-make/GNUmakefile.in +++ b/gnustep-make/GNUmakefile.in @@ -75,7 +75,7 @@ MAKE_FILES = aggregate.make application.make bundle.make service.make \ tool.make ctool.make test-library.make \ objc.make test-application.make test-tool.make subproject.make \ palette.make gswapp.make gswbundle.make clibrary.make \ - documentation.make \ + documentation.make gcj-tool.make \ java-executable.template java-tool.make framework.make \ native-library.make spec-rules.template spec-debug-rules.template \ spec-debug-alone-rules.template \ @@ -87,7 +87,7 @@ MASTER_MAKE_FILES = \ documentation.make framework.make gswapp.make gswbundle.make \ library.make objc.make java.make java-tool.make palette.make \ resource-set.make service.make subproject.make test-application.make \ - test-library.make test-tool.make tool.make + test-library.make test-tool.make tool.make gcj-tool.make INSTANCE_MAKE_FILES = \ rules.make \ @@ -95,7 +95,7 @@ INSTANCE_MAKE_FILES = \ documentation.make framework.make gswapp.make gswbundle.make \ library.make objc.make java.make java-tool.make palette.make \ resource-set.make service.make subproject.make test-application.make \ - test-library.make test-tool.make tool.make + test-library.make test-tool.make tool.make gcj-tool.make INSTANCE_SHARED_MAKE_FILES = bundle.make headers.make java.make \ stamp-string.make strings.make pch.make diff --git a/gnustep-make/Instance/gcj-tool.make b/gnustep-make/Instance/gcj-tool.make new file mode 100644 index 00000000..17ecff77 --- /dev/null +++ b/gnustep-make/Instance/gcj-tool.make @@ -0,0 +1,91 @@ +# +# Instance/gcj-java-tool.make +# +# Instance Makefile rules to build GNUstep-based command line ctools. +# +# Copyright (C) 1997, 2001, 2006 Free Software Foundation, Inc. +# +# Author: Scott Christley +# Author: Nicola Pero +# Author: Helge Hess +# +# This file is part of the GNUstep Makefile Package. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# You should have received a copy of the GNU General Public +# License along with this library; see the file COPYING.LIB. +# If not, write to the Free Software Foundation, +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# +# The name of the GCJ compiled tools is in the AOT_JAVA_TOOL_NAME variable. +# The name of the app class is xxx_MAIN_CLASS (defaults to tool name). +# +# xxx We need to prefix the target name when cross-compiling +# + +ifeq ($(RULES_MAKE_LOADED),) +include $(GNUSTEP_MAKEFILES)/rules.make +endif + +MAIN_CLASS = $(strip $($(GNUSTEP_INSTANCE)_MAIN_CLASS)) + +ifeq ($(MAIN_CLASS),) + MAIN_CLASS = $(AOT_JAVA_TOOL_NAME) +endif + +CC:=gcj # TODO: make configurable +LD:=gcj # TODO: make configurable +ALL_LDFLAGS += --main=$(MAIN_CLASS) + +# This is the directory where the aotjavatools get installed. If you don't +# specify a directory they will get installed in the GNUstep Local +# root. +ifneq ($($(GNUSTEP_INSTANCE)_INSTALL_DIR),) + AOT_JAVA_TOOL_INSTALL_DIR = $($(GNUSTEP_INSTANCE)_INSTALL_DIR) +endif + +ifeq ($(AOT_JAVA_TOOL_INSTALL_DIR),) + AOT_JAVA_TOOL_INSTALL_DIR = $(GNUSTEP_TOOLS) +endif + +.PHONY: internal-aotjavatool-all_ \ + internal-aotjavatool-install_ \ + internal-aotjavatool-uninstall_ + +ALL_TOOL_LIBS = \ + $(shell $(WHICH_LIB_SCRIPT) \ + $(ALL_LIB_DIRS) \ + $(ADDITIONAL_TOOL_LIBS) $(AUXILIARY_TOOL_LIBS) \ + $(TARGET_SYSTEM_LIBS) \ + debug=$(debug) profile=$(profile) shared=$(shared) \ + libext=$(LIBEXT) shared_libext=$(SHARED_LIBEXT)) + +# +# Compilation targets +# +internal-aotjavatool-all_:: $(GNUSTEP_OBJ_DIR) \ + $(GNUSTEP_OBJ_DIR)/$(GNUSTEP_INSTANCE)$(EXEEXT) + +$(GNUSTEP_OBJ_DIR)/$(GNUSTEP_INSTANCE)$(EXEEXT): $(OBJ_FILES_TO_LINK) + $(ECHO_LINKING)$(LD) $(ALL_LDFLAGS) -o $(LDOUT)$@ \ + $(OBJ_FILES_TO_LINK) \ + $(ALL_TOOL_LIBS)$(END_ECHO) + +internal-aotjavatool-install_:: $(AOT_JAVA_TOOL_INSTALL_DIR)/$(GNUSTEP_TARGET_DIR) + $(ECHO_INSTALLING)$(INSTALL_PROGRAM) -m 0755 \ + $(GNUSTEP_OBJ_DIR)/$(GNUSTEP_INSTANCE)$(EXEEXT) \ + $(AOT_JAVA_TOOL_INSTALL_DIR)/$(GNUSTEP_TARGET_DIR)$(END_ECHO) + +$(AOT_JAVA_TOOL_INSTALL_DIR)/$(GNUSTEP_TARGET_DIR): + $(ECHO_CREATING)$(MKINSTALLDIRS) $@$(END_ECHO) + +internal-aotjavatool-uninstall_:: + $(ECHO_UNINSTALLING)rm -f $(AOT_JAVA_TOOL_INSTALL_DIR)/$(GNUSTEP_TARGET_DIR)/$(GNUSTEP_INSTANCE)$(EXEEXT)$(END_ECHO) + +include $(GNUSTEP_MAKEFILES)/Instance/Shared/strings.make + diff --git a/gnustep-make/Instance/rules.make b/gnustep-make/Instance/rules.make index 4eb860c3..e9497e61 100644 --- a/gnustep-make/Instance/rules.make +++ b/gnustep-make/Instance/rules.make @@ -168,6 +168,9 @@ endif # The list of JAVA source files from which to generate jni headers # are in the JAVA_JNI_FILES variable. # +# The list of ahead-of-time JAVA source files to be compiled +# are in the AOT_JAVA_FILES variable. +# # This list of WINDRES source files to be compiled # are in the WINDRES_FILES variable. # @@ -196,6 +199,9 @@ endif OBJC_OBJS = $(patsubst %.m,%$(OEXT),$($(GNUSTEP_INSTANCE)_OBJC_FILES)) OBJC_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_DIR)/,$(OBJC_OBJS)) +AOT_JAVA_OBJS = $(patsubst %.java,%$(OEXT),$($(GNUSTEP_INSTANCE)_AOT_JAVA_FILES)) +AOT_JAVA_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_DIR)/,$(AOT_JAVA_OBJS)) + JAVA_OBJS = $(patsubst %.java,%.class,$($(GNUSTEP_INSTANCE)_JAVA_FILES)) JAVA_OBJ_FILES = $(JAVA_OBJS) @@ -234,7 +240,7 @@ OBJ_FILES = $($(GNUSTEP_INSTANCE)_OBJ_FILES) # OBJ_FILES_TO_LINK to '' we know if there is a link stage to be # performed at all (useful for example in bundles which can contain an # object file, or not). -OBJ_FILES_TO_LINK = $(strip $(C_OBJ_FILES) $(OBJC_OBJ_FILES) $(CC_OBJ_FILES) $(WINDRES_OBJ_FILES) $(SUBPROJECT_OBJ_FILES) $(OBJ_FILES)) +OBJ_FILES_TO_LINK = $(strip $(C_OBJ_FILES) $(OBJC_OBJ_FILES) $(CC_OBJ_FILES) $(AOT_JAVA_OBJ_FILES) $(WINDRES_OBJ_FILES) $(SUBPROJECT_OBJ_FILES) $(OBJ_FILES)) ifeq ($(AUTO_DEPENDENCIES),yes) ifneq ($(strip $(OBJ_FILES_TO_LINK)),) @@ -256,6 +262,8 @@ ADDITIONAL_TOOL_LIBS += $($(GNUSTEP_INSTANCE)_TOOL_LIBS) ADDITIONAL_OBJC_LIBS += $($(GNUSTEP_INSTANCE)_OBJC_LIBS) +ADDITIONAL_AOT_JAVA_LIBS += $($(GNUSTEP_INSTANCE)_AOT_JAVA_LIBS) + ADDITIONAL_LIBRARY_LIBS += $($(GNUSTEP_INSTANCE)_LIBS) \ $($(GNUSTEP_INSTANCE)_LIBRARY_LIBS) @@ -269,6 +277,8 @@ ADDITIONAL_CFLAGS += $($(GNUSTEP_INSTANCE)_CFLAGS) ADDITIONAL_OBJCFLAGS += $($(GNUSTEP_INSTANCE)_OBJCFLAGS) +ADDITIONAL_AOT_JAVAFLAGS += $($(GNUSTEP_INSTANCE)_AOT_JAVAFLAGS) + ADDITIONAL_CCFLAGS += $($(GNUSTEP_INSTANCE)_CCFLAGS) ADDITIONAL_LDFLAGS += $($(GNUSTEP_INSTANCE)_LDFLAGS) diff --git a/gnustep-make/Master/gcj-tool.make b/gnustep-make/Master/gcj-tool.make new file mode 100644 index 00000000..0223f7c2 --- /dev/null +++ b/gnustep-make/Master/gcj-tool.make @@ -0,0 +1,55 @@ +# +# Master/gcj-java-tool.make +# +# Master Makefile rules to build GNUstep-based command line ctools. +# +# Copyright (C) 1997, 2001, 2006 Free Software Foundation, Inc. +# +# Author: Scott Christley +# Author: Nicola Pero +# Author: Helge Hess +# +# This file is part of the GNUstep Makefile Package. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# You should have received a copy of the GNU General Public +# License along with this library; see the file COPYING.LIB. +# If not, write to the Free Software Foundation, +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +ifeq ($(RULES_MAKE_LOADED),) +include $(GNUSTEP_MAKEFILES)/rules.make +endif + +AOT_JAVA_TOOL_NAME := $(strip $(AOT_JAVA_TOOL_NAME)) + +internal-all:: $(AOT_JAVA_TOOL_NAME:=.all.aotjavatool.variables) + +internal-install:: $(AOT_JAVA_TOOL_NAME:=.install.aotjavatool.variables) + +internal-uninstall:: $(AOT_JAVA_TOOL_NAME:=.uninstall.aotjavatool.variables) + +internal-clean:: + rm -rf $(GNUSTEP_OBJ_DIR) + +internal-distclean:: + (cd $(GNUSTEP_BUILD_DIR); \ + rm -rf shared_obj static_obj shared_debug_obj shared_profile_obj \ + static_debug_obj static_profile_obj shared_profile_debug_obj \ + static_profile_debug_obj) + +AOT_JAVA_TOOLS_WITH_SUBPROJECTS = $(strip $(foreach aotjavatool,$(AOT_JAVA_TOOL_NAME),$(patsubst %,$(aotjavatool),$($(aotjavatool)_SUBPROJECTS)))) +ifneq ($(AOT_JAVA_TOOLS_WITH_SUBPROJECTS),) +internal-clean:: $(AOT_JAVA_TOOLS_WITH_SUBPROJECTS:=.clean.aotjavatool.subprojects) +internal-distclean:: $(AOT_JAVA_TOOLS_WITH_SUBPROJECTS:=.distclean.aotjavatool.subprojects) +endif + +internal-strings:: $(AOT_JAVA_TOOL_NAME:=.strings.aotjavatool.variables) + +$(AOT_JAVA_TOOL_NAME): + @$(MAKE) -f $(MAKEFILE_NAME) --no-print-directory \ + $@.all.aotjavatool.variables diff --git a/gnustep-make/Master/java-tool.make b/gnustep-make/Master/java-tool.make index 6ea0ad4d..bde5a58b 100644 --- a/gnustep-make/Master/java-tool.make +++ b/gnustep-make/Master/java-tool.make @@ -25,7 +25,7 @@ # # The name of the tools is in the JAVA_TOOL_NAME variable. # The main class (the one implementing main) is in the -# xxx_PRINCIPAL_CLASS variable. +# xxx_MAIN_CLASS variable. # JAVA_TOOL_NAME := $(strip $(JAVA_TOOL_NAME)) diff --git a/gnustep-make/common.make b/gnustep-make/common.make index 4ba8a314..1b968c86 100644 --- a/gnustep-make/common.make +++ b/gnustep-make/common.make @@ -556,6 +556,18 @@ ifeq ($(JAVAH),) JAVAH = $(JAVA_HOME)/bin/javah endif +# +# Some GCJ Java Options +# + +INTERNAL_AOT_JAVAFLAGS += -fjni -findirect-dispatch + +ifeq ($(shared), yes) + INTERNAL_AOT_JAVAFLAGS += $(SHARED_CFLAGS) +endif + +INTERNAL_AOT_JAVAFLAGS += $(ADDITIONAL_FLAGS) $(OPTFLAG) + # # Common variables - default values # diff --git a/gnustep-make/gcj-tool.make b/gnustep-make/gcj-tool.make new file mode 100644 index 00000000..c9ef63dc --- /dev/null +++ b/gnustep-make/gcj-tool.make @@ -0,0 +1,31 @@ +# +# gcj-tool.make +# +# Makefile rules to build GNUstep-based command line ctools. +# +# Copyright (C) 2002, 2006 Free Software Foundation, Inc. +# +# Author: Nicola Pero +# Author: Helge Hess +# +# This file is part of the GNUstep Makefile Package. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# You should have received a copy of the GNU General Public +# License along with this library; see the file COPYING.LIB. +# If not, write to the Free Software Foundation, +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +ifeq ($(GNUSTEP_INSTANCE),) +include $(GNUSTEP_MAKEFILES)/Master/gcj-tool.make +else + +ifeq ($(GNUSTEP_TYPE),aotjavatool) +include $(GNUSTEP_MAKEFILES)/Instance/gcj-tool.make +endif + +endif diff --git a/gnustep-make/rules.make b/gnustep-make/rules.make index 5676b4aa..050a11e8 100644 --- a/gnustep-make/rules.make +++ b/gnustep-make/rules.make @@ -246,6 +246,14 @@ ALL_CFLAGS = $(INTERNAL_CFLAGS) $(ADDITIONAL_CFLAGS) \ $(GNUSTEP_HEADERS_FLAGS) \ $(GNUSTEP_FRAMEWORKS_FLAGS) +ALL_AOT_JAVAFLAGS = $(INTERNAL_AOT_JAVAFLAGS) $(ADDITIONAL_AOT_JAVAFLAGS) \ + $(AUXILIARY_AOT_JAVAFLAGS) $(ADDITIONAL_INCLUDE_DIRS) \ + $(AUXILIARY_INCLUDE_DIRS) \ + $(DERIVED_SOURCES_HEADERS_FLAG) \ + -I. $(SYSTEM_INCLUDES) \ + $(GNUSTEP_HEADERS_FLAGS) \ + $(GNUSTEP_FRAMEWORKS_FLAGS) + # if you need, you can define ADDITIONAL_CCFLAGS to add C++ specific flags ALL_CCFLAGS = $(ADDITIONAL_CCFLAGS) $(AUXILIARY_CCFLAGS) @@ -395,6 +403,12 @@ $(GNUSTEP_OBJ_DIR)/%${OEXT} : %.m $(PCH_INCLUDE_FLAG) \ $($<_FILE_FLAGS) -o $@$(END_ECHO) +$(GNUSTEP_OBJ_DIR)/%${OEXT} : %.java + $(ECHO_COMPILING)$(CC) $< -c \ + $(filter-out -D%,$(ALL_CPPFLAGS) $(ALL_AOT_JAVAFLAGS)) \ + $(PCH_INCLUDE_FLAG) \ + $($<_FILE_FLAGS) -o $@$(END_ECHO) + $(GNUSTEP_OBJ_DIR)/%${OEXT} : %.C $(ECHO_COMPILING)$(CC) $< -c \ $(filter-out $($<_FILE_FILTER_OUT_FLAGS),$(ALL_CPPFLAGS) \ -- 2.39.5