From: Andy Spencer Date: Sat, 27 Apr 2013 01:47:45 +0000 (+0000) Subject: Update makefile for release build X-Git-Url: http://pileus.org/git/?p=~andy%2Fspades;a=commitdiff_plain;h=19dc339ddf4ee1bd8ee4200d2d99ab8717aa7757 Update makefile for release build - Add debug and release targets - Add key signing for release target - Prevent deleting intermediate files - Fix non xml resources - Miscellaneous formatting OpenSSL can be used to create a Java compatible KeyStore from a PEM encoded certificate and key: openssl pkcs12 -export \ -name android \ -in android.crt \ -inkey android.key \ -out android.p12 --- diff --git a/makefile b/makefile index 80dbcda..4491afd 100644 --- a/makefile +++ b/makefile @@ -1,12 +1,15 @@ -include config.mk # Settings -ANDROID ?= /opt/android-sdk-update-manager/platforms/android-10/android.jar +PROGRAM ?= Spades PACKAGE ?= org.pileus.spades -OUTPUT ?= bin/Spades.apk +KEYFILE ?= ~/.android/android.p12 +KEYTYPE ?= pkcs12 +KEYNAME ?= android +ANDROID ?= /opt/android-sdk-update-manager/platforms/android-10/android.jar # Sources -RES := $(shell find res -name '*.xml') +RES := $(shell find res -type f) SRC := $(shell find src -name '*.java') # Objects @@ -16,7 +19,9 @@ OBJ := $(subst .java,.class, \ $(GEN:gen/%=obj/%)) # Targets -all: $(OUTPUT) +debug: bin/$(PROGRAM).dbg + +release: bin/$(PROGRAM).apk compile: $(OBJ) @@ -25,12 +30,14 @@ clean: # ADB targets logcat: - adb logcat Spades:D AndroidRuntime:E '*:S' + adb logcat $(PROGRAM):D AndroidRuntime:E '*:S' run: bin/install.stamp - adb shell am start -W -a android.intent.action.MAIN -n $(PACKAGE)/.Main + adb shell am start -W \ + -a android.intent.action.MAIN \ + -n $(PACKAGE)/.Main -install bin/install.stamp: $(OUTPUT) +install bin/install.stamp: bin/$(PROGRAM).dbg adb install -r $+ touch bin/install.stamp @@ -64,10 +71,20 @@ convert: done # Rules -%.apk: %.dex %.res | bin +%.dbg: %.dex %.res | bin @echo "APK $@.in" @apkbuilder $@.in -f $*.dex -z $*.res - @echo ALIGN $@ + @echo "ALIGN $@" + @zipalign -f 4 $@.in $@ + +%.apk: %.dex %.res | bin + @echo "APKU $@.in" + @apkbuilder $@.in -u -f $*.dex -z $*.res + @echo "SIGN $@.in" + @jarsigner -storetype $(KEYTYPE) \ + -keystore $(KEYFILE) \ + $@.in $(KEYNAME) + @echo "ALIGN $@" @zipalign -f 4 $@.in $@ %.dex: $(OBJ) | bin @@ -83,7 +100,7 @@ convert: -F $*.res $(OBJ): $(SRC) $(GEN) | obj - @echo "JAVAC $@" + @echo "JAVAC *.class" @javac -g -Xlint:unchecked \ -bootclasspath $(ANDROID) \ -encoding UTF-8 \ @@ -111,4 +128,5 @@ bin gen obj: @mkdir -p $@ # Use parallel javac instead +.PRECIOUS: %.dex %.res .NOTPARALLEL: