So close. We can do it without the .so.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4214 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2023-03-11 03:47:01 +00:00
parent f74f4f6da9
commit 2a3b1a1e33
2 changed files with 49 additions and 18 deletions

View File

@ -26,12 +26,11 @@ ANDROID_PLATFORM := $(ANDROID_SDK)/platforms/android-23
ANDROID_NDK ?= /usr/lib/android-sdk/ndk-bundle
ANDROID_NDK_API_VERSION := 30
ANDROID_NDK_TARGET_TRIPLE := aarch64-linux-android
ANDROID_MIN_SDK_VERSION := 26
ANDROID_TARGETS := \
out/androiddebug/tildefriends \
out/androiddebug/libtildefriends.so \
out/androidrelease/tildefriends \
out/androidrelease/libtildefriends.so
out/androidrelease/tildefriends
debug windebug $(ANDROID_TARGETS): CFLAGS += -Og
debug release androidrelease: LDFLAGS += -rdynamic
@ -370,15 +369,9 @@ DEPS = $(ALL_APP_OBJS:.o=.d)
-include $(DEPS)
define build_rules
$(1): $(BUILD_DIR)/$(1)/$(if $(filter android%,$(1)),lib)$(PROJECT)$(if $(filter win%,$(1)),.exe)$(if $(filter android%,$(1)),.so)
$(1): $(BUILD_DIR)/$(1)/$(PROJECT)$(if $(filter win%,$(1)),.exe)
.PHONY: $(1)
ifeq ($(filter android%,$(1)),$(1))
$(BUILD_DIR)/$(1)/lib$(PROJECT).so: $(filter $(BUILD_DIR)/$(1)/%,$(ALL_APP_OBJS))
@echo [link] $$@
@$$(CC) -o $$@ $$^ $$(LDFLAGS) -shared
endif
$(BUILD_DIR)/$(1)/$(PROJECT)$(if $(filter win%,$(1)),.exe): $(filter $(BUILD_DIR)/$(1)/%,$(ALL_APP_OBJS))
@echo [link] $$@
@$$(CC) -o $$@ $$^ $$(LDFLAGS)
@ -407,12 +400,12 @@ CLASS_FILES := $(foreach src,$(JAVA_FILES),out/classes/com/unprompted/tildefrien
$(CLASS_FILES) &: $(JAVA_FILES)
@echo [javac] $(CLASS_FILES)
@javac --release 9 -classpath $(ANDROID_PLATFORM)/android.jar -d out/classes $(JAVA_FILES)
@javac --release 8 -classpath $(ANDROID_PLATFORM)/android.jar -d out/classes $(JAVA_FILES)
out/apk/classes.dex: $(CLASS_FILES)
@mkdir -p $(dir $@)
@echo [dx] $@
@$(ANDROID_BUILD_TOOLS)/dx --dex --output=$@ out/classes/
@$(ANDROID_BUILD_TOOLS)/dx --dex --min-sdk-version=$(ANDROID_MIN_SDK_VERSION) --output=$@ out/classes/
PACKAGE_DIRS := \
apps/ \
@ -424,11 +417,10 @@ PACKAGE_DIRS := \
RAW_FILES := $(shell find $(PACKAGE_DIRS) -type f)
out/TildeFriends.unsigned.apk: out/apk/classes.dex out/androiddebug/tildefriends out/androiddebug/libtildefriends.so $(RAW_FILES)
out/TildeFriends.unsigned.apk: out/apk/classes.dex out/androiddebug/tildefriends $(RAW_FILES)
@mkdir -p $(dir $@) out/apk/lib/arm64-v8a/
@echo [aapt] $@
@cp out/androiddebug/tildefriends out/apk/lib/arm64-v8a/
@cp out/androiddebug/libtildefriends.so out/apk/lib/arm64-v8a/
@$(ANDROID_BUILD_TOOLS)/aapt package -f -M src/android/AndroidManifest.xml -S src/android/res/ -I $(ANDROID_PLATFORM)/android.jar -F $@ out/apk/
@zip -u $@ -q -r $(PACKAGE_DIRS)