2 all_target=bin/AltosDroid-debug.apk
4 all_target+=bin/AltosDroid-release.apk
11 SDK_TARGET=$(shell sed -ne 's/^target=//p' project.properties)
13 DX=$(SDK)/platform-tools/dx
14 ADB=$(SDK)/platform-tools/adb
15 AAPT=$(SDK)/platform-tools/aapt
16 APKBUILDER=$(SDK)/tools/apkbuilder
17 ZIPALIGN=$(SDK)/tools/zipalign
19 JAVA_SRC_DIR=src/org/altusmetrum/AltosDroid
21 DRAWABLE_DIR=res/drawable
22 ALTOSLIB_SRCDIR=../altoslib
23 ALTOSLIB_JAR=altoslib_$(ALTOSLIB_VERSION).jar
25 ALTOSLIB=$(EXT_LIBDIR)/$(ALTOSLIB_JAR)
27 SUPPORT_V4_SRCDIR=$(SDK)/extras/android/support/v4
28 SUPPORT_V4_JAR=android-support-v4.jar
30 SUPPORT_V4=$(EXT_LIBDIR)/$(SUPPORT_V4_JAR)
32 GOOGLE_PLAY_SERVICES_LIB_SRCDIR=$(SDK)/extras/google/google_play_services/libproject
33 GOOGLE_PLAY_SERVICES_LIB=google-play-services_lib
35 JAVA_SRC=$(JAVA_SRC_DIR)/*.java $(JAVA_SRC_DIR)/BuildInfo.java
38 $(DRAWABLE_DIR)/redled.png \
39 $(DRAWABLE_DIR)/greenled.png \
40 $(DRAWABLE_DIR)/grayled.png
42 SRC=$(JAVA_SRC) $(DRAWABLES)
49 mkdir -p $(EXT_LIBDIR)
51 $(ALTOSLIB): $(EXT_LIBDIR) $(ALTOSLIB_SRCDIR)/$(ALTOSLIB_JAR)
52 cd $(EXT_LIBDIR) && ln -sf $(shell echo $(EXT_LIBDIR) | sed 's|[^/]\+|..|g')/$(ALTOSLIB_SRCDIR)/$(ALTOSLIB_JAR) .
54 $(SUPPORT_V4): $(EXT_LIBDIR) $(SUPPORT_V4_SRCDIR)/$(SUPPORT_V4_JAR)
55 cd $(EXT_LIBDIR) && ln -sf $(SUPPORT_V4_SRCDIR)/$(SUPPORT_V4_JAR) .
57 $(GOOGLE_PLAY_SERVICES_LIB): $(GOOGLE_PLAY_SERVICES_LIB_SRCDIR)/$(GOOGLE_PLAY_SERVICES_LIB)
58 cp -a $(GOOGLE_PLAY_SERVICES_LIB_SRCDIR)/$(GOOGLE_PLAY_SERVICES_LIB) .
59 cd $(GOOGLE_PLAY_SERVICES_LIB) && $(SDK)/tools/android update project --target $(SDK_TARGET) --path .
61 $(JAVA_SRC_DIR)/BuildInfo.java: $(filter-out $(JAVA_SRC_DIR)/BuildInfo.java,$(shell echo $(JAVA_SRC)))
64 $(DRAWABLE_DIR)/%.png: ../icon/%.png
65 cd $(DRAWABLE_DIR) && ln -sf $(shell echo $(DRAWABLE_DIR) | sed 's|[^/]\+|..|g')/$< .
68 install-release: bin/AltosDroid-release.apk
69 $(ADB) install -r bin/AltosDroid-release.apk
71 install-debug: bin/AltosDroid-debug.apk
72 $(ADB) install -r bin/AltosDroid-debug.apk
74 bin/AltosDroid-debug.apk: $(SRC) $(ALTOSLIB) $(SUPPORT_V4) $(GOOGLE_PLAY_SERVICES_LIB)
77 bin/AltosDroid-release-unsigned.apk: $(SRC) $(ALTOSLIB) $(SUPPORT_V4) $(GOOGLE_PLAY_SERVICES_LIB)
80 bin/AltosDroid-release.apk: bin/AltosDroid-release-unsigned.apk
81 jarsigner -sigalg SHA1withDSA -digestalg SHA1 \
82 -keystore ~/altusmetrumllc/google-play-release.keystore \
83 -storepass:file ~/altusmetrumllc/google-play-passphrase \
84 -signedjar bin/AltosDroid-release-signed.apk \
85 bin/AltosDroid-release-unsigned.apk AltosDroid
87 bin/AltosDroid-release-signed.apk \
88 bin/AltosDroid-release.apk
90 release: bin/AltosDroid-release.apk
92 clean-local: $(GOOGLE_PLAY_SERVICES_LIB)
94 rm -f $(JAVA_SRC_DIR)/BuildInfo.java
97 rm -rf $(GOOGLE_PLAY_SERVICES_LIB)