From: Mathieu Baudier Date: Sat, 29 Jan 2022 07:53:49 +0000 (+0100) Subject: Separate JNI projects X-Git-Tag: argeo-commons-2.3.5~49 X-Git-Url: https://git.argeo.org/?p=lgpl%2Fargeo-commons.git;a=commitdiff_plain;h=9d7afbd488afb0c7e4e1cdc0e4282e0194a6d372 Separate JNI projects --- diff --git a/.gitignore b/.gitignore index fab481bb9..c306476f0 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ **/MANIFEST.MF /build/ /sdk.mk +/output/ diff --git a/Makefile b/Makefile index 1145dde26..daa8e2938 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,26 @@ include sdk.mk +.PHONY: clean all build-base build-rcp -MAKEDIRS = org.argeo.api.uuid +all: osgi jni -BUILD_BASE := generated +BASE_BUNDLES := \ +$(SDK_BUILD_BASE)/org.argeo.init.$(MAJOR).$(MINOR).jar \ +$(SDK_BUILD_BASE)/org.argeo.util.$(MAJOR).$(MINOR).jar \ +$(SDK_BUILD_BASE)/org.argeo.api.uuid.$(MAJOR).$(MINOR).jar \ +$(SDK_BUILD_BASE)/org.argeo.api.acr.$(MAJOR).$(MINOR).jar \ +$(SDK_BUILD_BASE)/org.argeo.api.cms.$(MAJOR).$(MINOR).jar \ +$(SDK_BUILD_BASE)/org.argeo.cms.tp.$(MAJOR).$(MINOR).jar \ +$(SDK_BUILD_BASE)/org.argeo.cms.$(MAJOR).$(MINOR).jar \ + -BASE_BUNDLES := $(BUILD_BASE)/org.argeo.api.uuid.$(MAJOR).$(MINOR).jar +NATIVE_PROJECTS = org.argeo.api.uuid/jni -.PHONY: clean all build-base build-rcp -all: build-base - $(foreach dir, $(MAKEDIRS), $(MAKE) -C $(dir);) +jni: + $(foreach dir, $(NATIVE_PROJECTS), $(MAKE) -C $(dir);) clean: - $(foreach dir, $(MAKEDIRS), $(MAKE) -C $(dir) clean;) - + $(foreach dir, $(NATIVE_PROJECTS), $(MAKE) -C $(dir) clean;) + rm -rf $(SDK_BUILD_BASE)/* @@ -20,11 +28,13 @@ JVM := /usr/lib/jvm/jre-11/bin/java ECJ_JAR := /usr/share/java/ecj/ecj.jar BND_TOOL := /usr/bin/bnd -#osgi : $(BASE_BUNDLES) +osgi : $(BASE_BUNDLES) + +$(SDK_BUILD_BASE)/%.$(MAJOR).$(MINOR).jar : $(SDK_SRC_BASE)/*/generated/%.jar + $(BND_TOOL) build $< + cp $< $@ -#$(BUILD_BASE)/%.$(MAJOR).$(MINOR).jar : $(SDK_SRC_BASE)/% -# $(BND_TOOL) build $< -# cp $ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - make - - - - ide - - true - - true - - true - - - - - - - - diff --git a/org.argeo.api.uuid/.project b/org.argeo.api.uuid/.project index 764e6d106..be973cdee 100644 --- a/org.argeo.api.uuid/.project +++ b/org.argeo.api.uuid/.project @@ -5,12 +5,6 @@ - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - org.eclipse.jdt.core.javabuilder @@ -26,19 +20,9 @@ - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - org.eclipse.pde.PluginNature org.eclipse.jdt.core.javanature - org.eclipse.cdt.core.cnature - org.eclipse.cdt.core.ccnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature diff --git a/org.argeo.api.uuid/.settings/language.settings.xml b/org.argeo.api.uuid/.settings/language.settings.xml deleted file mode 100644 index 8c583566d..000000000 --- a/org.argeo.api.uuid/.settings/language.settings.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.argeo.api.uuid/.settings/org.eclipse.cdt.core.prefs b/org.argeo.api.uuid/.settings/org.eclipse.cdt.core.prefs deleted file mode 100644 index c8ec5df2d..000000000 --- a/org.argeo.api.uuid/.settings/org.eclipse.cdt.core.prefs +++ /dev/null @@ -1,6 +0,0 @@ -doxygen/doxygen_new_line_after_brief=true -doxygen/doxygen_use_brief_tag=false -doxygen/doxygen_use_javadoc_tags=true -doxygen/doxygen_use_pre_tag=false -doxygen/doxygen_use_structural_commands=false -eclipse.preferences.version=1 diff --git a/org.argeo.api.uuid/Makefile b/org.argeo.api.uuid/Makefile deleted file mode 100644 index 3feb61027..000000000 --- a/org.argeo.api.uuid/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -JNIDIRS = org_argeo_api_uuid - -.PHONY: clean all jni - -all: jni - -jni: - $(foreach dir, jni/$(JNIDIRS), $(MAKE) -C $(dir);) - -clean: - $(foreach dir, jni/$(JNIDIRS), $(MAKE) -C $(dir) clean;) - -#ide: $(META_INF_DIR)/$(ARCH)/$(TARGET_EXEC) - -#$(META_INF_DIR)/$(ARCH)/$(TARGET_EXEC): $(BUILD_DIR)/$(TARGET_EXEC) -# mkdir -p $(dir $@) -# cp $(BUILD_DIR)/$(TARGET_EXEC) $(dir $@) - - -%: - @echo Making '$@' $(if $^,from '$^') - @echo 'OBJ=$(OBJ)' - @echo 'DEP=$(DEP)' diff --git a/org.argeo.api.uuid/jni/.cproject b/org.argeo.api.uuid/jni/.cproject new file mode 100644 index 000000000..4bb1d0cc8 --- /dev/null +++ b/org.argeo.api.uuid/jni/.cproject @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + make + + + + ide + + true + + true + + true + + + + + + + + diff --git a/org.argeo.api.uuid/jni/.project b/org.argeo.api.uuid/jni/.project new file mode 100644 index 000000000..f8321d76e --- /dev/null +++ b/org.argeo.api.uuid/jni/.project @@ -0,0 +1,27 @@ + + + Java_org_argeo_api_uuid + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/org.argeo.api.uuid/jni/.settings/language.settings.xml b/org.argeo.api.uuid/jni/.settings/language.settings.xml new file mode 100644 index 000000000..7e8a04bfc --- /dev/null +++ b/org.argeo.api.uuid/jni/.settings/language.settings.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/org.argeo.api.uuid/jni/.settings/org.eclipse.cdt.core.prefs b/org.argeo.api.uuid/jni/.settings/org.eclipse.cdt.core.prefs new file mode 100644 index 000000000..c8ec5df2d --- /dev/null +++ b/org.argeo.api.uuid/jni/.settings/org.eclipse.cdt.core.prefs @@ -0,0 +1,6 @@ +doxygen/doxygen_new_line_after_brief=true +doxygen/doxygen_use_brief_tag=false +doxygen/doxygen_use_javadoc_tags=true +doxygen/doxygen_use_pre_tag=false +doxygen/doxygen_use_structural_commands=false +eclipse.preferences.version=1 diff --git a/org.argeo.api.uuid/jni/Makefile b/org.argeo.api.uuid/jni/Makefile new file mode 100644 index 000000000..259b0ae9e --- /dev/null +++ b/org.argeo.api.uuid/jni/Makefile @@ -0,0 +1,23 @@ +JNIDIRS = org_argeo_api_uuid + +.PHONY: clean all jni + +all: jni + +jni: + $(foreach dir, $(JNIDIRS), $(MAKE) -C $(dir);) + +clean: + $(foreach dir, $(JNIDIRS), $(MAKE) -C $(dir) clean;) + +#ide: $(META_INF_DIR)/$(ARCH)/$(TARGET_EXEC) + +#$(META_INF_DIR)/$(ARCH)/$(TARGET_EXEC): $(BUILD_DIR)/$(TARGET_EXEC) +# mkdir -p $(dir $@) +# cp $(BUILD_DIR)/$(TARGET_EXEC) $(dir $@) + + +%: + @echo Making '$@' $(if $^,from '$^') + @echo 'OBJ=$(OBJ)' + @echo 'DEP=$(DEP)' diff --git a/sdk/jni.mk b/sdk/jni.mk index b13ceaf00..6f5c31fb4 100644 --- a/sdk/jni.mk +++ b/sdk/jni.mk @@ -1,33 +1,29 @@ TARGET_EXEC := libJava_$(NATIVE_PACKAGE).so -BASE_DIR := $(shell realpath .) -SRC_DIRS := . - -LDFLAGS=-shared -fPIC -Wl,-soname,$(TARGET_EXEC).$(MAJOR).$(MINOR) +LDFLAGS = -shared -fPIC -Wl,-soname,$(TARGET_EXEC).$(MAJOR).$(MINOR) +SRC_DIRS := . %: @echo Making '$@' $(if $^,from '$^') - @echo 'MAJOR=$(MAJOR)' - @echo 'MINOR=$(MINOR)' - @echo 'BASE_DIR=$(BASE_DIR)' - @echo 'SRC_DIRS=$(BASE_DIR)' +# @echo 'MAJOR=$(MAJOR)' +# @echo 'MINOR=$(MINOR)' + @echo 'SRC_DIRS=$(SRC_DIRS)' @echo 'BUILD_DIR=$(BUILD_DIR)' - @echo 'MAKEFILE_DIR=$(MAKEFILE_DIR)' # # Generic Argeo # -#BUILD_DIR := $(SDK_BUILD_BASE)/$(NATIVE_PACKAGE) -BUILD_DIR := ./build +BUILD_DIR := $(SDK_BUILD_BASE)/$(NATIVE_PACKAGE) +#BUILD_DIR := ./build #META_INF_DIR := ./../META-INF -ARCH := $(shell uname -p) +#ARCH := $(shell uname -p) # Every folder in ./src will need to be passed to GCC so that it can find header files INC_DIRS := $(shell find $(SRC_DIRS) -type d) /usr/lib/jvm/java/include /usr/lib/jvm/java/include/linux .PHONY: clean all ide -all: $(BUILD_DIR)/$(TARGET_EXEC) +all: $(SDK_BUILD_BASE)/$(TARGET_EXEC) # Find all the C and C++ files we want to compile # Note the single quotes around the * expressions. Make will incorrectly expand these otherwise. @@ -49,7 +45,7 @@ INC_FLAGS := $(addprefix -I,$(INC_DIRS)) CPPFLAGS := $(INC_FLAGS) -MMD -MP # The final build step. -$(BUILD_DIR)/$(TARGET_EXEC): $(OBJS) +$(SDK_BUILD_BASE)/$(TARGET_EXEC): $(OBJS) $(CC) $(OBJS) -o $@ $(LDFLAGS) # Build step for C source @@ -63,7 +59,7 @@ $(BUILD_DIR)/%.cpp.o: %.cpp $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@ clean: - rm -r $(BUILD_DIR) + rm -r $(BUILD_DIR) $(SDK_BUILD_BASE)/$(TARGET_EXEC) # Include the .d makefiles. The - at the front suppresses the errors of missing # Makefiles. Initially, all the .d files will be missing, and we don't want those