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_A=$(SDK)/tools/zipalign
18 ZIPALIGN_B=$(SDK)/build-tools/*/zipalign
20 JAVA_SRC_DIR=src/org/altusmetrum/AltosDroid
22 DRAWABLE_DIR=res/drawable
23 ALTOSLIB_SRCDIR=../altoslib
24 ALTOSLIB_JAR=altoslib_$(ALTOSLIB_VERSION).jar
26 ALTOSLIB=$(EXT_LIBDIR)/$(ALTOSLIB_JAR)
28 SUPPORT_V4_SRCDIR=$(SDK)/extras/android/support/v4
29 SUPPORT_V4_JAR=android-support-v4.jar
31 SUPPORT_V4=$(EXT_LIBDIR)/$(SUPPORT_V4_JAR)
33 GOOGLE_PLAY_SERVICES_LIB_SRCDIR=$(SDK)/extras/google/google_play_services/libproject
34 GOOGLE_PLAY_SERVICES_LIB=google-play-services_lib
36 JAVA_SRC=$(JAVA_SRC_DIR)/*.java $(JAVA_SRC_DIR)/BuildInfo.java
39 $(DRAWABLE_DIR)/redled.png \
40 $(DRAWABLE_DIR)/greenled.png \
41 $(DRAWABLE_DIR)/grayled.png
43 SRC=$(JAVA_SRC) $(DRAWABLES)
50 mkdir -p $(EXT_LIBDIR)
52 $(ALTOSLIB): $(EXT_LIBDIR) $(ALTOSLIB_SRCDIR)/$(ALTOSLIB_JAR)
53 cd $(EXT_LIBDIR) && ln -sf $(shell echo $(EXT_LIBDIR) | sed 's|[^/]\+|..|g')/$(ALTOSLIB_SRCDIR)/$(ALTOSLIB_JAR) .
55 $(SUPPORT_V4): $(EXT_LIBDIR) $(SUPPORT_V4_SRCDIR)/$(SUPPORT_V4_JAR)
56 cd $(EXT_LIBDIR) && ln -sf $(SUPPORT_V4_SRCDIR)/$(SUPPORT_V4_JAR) .
58 $(GOOGLE_PLAY_SERVICES_LIB): $(GOOGLE_PLAY_SERVICES_LIB_SRCDIR)/$(GOOGLE_PLAY_SERVICES_LIB)
59 cp -a $(GOOGLE_PLAY_SERVICES_LIB_SRCDIR)/$(GOOGLE_PLAY_SERVICES_LIB) .
60 cd $(GOOGLE_PLAY_SERVICES_LIB) && $(SDK)/tools/android update project --target $(SDK_TARGET) --path .
62 $(JAVA_SRC_DIR)/BuildInfo.java: $(filter-out $(JAVA_SRC_DIR)/BuildInfo.java,$(shell echo $(JAVA_SRC)))
65 $(DRAWABLE_DIR)/%.png: ../icon/%.png
66 cd $(DRAWABLE_DIR) && ln -sf $(shell echo $(DRAWABLE_DIR) | sed 's|[^/]\+|..|g')/$< .
69 install-release: bin/AltosDroid-release.apk
70 $(ADB) install -r bin/AltosDroid-release.apk
72 install-debug: bin/AltosDroid-debug.apk
73 $(ADB) install -r bin/AltosDroid-debug.apk
75 bin/AltosDroid-debug.apk: $(SRC) $(ALTOSLIB) $(SUPPORT_V4) $(GOOGLE_PLAY_SERVICES_LIB)
78 bin/AltosDroid-release-unsigned.apk: $(SRC) $(ALTOSLIB) $(SUPPORT_V4) $(GOOGLE_PLAY_SERVICES_LIB)
81 bin/AltosDroid-release.apk: bin/AltosDroid-release-unsigned.apk
82 jarsigner -sigalg SHA1withDSA -digestalg SHA1 \
83 -keystore ~/altusmetrumllc/google-play-release.keystore \
84 -storepass:file ~/altusmetrumllc/google-play-passphrase \
85 -signedjar bin/AltosDroid-release-signed.apk \
86 bin/AltosDroid-release-unsigned.apk AltosDroid
87 if [ -f $(ZIPALIGN_A) ]; then \
89 bin/AltosDroid-release-signed.apk \
90 bin/AltosDroid-release.apk; \
93 bin/AltosDroid-release-signed.apk \
94 bin/AltosDroid-release.apk; \
97 release: bin/AltosDroid-release.apk
99 clean-local: $(GOOGLE_PLAY_SERVICES_LIB)
101 rm -f $(JAVA_SRC_DIR)/BuildInfo.java
104 rm -rf $(GOOGLE_PLAY_SERVICES_LIB)