diff --git a/Makefile b/Makefile index fff1841dc3..5bf5df041c 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ DOCKER_RUN_OPTS=--rm MVN:=mvn CODESIGN:=docker run $(DOCKER_RUN_OPTS) -v $$PWD:/workdir gotson/rcodesign sign SRC:=src/main/java +JAVA_CLASSPATH:=$(TARGET)/classpath/slf4j-api.jar SQLITE_OUT:=$(TARGET)/$(sqlite)-$(OS_NAME)-$(OS_ARCH) SQLITE_OBJ?=$(SQLITE_OUT)/sqlite3.o SQLITE_ARCHIVE:=$(TARGET)/$(sqlite)-amal.zip @@ -42,6 +43,9 @@ $(SQLITE_UNPACKED): $(SQLITE_ARCHIVE) (mv $(TARGET)/tmp.$(version)/$(SQLITE_AMAL_PREFIX) $(TARGET) && rmdir $(TARGET)/tmp.$(version)) || mv $(TARGET)/tmp.$(version)/ $(TARGET)/$(SQLITE_AMAL_PREFIX) touch $@ +$(JAVA_CLASSPATH): + @mkdir -p $(@D) + curl -L -f -o$@ https://search.maven.org/remotecontent?filepath=org/slf4j/slf4j-api/2.0.9/slf4j-api-2.0.9.jar $(TARGET)/common-lib/org/sqlite/%.class: src/main/java/org/sqlite/%.java @mkdir -p $(@D) @@ -49,9 +53,9 @@ $(TARGET)/common-lib/org/sqlite/%.class: src/main/java/org/sqlite/%.java jni-header: $(TARGET)/common-lib/NativeDB.h -$(TARGET)/common-lib/NativeDB.h: src/main/java/org/sqlite/core/NativeDB.java +$(TARGET)/common-lib/NativeDB.h: src/main/java/org/sqlite/core/NativeDB.java $(JAVA_CLASSPATH) @mkdir -p $(TARGET)/common-lib - $(JAVAC) -d $(TARGET)/common-lib -sourcepath $(SRC) -h $(TARGET)/common-lib src/main/java/org/sqlite/core/NativeDB.java + $(JAVAC) -cp $(JAVA_CLASSPATH) -d $(TARGET)/common-lib -sourcepath $(SRC) -h $(TARGET)/common-lib src/main/java/org/sqlite/core/NativeDB.java mv target/common-lib/org_sqlite_core_NativeDB.h target/common-lib/NativeDB.h test: diff --git a/Makefile.common b/Makefile.common index 127eb0c89e..e78ce60c19 100644 --- a/Makefile.common +++ b/Makefile.common @@ -9,20 +9,24 @@ JAVAC := "$$JAVA_HOME/bin/javac" JAVAH := "$$JAVA_HOME/bin/javah" TARGET := target +SRC:=src/main/java OSINFO_CLASS := org.sqlite.util.OSInfo OSINFO_PROG := lib/org/sqlite/util/OSInfo.class +JAVA_CLASSPATH:=$(TARGET)/classpath/slf4j-api.jar ## building OSInfo.java ifeq ("$(wildcard $(OSINFO_PROG))","") $(info Building OSInfo tool) -$(shell $(JAVAC) -cp src/main/java -d lib src/main/java/org/sqlite/util/OSInfo.java) +$(shell mkdir -p $(TARGET)/classpath) +$(shell curl -L -f -o$(JAVA_CLASSPATH) https://search.maven.org/remotecontent?filepath=org/slf4j/slf4j-api/2.0.9/slf4j-api-2.0.9.jar) +$(shell $(JAVAC) -cp $(JAVA_CLASSPATH) -sourcepath $(SRC) -d lib src/main/java/org/sqlite/util/OSInfo.java) endif ifndef OS_NAME -OS_NAME := $(shell $(JAVA) -cp lib $(OSINFO_CLASS) --os) +OS_NAME := $(shell $(JAVA) -cp lib:$(JAVA_CLASSPATH) $(OSINFO_CLASS) --os) endif ifndef OS_ARCH -OS_ARCH := $(shell $(JAVA) -cp lib $(OSINFO_CLASS) --arch) +OS_ARCH := $(shell $(JAVA) -cp lib:$(JAVA_CLASSPATH) $(OSINFO_CLASS) --arch) endif # Windows uses different path separators @@ -55,7 +59,7 @@ ifeq (,$(findstring $(strip $(target)),$(known_targets))) target := Default endif -$(info Will build using target: $(target) (detected os: $(OS_NAME) arch: $(OS_ARCH))) +$(info Will build using target: $(target) (detected os: $(OS_NAME), arch: $(OS_ARCH))) # cross-compilation toolchain prefix (e.g. "arm-linux-gnueabi-") CROSS_PREFIX :=