From: Not Zed Date: Wed, 27 Apr 2022 02:35:16 +0000 (+0930) Subject: Makefile fixes for native targets. X-Git-Url: https://code.zedzone.au/cvs?a=commitdiff_plain;h=81c5fcfc26576531dfc0027df5eea09fb83d03b2;p=panamaz Makefile fixes for native targets. Changed to use the '.jar' target (or phony target for native-only modules) for most dependencies. API targets now depend on notzed.nativez.jar which fixes some dependency issues. --- diff --git a/Makefile b/Makefile index 1f9ce1d..824bbbd 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,8 @@ notzed.vkheader_JDEPMOD = notzed.nativez notzed.xlib notzed.vkheader.test_JDEPMOD = notzed.vkheader notzed.vulkan_JDEPMOD = notzed.nativez notzed.xlib notzed.xcb notzed.vulkan.test_JDEPMOD = notzed.vulkan +notzed.xcb_JDEPMOD = notzed.nativez +notzed.xlib_JDEPMOD = notzed.nativez notzed.apistatic_JMAIN = api.test.TestAPI notzed.apiobject_JMAIN = api.test.TestAPI diff --git a/README b/README index ee4c1ab..3112661 100644 --- a/README +++ b/README @@ -32,12 +32,7 @@ vulkan-tools-1.2.x. Copy config.make.in to config.make and modify any variables required. -First compile the native binding tools. This should only need to be -done once after which it auto-updates properly. - -$ make notzed.nativez - -Then make everything else, parallel make should work. +Then make everything, parallel make should work. $ make -j @@ -47,7 +42,7 @@ $ make notzed.nativez Or run a demo (see next section): -$ make run-notzed.vkregistry/vulkan.test.TestVulkan +$ make run-notzed.vkregistry.test/vulkan.test.TestMandelbrot A non-recursive make setup is used although make file fragments are included from various locations across the modules. All java is diff --git a/java.make b/java.make index ff3491c..d904985 100644 --- a/java.make +++ b/java.make @@ -120,7 +120,6 @@ # make clean rm -rf bin # make dist create dist tar in bin/ # make | make jar make all jars and jmods -# make bin make everything but jars and mods # Outputs # ------- @@ -198,11 +197,10 @@ $(foreach module,$(java_MODULES) $(native_MODULES),$(eval $(call common_variable # ###################################################################### all: jar -bin: gen: native: -.PHONY: all clean jar bin gen $(java_MODULES) +.PHONY: all clean jar gen $(java_MODULES) clean: rm -rf bin @@ -211,12 +209,12 @@ include $(foreach module,$(java_MODULES) $(native_MODULES),$(wildcard src/$(modu # staging only, not for modules, not sure here? define bin_files_targets= -bin $1: $(patsubst src/$1/bin/%,bin/$(TARGET)/bin/%,$($1_SCRIPTS)) +bin/status/$1.classes: $(patsubst src/$1/bin/%,bin/$(TARGET)/bin/%,$($1_SCRIPTS)) bin/$(TARGET)/bin/%: src/$1/bin/% install -vD -m 0755 $$< $$@ endef define lib_files_targets= -bin $1: $(patsubst src/$1/lib/%,bin/$(TARGET)/lib/%,$($1_DATA)) +bin/status/$1.classes: $(patsubst src/$1/lib/%,bin/$(TARGET)/lib/%,$($1_DATA)) bin/$(TARGET)/lib/%: src/$1/lib/% install -vD -m 0644 $$< $$@ endef @@ -233,15 +231,24 @@ $(error) # Java # ###################################################################### +# Targets used to manage dependencies: + +# bin/status/.classes Source compilation target. Depends on dependent jars, sources, generated sources. +# $(java_jardir)/.jar Binary compilation target. Depends on compiled classes and resources. +# $(java_jardir)/.jmod Binary compilation target. Depends on compiled classes, resources, and native libraries. + define java_targets= # Rules for module $(1) $(1)_JAVA_generated = $$(addprefix $$($1_genjavadir)/,$$($1_JAVA_GENERATED)) -bin/status/$1.classes: $(patsubst %,bin/status/%.classes,$(filter $($1_JDEPMOD), $(java_MODULES))) $$($1_JAVA) $$($1_JAVA_generated) +#$(java_jardir)/$1.jar: $(patsubst %,$(java_jardir)/%.jar,$(filter $($1_JDEPMOD), $(java_MODULES))) +$(java_jardir)/$1.jar: $(patsubst %,$(java_jardir)/%.jar,$($1_JDEPMOD)) + +#bin/status/$1.classes: $(patsubst %,bin/status/%.classes,$(filter $($1_JDEPMOD), $(java_MODULES))) $$($1_JAVA) $$($1_JAVA_generated) +bin/status/$1.classes: $(patsubst %,$(java_jardir)/%.jar,$(filter $($1_JDEPMOD), $(java_MODULES))) $$($1_JAVA) $$($1_JAVA_generated) jar $1: $(java_jardir)/$1.jar $(java_jmoddir)/$1.jmod $1: $(filter $($1_JDEPMOD), $(native_MODULES)) -bin: bin/status/$(1).classes $$($1_resources_files) sources: $(java_jardir)/$(1)-sources.zip gen: $$($(1)_JAVA_generated) @@ -297,7 +304,7 @@ $(foreach module,$(java_MODULES),$(eval $(call java_targets,$(module)))) # setup run-* targets define run_targets= -run-$1/$2: $1 +run-$1/$2: $(java_jardir)/$1.jar LD_LIBRARY_PATH=$(FFMPEG_HOME)/lib \ $(JAVA) \ $(if $(JAVAMODPATH) $($1_JAVAMODPATH),--module-path $(subst $(S),:,$(JAVAMODPATH) $($1_JAVAMODPATH))) \ @@ -319,6 +326,7 @@ $(foreach module,$(java_MODULES),$(foreach main,$($(module)_JMAIN),$(eval $(call # __APIFLAGS Extra flags to pass to export-api for each api define export_targets= +bin/status/$2.export: $(NATIVEZ_HOME)/lib/notzed.nativez.jar # hack for in-tree notzed.nativez? bin/status/$1.classes: bin/status/$2.export bin/status/$2.export: mkdir -p bin/gen/$1/gen bin/status @@ -398,7 +406,7 @@ $($(1)_objdir)/%.d: src/$(1)/native/%.cc @$($(TARGET)_CXX) -MM -MT "$$(@:.d=.o) $$@" -Isrc/$(1)/jni -Ibin/include/$(1) \ $($(TARGET)_CPPFLAGS) $($(2)_CPPFLAGS) $$< -o $$@ 2>/dev/null -bin native $(1) $(java_jmoddir)/$(1).jmod: \ +$(java_jardir)/$(1).jar: \ $($(1)_libdir)/$(LIB)$(2)$(SO) \ $(java_libdir)/$(LIB)$(2)$(SO) \ $(addprefix $($(1)_incdir)/,$($(2)_HEADERS)) \ @@ -413,6 +421,14 @@ endef #$(foreach module,$(java_MODULES) $(native_MODULES),$(foreach library,$($(module)_NATIVE_LIBRARIES),$(info $(call native_library,$(module),$(library))))) $(foreach module,$(java_MODULES) $(native_MODULES),$(foreach library,$($(module)_NATIVE_LIBRARIES),$(eval $(call native_library,$(module),$(library))))) +# small hack: native-only modules have a phony jar target +define native_targets= +.PHONY: $(java_jardir)/$(1).jar +$1 jar: $(java_jardir)/$(1).jar +endef +#$(foreach module,$(native_MODULES),$(info $(call native_targets,$(module)))) +$(foreach module,$(native_MODULES),$(eval $(call native_targets,$(module)))) + # ###################################################################### dist: