Automate fetching sqlite.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4830 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2024-02-08 00:17:30 +00:00
parent eb5da26004
commit d021d9f757

View File

@ -647,34 +647,34 @@ $(1): $(BUILD_DIR)/$(1)/$(PROJECT)$(if $(filter win%,$(1)),.exe)
.PHONY: $(1) .PHONY: $(1)
$(BUILD_DIR)/$(1)/$(PROJECT)$(if $(filter win%,$(1)),.exe): $(filter $(BUILD_DIR)/$(1)/%,$(ALL_APP_OBJS)) $(BUILD_DIR)/$(1)/$(PROJECT)$(if $(filter win%,$(1)),.exe): $(filter $(BUILD_DIR)/$(1)/%,$(ALL_APP_OBJS))
@echo [link] $$@ @echo "[link] $$@"
@$$(CC) -o $$@ $$^ $$(LDFLAGS) @$$(CC) -o $$@ $$^ $$(LDFLAGS)
$(BUILD_DIR)/$(1)/%.o: %.c $(BUILD_DIR)/$(1)/%.o: %.c
@mkdir -p $$(dir $$@) @mkdir -p $$(dir $$@)
@echo [c] $$@ @echo "[c] $$@"
@$$(CC) $$(CFLAGS) -c $$< -o $$@ @$$(CC) $$(CFLAGS) -c $$< -o $$@
$(BUILD_DIR)/$(1)/%.o: %.m $(BUILD_DIR)/$(1)/%.o: %.m
@mkdir -p $$(dir $$@) @mkdir -p $$(dir $$@)
@echo [m] $$@ @echo "[m] $$@"
@$$(CC) $$(CFLAGS) -c $$< -o $$@ @$$(CC) $$(CFLAGS) -c $$< -o $$@
$(BUILD_DIR)/$(1)/%.o: %.S $(BUILD_DIR)/$(1)/%.o: %.S
@mkdir -p $$(dir $$@) @mkdir -p $$(dir $$@)
@echo [as] $$@ @echo "[as] $$@"
@$$(AS) -c $$< -o $$@ @$$(AS) -c $$< -o $$@
endef endef
$(foreach build_type,$(BUILD_TYPES),$(eval $(call build_rules,$(build_type)))) $(foreach build_type,$(BUILD_TYPES),$(eval $(call build_rules,$(build_type))))
src/version.h : $(firstword $(MAKEFILE_LIST)) src/version.h : $(firstword $(MAKEFILE_LIST))
@echo [version] $@ @echo "[version] $@"
@echo "#define VERSION_NUMBER \"$(VERSION_NUMBER)\"" > $@ @echo "#define VERSION_NUMBER \"$(VERSION_NUMBER)\"" > $@
@echo "#define VERSION_NAME \"$(VERSION_NAME)\"" >> $@ @echo "#define VERSION_NAME \"$(VERSION_NAME)\"" >> $@
src/android/AndroidManifest.xml : $(firstword $(MAKEFILE_LIST)) src/android/AndroidManifest.xml : $(firstword $(MAKEFILE_LIST))
@echo [android_version] $@ @echo "[android_version] $@"
@sed -i \ @sed -i \
-e 's/versionCode=".*"/versionCode="$(VERSION_CODE)"/' \ -e 's/versionCode=".*"/versionCode="$(VERSION_CODE)"/' \
-e 's/versionName=".*"/versionName="$(VERSION_NUMBER)"/' \ -e 's/versionName=".*"/versionName="$(VERSION_NUMBER)"/' \
@ -685,12 +685,12 @@ src/android/AndroidManifest.xml : $(firstword $(MAKEFILE_LIST))
# Android support. # Android support.
out/res/layout_activity_main.xml.flat: src/android/res/layout/activity_main.xml out/res/layout_activity_main.xml.flat: src/android/res/layout/activity_main.xml
@mkdir -p $(dir $@) @mkdir -p $(dir $@)
@echo [aapt2] $@ @echo "[aapt2] $@"
@$(ANDROID_BUILD_TOOLS)/aapt2 compile -o out/res/ src/android/res/layout/activity_main.xml @$(ANDROID_BUILD_TOOLS)/aapt2 compile -o out/res/ src/android/res/layout/activity_main.xml
out/res/drawable_icon.xml.flat: src/android/res/drawable/icon.xml out/res/drawable_icon.xml.flat: src/android/res/drawable/icon.xml
@mkdir -p $(dir $@) @mkdir -p $(dir $@)
@echo [aapt2] $@ @echo "[aapt2] $@"
@$(ANDROID_BUILD_TOOLS)/aapt2 compile -o out/res/ src/android/res/drawable/icon.xml @$(ANDROID_BUILD_TOOLS)/aapt2 compile -o out/res/ src/android/res/drawable/icon.xml
out/apk/res.apk out/gen/com/unprompted/tildefriends/R.java: out/res/layout_activity_main.xml.flat out/res/drawable_icon.xml.flat src/android/AndroidManifest.xml out/apk/res.apk out/gen/com/unprompted/tildefriends/R.java: out/res/layout_activity_main.xml.flat out/res/drawable_icon.xml.flat src/android/AndroidManifest.xml
@ -701,12 +701,12 @@ JAVA_FILES := out/gen/com/unprompted/tildefriends/R.java $(wildcard src/android/
CLASS_FILES := $(foreach src,$(JAVA_FILES),out/classes/com/unprompted/tildefriends/$(notdir $(src:.java=.class))) CLASS_FILES := $(foreach src,$(JAVA_FILES),out/classes/com/unprompted/tildefriends/$(notdir $(src:.java=.class)))
$(CLASS_FILES) &: $(JAVA_FILES) $(CLASS_FILES) &: $(JAVA_FILES)
@echo [javac] $(CLASS_FILES) @echo "[javac] $(CLASS_FILES)"
@javac --release 8 -Xlint:deprecation -classpath $(ANDROID_PLATFORM)/android.jar -d out/classes $(JAVA_FILES) @javac --release 8 -Xlint:deprecation -classpath $(ANDROID_PLATFORM)/android.jar -d out/classes $(JAVA_FILES)
out/apk/classes.dex: $(CLASS_FILES) out/apk/classes.dex: $(CLASS_FILES)
@mkdir -p $(dir $@) @mkdir -p $(dir $@)
@echo [d8] $@ @echo "[d8] $@"
@$(ANDROID_BUILD_TOOLS)/d8 --$(BUILD_TYPE) --lib $(ANDROID_PLATFORM)/android.jar --output $(dir $@) out/classes/com/unprompted/tildefriends/*.class @$(ANDROID_BUILD_TOOLS)/d8 --$(BUILD_TYPE) --lib $(ANDROID_PLATFORM)/android.jar --output $(dir $@) out/classes/com/unprompted/tildefriends/*.class
PACKAGE_DIRS := \ PACKAGE_DIRS := \
@ -729,7 +729,7 @@ out/apk/TildeFriends-x86-release.unsigned.apk: out/apk/classes.dex out/androidre
out/apk/TildeFriends-arm-%.unsigned.apk: out/apk/TildeFriends-arm-%.unsigned.apk:
@mkdir -p $(dir $@) out/apk-arm-$(BUILD_TYPE)/lib/arm64-v8a/ out/apk-arm-$(BUILD_TYPE)/lib/armeabi-v7a/ @mkdir -p $(dir $@) out/apk-arm-$(BUILD_TYPE)/lib/arm64-v8a/ out/apk-arm-$(BUILD_TYPE)/lib/armeabi-v7a/
@echo [aapt] $@ @echo "[aapt] $@"
@cp out/android$(BUILD_TYPE)/tildefriends out/apk-arm-$(BUILD_TYPE)/lib/arm64-v8a/tildefriends.so @cp out/android$(BUILD_TYPE)/tildefriends out/apk-arm-$(BUILD_TYPE)/lib/arm64-v8a/tildefriends.so
@cp out/android$(BUILD_TYPE)-armv7a/tildefriends out/apk-arm-$(BUILD_TYPE)/lib/armeabi-v7a/tildefriends.so @cp out/android$(BUILD_TYPE)-armv7a/tildefriends out/apk-arm-$(BUILD_TYPE)/lib/armeabi-v7a/tildefriends.so
@$(ANDROID_NDK)/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip out/apk-arm-$(BUILD_TYPE)/lib/arm64-v8a/tildefriends.so @$(ANDROID_NDK)/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip out/apk-arm-$(BUILD_TYPE)/lib/arm64-v8a/tildefriends.so
@ -741,7 +741,7 @@ out/apk/TildeFriends-arm-%.unsigned.apk:
out/apk/TildeFriends-x86-%.unsigned.apk: out/apk/TildeFriends-x86-%.unsigned.apk:
@mkdir -p $(dir $@) out/apk-x86-$(BUILD_TYPE)/lib/x86_64/ out/apk-x86-$(BUILD_TYPE)/lib/x86/ @mkdir -p $(dir $@) out/apk-x86-$(BUILD_TYPE)/lib/x86_64/ out/apk-x86-$(BUILD_TYPE)/lib/x86/
@echo [aapt] $@ @echo "[aapt] $@"
@cp out/android$(BUILD_TYPE)-x86_64/tildefriends out/apk-x86-$(BUILD_TYPE)/lib/x86_64/tildefriends.so @cp out/android$(BUILD_TYPE)-x86_64/tildefriends out/apk-x86-$(BUILD_TYPE)/lib/x86_64/tildefriends.so
@cp out/android$(BUILD_TYPE)-x86/tildefriends out/apk-x86-$(BUILD_TYPE)/lib/x86/tildefriends.so @cp out/android$(BUILD_TYPE)-x86/tildefriends out/apk-x86-$(BUILD_TYPE)/lib/x86/tildefriends.so
@$(ANDROID_NDK)/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip out/apk-x86-$(BUILD_TYPE)/lib/x86_64/tildefriends.so @$(ANDROID_NDK)/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip out/apk-x86-$(BUILD_TYPE)/lib/x86_64/tildefriends.so
@ -752,7 +752,7 @@ out/apk/TildeFriends-x86-%.unsigned.apk:
@zip -u $@ -q -9 $(RAW_FILES) @zip -u $@ -q -9 $(RAW_FILES)
out/%.apk: out/apk/%.unsigned.apk out/%.apk: out/apk/%.unsigned.apk
@echo [apksigner] $(notdir $@) @echo "[apksigner] $(notdir $@)"
@$(ANDROID_BUILD_TOOLS)/apksigner sign --ks .keys/android.jks --ks-key-alias androidKey --ks-pass pass:android --key-pass pass:android --out $@ $< @$(ANDROID_BUILD_TOOLS)/apksigner sign --ks .keys/android.jks --ks-key-alias androidKey --ks-pass pass:android --key-pass pass:android --out $@ $<
release-apk: out/TildeFriends-arm-release.apk out/TildeFriends-x86-release.apk release-apk: out/TildeFriends-arm-release.apk out/TildeFriends-x86-release.apk
@ -782,7 +782,7 @@ ifeq ($(HAVE_LINUX_IOS),1)
endif endif
.SECONDARY: .SECONDARY:
out/tildefriends-%.ipa: out/tildefriends-ios%.app/tildefriends out/tildefriends-%.ipa: out/tildefriends-ios%.app/tildefriends
@echo [ipa] $@ @echo "[ipa] $@"
@rm -rf $@.tmp $@ @rm -rf $@.tmp $@
@mkdir -p $@.tmp/Payload/tildefriends.app/ @mkdir -p $@.tmp/Payload/tildefriends.app/
@cp -R $(dir $<)/* $@.tmp/Payload/tildefriends.app/ @cp -R $(dir $<)/* $@.tmp/Payload/tildefriends.app/
@ -811,10 +811,16 @@ apklog:
.PHONY: apklog .PHONY: apklog
fetchdeps: fetchdeps:
rm -rfv deps/libuv/ @echo "[fetch] libuv"
mkdir -p out/deps/ deps/libuv/ @rm -rf deps/libuv/
test -f out/deps/libuv.tar.gz || curl -q https://dist.libuv.org/dist/v1.48.0/libuv-v1.48.0.tar.gz -o out/deps/libuv.tar.gz @mkdir -p out/deps/ deps/libuv/
tar -C deps/libuv/ --strip=1 -xvf out/deps/libuv.tar.gz @test -f out/deps/libuv.tar.gz || curl -q https://dist.libuv.org/dist/v1.48.0/libuv-v1.48.0.tar.gz -o out/deps/libuv.tar.gz
@tar -C deps/libuv/ -m --strip=1 -xf out/deps/libuv.tar.gz
@echo "[fetch] sqlite"
@rm -rf deps/sqlite/
@mkdir -p out/deps/ deps/sqlite/
@test -f out/deps/sqlite.zip || curl -q https://www.sqlite.org/2024/sqlite-amalgamation-3450100.zip -o out/deps/sqlite.zip
@unzip -qDj -d deps/sqlite/ out/deps/sqlite.zip
.PHONE: fetchdeps .PHONE: fetchdeps
clean: clean: