From b0d2383410fe0b981c4943ec073eb44ec7b64f51 Mon Sep 17 00:00:00 2001 From: Andy Spencer Date: Mon, 22 Apr 2013 03:48:12 +0000 Subject: [PATCH] Update makefile rules Add config.mk support Add debug messages for building with drawables. Disable parallel build - Java starts so slow that it's faster to do all the compiles with a single javac command. This prevents make from trying to do the same thing over and over. --- .gitignore | 3 +++ makefile | 28 ++++++++++++++++++++-------- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index b8ef052..0947ddf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# Settings +config.mk + # Vim junk *~ *.swp diff --git a/makefile b/makefile index dc8eff0..80dbcda 100644 --- a/makefile +++ b/makefile @@ -1,7 +1,9 @@ +-include config.mk + # Settings -ANDROID := /opt/android-sdk-update-manager/platforms/android-10/android.jar -PACKAGE := org.pileus.spades -OUTPUT := bin/Spades.apk +ANDROID ?= /opt/android-sdk-update-manager/platforms/android-10/android.jar +PACKAGE ?= org.pileus.spades +OUTPUT ?= bin/Spades.apk # Sources RES := $(shell find res -name '*.xml') @@ -14,15 +16,14 @@ OBJ := $(subst .java,.class, \ $(GEN:gen/%=obj/%)) # Targets -default: run +all: $(OUTPUT) compile: $(OBJ) -debug: $(OUTPUT) - clean: rm -rf bin gen obj +# ADB targets logcat: adb logcat Spades:D AndroidRuntime:E '*:S' @@ -37,17 +38,20 @@ uninstall: adb uninstall $(PACKAGE) rm bin/install.stamp +# Graphics targets graphics: git checkout graphics -- \ 'opt/drawable/*.svg' \ 'opt/drawable/*.xcf' \ 'res/drawable/*.png' \ - 'res/drawable/*.jpg' + 'res/drawable/*.jpg' \ + || true git reset HEAD -- \ 'opt/drawable/*.svg' \ 'opt/drawable/*.xcf' \ 'res/drawable/*.png' \ - 'res/drawable/*.jpg' + 'res/drawable/*.jpg' \ + || true convert: for svg in opt/drawable/*.svg; do \ @@ -90,6 +94,11 @@ $(OBJ): $(SRC) $(GEN) | obj $+ $(GEN): AndroidManifest.xml $(RES) | gen + @if ! [ -d "res/drawable" ]; then \ + echo Please run \ + \'make graphics\'; \ + exit 1; \ + fi @echo "GEN $@" @aapt package -f -m \ -I $(ANDROID) \ @@ -100,3 +109,6 @@ $(GEN): AndroidManifest.xml $(RES) | gen # Directories bin gen obj: @mkdir -p $@ + +# Use parallel javac instead +.NOTPARALLEL: -- 2.43.2