# 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
# -------
# ######################################################################
all: jar
-bin:
gen:
native:
-.PHONY: all clean jar bin gen $(java_MODULES)
+.PHONY: all clean jar gen $(java_MODULES)
clean:
rm -rf bin
# 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
# Java
# ######################################################################
+# Targets used to manage dependencies:
+
+# bin/status/<module>.classes Source compilation target. Depends on dependent jars, sources, generated sources.
+# $(java_jardir)/<module>.jar Binary compilation target. Depends on compiled classes and resources.
+# $(java_jardir)/<module>.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)
# 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))) \
# <module>_<api>_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
@$($(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)) \
#$(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: