2022-01-13 21:38:35 +00:00
|
|
|
NAME = Fireplace
|
2022-01-15 15:23:41 +00:00
|
|
|
CLASS= org.er2.fireplace
|
2022-01-13 21:38:35 +00:00
|
|
|
|
2022-01-15 15:23:41 +00:00
|
|
|
KEY_PATH = debug.keystore
|
|
|
|
KEY_NAME = androiddebugkey
|
|
|
|
KEY_PASS = android
|
2022-01-13 21:38:35 +00:00
|
|
|
|
2022-01-15 15:23:41 +00:00
|
|
|
SDK_VER = 24
|
|
|
|
SDK = 24.0.3
|
2022-01-13 21:38:35 +00:00
|
|
|
|
2022-01-15 15:23:41 +00:00
|
|
|
SDK_ROOT = ~/Android/Sdk
|
|
|
|
JAVA_HOME = /usr/lib/jvm/java-1.11.0-openjdk-amd64
|
|
|
|
|
|
|
|
# Android framework, DO NOT REMOVE!
|
2022-01-13 21:38:35 +00:00
|
|
|
VEDBASE = $(SDK_ROOT)/platforms/android-$(SDK_VER)/android.jar
|
|
|
|
|
2022-01-15 15:23:41 +00:00
|
|
|
# Tools
|
|
|
|
ADB = $(SDK_ROOT)/platform-tools/adb
|
|
|
|
AAPT = $(SDK_ROOT)/build-tools/$(SDK)/aapt
|
|
|
|
DX = $(SDK_ROOT)/build-tools/$(SDK)/dx
|
|
|
|
ZIPALIGN = $(SDK_ROOT)/build-tools/$(SDK)/zipalign
|
2022-01-13 21:38:35 +00:00
|
|
|
JAVAC = $(JAVA_HOME)/bin/javac
|
|
|
|
JARSIGNER = $(JAVA_HOME)/bin/jarsigner
|
|
|
|
|
2022-01-15 15:23:41 +00:00
|
|
|
SRC = $(shell find src/ -name '*.java')
|
|
|
|
CLSS= $(SRC:src/%.java=gen/%.class)
|
2022-01-13 21:38:35 +00:00
|
|
|
|
2022-01-15 15:23:41 +00:00
|
|
|
all: build
|
|
|
|
build: out.apk
|
2022-01-13 21:38:35 +00:00
|
|
|
|
2022-01-15 15:23:41 +00:00
|
|
|
out.apk: AndroidManifest.xml gen/classes.dex $(KEY_PATH)
|
|
|
|
@$(AAPT) p -I $(VEDBASE) -fM AndroidManifest.xml -S res/ -F $@.tmp
|
|
|
|
@cp gen/classes.dex . && $(AAPT) a $@.tmp classes.dex && rm -f classes.dex
|
|
|
|
@$(JARSIGNER) -keystore $(KEY_PATH) -storepass '$(KEY_PASS)' $@.tmp $(KEY_NAME)
|
|
|
|
@$(ZIPALIGN) -f 4 $@.tmp $@
|
2022-01-13 21:38:35 +00:00
|
|
|
|
2022-02-10 16:39:53 +00:00
|
|
|
-@if [ ! -r "$@" ]; then mv -f $@.tmp $@; fi
|
2022-01-13 21:38:35 +00:00
|
|
|
|
2022-01-15 15:23:41 +00:00
|
|
|
gen/classes.dex: prepare $(CLSS)
|
|
|
|
-@echo removing R classes to economy some space
|
|
|
|
@find gen/ -name 'R.class' -exec rm {} \;
|
|
|
|
@find gen/ -name 'R$$*.class' -exec rm {} \;
|
|
|
|
@$(DX) --dex --output=$@ gen/
|
2022-01-13 21:38:35 +00:00
|
|
|
|
2022-01-15 15:23:41 +00:00
|
|
|
### Helpers
|
2022-01-13 21:38:35 +00:00
|
|
|
|
2022-01-15 15:23:41 +00:00
|
|
|
prepare: res/*
|
|
|
|
-@echo Generating R.java
|
|
|
|
@mkdir -p gen
|
|
|
|
@$(AAPT) p -I $(VEDBASE) -fm -M AndroidManifest.xml -J gen -S res
|
2022-01-13 21:38:35 +00:00
|
|
|
|
2022-01-15 15:23:41 +00:00
|
|
|
gen/%.class: src/%.java
|
2022-01-13 21:38:35 +00:00
|
|
|
-@echo Recompiling $@
|
2022-01-15 15:23:41 +00:00
|
|
|
@$(JAVAC) -classpath $(VEDBASE) -sourcepath 'src/:gen/' -d 'gen/' $< -source 1.7 -target 1.7 > /dev/null 2>&1
|
2022-01-13 21:38:35 +00:00
|
|
|
|
|
|
|
$(KEY_PATH):
|
|
|
|
@yes | keytool -genkey -v -keystore $(KEY_PATH) -storepass '$(KEY_PASS)' -alias $(KEY_NAME) -keypass $(KEY_PASS) -keyalg RSA -keysize 2048 -validity 10000
|
|
|
|
|
2022-01-15 15:23:41 +00:00
|
|
|
### Tools
|
|
|
|
|
2022-01-13 21:38:35 +00:00
|
|
|
clean:
|
2022-01-15 15:23:41 +00:00
|
|
|
rm -rf gen/ classes.dex out.apk out.apk.tmp
|
2022-01-13 21:38:35 +00:00
|
|
|
|
2022-01-15 15:23:41 +00:00
|
|
|
deploy: out.apk
|
|
|
|
-@$(ADB) uninstall $(CLASS)
|
|
|
|
@$(ADB) install $<
|
|
|
|
@$(ADB) shell monkey -p $(CLASS) -c android.intent.category.LAUNCHER 1
|
2022-01-13 21:38:35 +00:00
|
|
|
|