make remake ;)
This commit is contained in:
parent
9bada7a940
commit
f040fa9862
4 changed files with 65 additions and 72 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
bin/
|
|
||||||
gen/
|
gen/
|
||||||
*.keystore
|
*.keystore
|
||||||
|
out.apk
|
||||||
|
*.tmp
|
||||||
|
|
|
@ -10,10 +10,8 @@
|
||||||
android:targetSdkVersion="32"
|
android:targetSdkVersion="32"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- if want on TV:
|
|
||||||
android:banner="@drawable/banner"
|
|
||||||
-->
|
|
||||||
<application
|
<application
|
||||||
|
android:banner="@drawable/banner"
|
||||||
android:icon="@drawable/icon"
|
android:icon="@drawable/icon"
|
||||||
android:label="Fireplace"
|
android:label="Fireplace"
|
||||||
>
|
>
|
||||||
|
|
112
Makefile
112
Makefile
|
@ -1,92 +1,68 @@
|
||||||
NAME = Fireplace
|
NAME = Fireplace
|
||||||
PROJ = org.er2.fireplace
|
CLASS= org.er2.fireplace
|
||||||
|
|
||||||
ifeq ($TV,1)
|
KEY_PATH = debug.keystore
|
||||||
SDK_VER = 24
|
KEY_NAME = androiddebugkey
|
||||||
SDK = 24.0.3
|
KEY_PASS = android
|
||||||
else
|
|
||||||
SDK_VER = 19
|
|
||||||
SDK = 19.1.0
|
|
||||||
endif
|
|
||||||
|
|
||||||
SDK_ROOT = ~/Android/Sdk
|
SDK_VER = 24
|
||||||
JAVA_HOME:=$(if $(JAVA_HOME),$(JAVA_HOME),/usr/lib/jvm/java-1.11.0-openjdk-amd64)
|
SDK = 24.0.3
|
||||||
|
|
||||||
|
SDK_ROOT = ~/Android/Sdk
|
||||||
|
JAVA_HOME = /usr/lib/jvm/java-1.11.0-openjdk-amd64
|
||||||
|
|
||||||
|
# Android framework, DO NOT REMOVE!
|
||||||
VEDBASE = $(SDK_ROOT)/platforms/android-$(SDK_VER)/android.jar
|
VEDBASE = $(SDK_ROOT)/platforms/android-$(SDK_VER)/android.jar
|
||||||
|
|
||||||
ADB = $(SDK_ROOT)/platform-tools/adb
|
# Tools
|
||||||
AAPT = $(SDK_ROOT)/build-tools/$(SDK)/aapt
|
ADB = $(SDK_ROOT)/platform-tools/adb
|
||||||
DX = $(SDK_ROOT)/build-tools/$(SDK)/dx
|
AAPT = $(SDK_ROOT)/build-tools/$(SDK)/aapt
|
||||||
ZIPALIGN=$(SDK_ROOT)/build-tools/$(SDK)/zipalign
|
DX = $(SDK_ROOT)/build-tools/$(SDK)/dx
|
||||||
|
ZIPALIGN = $(SDK_ROOT)/build-tools/$(SDK)/zipalign
|
||||||
JAVAC = $(JAVA_HOME)/bin/javac
|
JAVAC = $(JAVA_HOME)/bin/javac
|
||||||
JARSIGNER = $(JAVA_HOME)/bin/jarsigner
|
JARSIGNER = $(JAVA_HOME)/bin/jarsigner
|
||||||
|
|
||||||
PWD=$(shell pwd)
|
SRC = $(shell find src/ -name '*.java')
|
||||||
|
CLSS= $(SRC:src/%.java=gen/%.class)
|
||||||
|
|
||||||
OUT=$(PWD)/bin
|
all: build
|
||||||
GEN=$(PWD)/gen
|
build: out.apk
|
||||||
RES=$(PWD)/res
|
|
||||||
SRC=$(PWD)/src
|
|
||||||
#ASS=$(PWD)/assets
|
|
||||||
|
|
||||||
SRCS=$(shell find $(SRC) -name '*.java')
|
out.apk: AndroidManifest.xml gen/classes.dex $(KEY_PATH)
|
||||||
CLSS=$(SRCS:$(SRC)/%.java=$(GEN)/%.class)
|
@$(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 $@
|
||||||
|
|
||||||
KEY_PATH ?= debug.keystore
|
-@mv -f $@.tmp $@
|
||||||
KEY_NAME ?= androiddebugkey
|
|
||||||
KEY_PASS ?= android
|
|
||||||
|
|
||||||
all: debug
|
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/
|
||||||
|
|
||||||
debug:
|
### Helpers
|
||||||
@$(MAKE) DEBUG=true -C $(PWD) build
|
|
||||||
|
|
||||||
release:
|
prepare: res/*
|
||||||
@$(MAKE) -C $(PWD) build
|
-@echo Generating R.java
|
||||||
|
@mkdir -p gen
|
||||||
|
@$(AAPT) p -I $(VEDBASE) -fm -M AndroidManifest.xml -J gen -S res
|
||||||
|
|
||||||
APK=$(OUT)/$(NAME).apk
|
gen/%.class: src/%.java
|
||||||
CDX=$(OUT)/classes.dex
|
|
||||||
|
|
||||||
build: $(APK)
|
|
||||||
$(APK): $(CDX) package sign zip
|
|
||||||
@if [ ! -f "$(APK)" ]; then mv $(OUT)/$(NAME).ap_ $(APK); fi
|
|
||||||
@$(RM) $(OUT)/$(NAME).ap_
|
|
||||||
|
|
||||||
prepare: clean
|
|
||||||
@mkdir -p $(OUT) $(GEN)
|
|
||||||
@$(AAPT) > /dev/null 2>&1; if ! [ $$? -ne 0 ]; then echo YOU NEED TO install lib32stdc++6 lib32z1; exit 1; fi
|
|
||||||
@$(AAPT) p $(if $(DEBUG),--debug-mode,) -I $(VEDBASE) -fm -M $(PWD)/AndroidManifest.xml -J $(GEN) -S $(RES)
|
|
||||||
|
|
||||||
$(CDX):
|
|
||||||
# dependencies is here to not re-build on every make
|
|
||||||
@make -C $(PWD) prepare $(CLSS)
|
|
||||||
@echo Removing R classes
|
|
||||||
@find $(GEN) -name 'R.class' -exec rm {} \;
|
|
||||||
@find $(GEN) -name 'R$$*.class' -exec rm {} \;
|
|
||||||
@$(DX) --dex --output=$@ $(GEN)
|
|
||||||
|
|
||||||
$(GEN)/%.class: $(SRC)/%.java
|
|
||||||
-@echo Recompiling $@
|
-@echo Recompiling $@
|
||||||
@$(JAVAC) $(if $(DEBUG),-g,) -classpath $(VEDBASE) -sourcepath 'src:$(GEN)' -d '$(GEN)' -target 1.7 -source 1.7 $<
|
@$(JAVAC) -classpath $(VEDBASE) -sourcepath 'src/:gen/' -d 'gen/' $< -source 1.7 -target 1.7 > /dev/null 2>&1
|
||||||
|
|
||||||
package: $(CDX) AndroidManifest.xml
|
|
||||||
@$(AAPT) p $(if $(DEBUG),--debug-mode,) -I $(VEDBASE) -f -M $(PWD)/AndroidManifest.xml -S $(RES) -F $(OUT)/$(NAME).ap_ # -A $(ASS)
|
|
||||||
@cd $(OUT) && $(AAPT) a $(NAME).ap_ classes.dex
|
|
||||||
|
|
||||||
sign: package $(KEY_PATH)
|
|
||||||
@$(JARSIGNER) -keystore $(KEY_PATH) -storepass '$(KEY_PASS)' $(OUT)/$(NAME).ap_ $(KEY_NAME)
|
|
||||||
|
|
||||||
zip: package
|
|
||||||
@$(ZIPALIGN) -f 4 $(OUT)/$(NAME).ap_ $(APK)
|
|
||||||
|
|
||||||
$(KEY_PATH):
|
$(KEY_PATH):
|
||||||
@yes | keytool -genkey -v -keystore $(KEY_PATH) -storepass '$(KEY_PASS)' -alias $(KEY_NAME) -keypass $(KEY_PASS) -keyalg RSA -keysize 2048 -validity 10000
|
@yes | keytool -genkey -v -keystore $(KEY_PATH) -storepass '$(KEY_PASS)' -alias $(KEY_NAME) -keypass $(KEY_PASS) -keyalg RSA -keysize 2048 -validity 10000
|
||||||
|
|
||||||
|
### Tools
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@rm -rf $(OUT) $(GEN)
|
rm -rf gen/ classes.dex out.apk out.apk.tmp
|
||||||
|
|
||||||
run: $(OUT)/$(NAME).apk
|
deploy: out.apk
|
||||||
-@$(ADB) uninstall $(PROJ)
|
-@$(ADB) uninstall $(CLASS)
|
||||||
@$(ADB) install $^
|
@$(ADB) install $<
|
||||||
@$(ADB) shell monkey -p $(PROJ) -c android.intent.category.LAUNCHER 1
|
@$(ADB) shell monkey -p $(CLASS) -c android.intent.category.LAUNCHER 1
|
||||||
|
|
||||||
|
|
18
readme.org
18
readme.org
|
@ -9,3 +9,21 @@ and even use as screensaver!
|
||||||
|
|
||||||
#+caption: Screensaver or /Daydream/ on TV
|
#+caption: Screensaver or /Daydream/ on TV
|
||||||
[[./scr.jpg]]
|
[[./scr.jpg]]
|
||||||
|
|
||||||
|
* Make this
|
||||||
|
|
||||||
|
To make an APK file, you need:
|
||||||
|
|
||||||
|
- Android SDK 24.0.3
|
||||||
|
|
||||||
|
- OpenJDK (or other Java) JDK (full, not just JRE)
|
||||||
|
|
||||||
|
- GNU Make (as on Linux, no installed on macOS or other *BSD)
|
||||||
|
|
||||||
|
You maybe need to change some values in Makefile,
|
||||||
|
but on Debian no changes needed.
|
||||||
|
|
||||||
|
To build, just run ~make~.
|
||||||
|
|
||||||
|
If you need to install, connect your Android device
|
||||||
|
and run ~make deploy~.
|
||||||
|
|
Loading…
Reference in a new issue