]> Pileus Git - ~andy/spades/commitdiff
Update makefile rules
authorAndy Spencer <andy753421@gmail.com>
Mon, 22 Apr 2013 03:48:12 +0000 (03:48 +0000)
committerAndy Spencer <andy753421@gmail.com>
Mon, 22 Apr 2013 04:02:24 +0000 (04:02 +0000)
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
makefile

index b8ef0520816d120b992cc9eb1d6f0018aa596df6..0947ddf656c8adcfeb7b33f311fc5516f90f3c63 100644 (file)
@@ -1,3 +1,6 @@
+# Settings
+config.mk
+
 # Vim junk
 *~
 *.swp
index dc8eff0d8fa6d835f8240c9d0670c4fd836747b7..80dbcdac21897702062577ebc06bdd5a4d7a3977 100644 (file)
--- 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: