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=$(shell ls $(SDK)/build-tools/*/zipalign | tail -1)
20 JAVA_SRC_DIR=src/org/altusmetrum/AltosDroid
22 DRAWABLE_DIR=res/drawable
27 ALTOSLIB_SRCDIR=../altoslib
28 ALTOSLIB_JAR=altoslib_$(ALTOSLIB_VERSION).jar
30 ALTOSLIB=$(EXT_LIBDIR)/$(ALTOSLIB_JAR)
32 SUPPORT_V4_SRCDIR=$(SDK)/extras/android/support/v4
33 SUPPORT_V4_JAR=android-support-v4.jar
35 SUPPORT_V4=$(EXT_LIBDIR)/$(SUPPORT_V4_JAR)
37 GOOGLE_PLAY_SERVICES_LIB_SRCDIR=$(SDK)/extras/google/google_play_services/libproject
38 GOOGLE_PLAY_SERVICES_LIB=google-play-services_lib
40 JAVA_SRC=$(JAVA_SRC_DIR)/*.java $(JAVA_SRC_DIR)/BuildInfo.java
43 $(DRAWABLE_DIR)/redled.png \
44 $(DRAWABLE_DIR)/greenled.png \
45 $(DRAWABLE_DIR)/grayled.png
47 LAYOUTS=$(LAYOUT_DIR)/*.xml
48 MENUS=$(MENU_DIR)/*.xml
49 VALUES=$(VALUES_DIR)/*.xml
50 XMLS=$(XML_DIR)/*.xml AndroidManifest.xml
52 RES=$(LAYOUTS) $(MENUS) $(VALUES) $(XMLS)
54 SRC=$(JAVA_SRC) $(DRAWABLES) $(RES)
60 $(ALTOSLIB): $(ALTOSLIB_SRCDIR)/$(ALTOSLIB_JAR)
61 mkdir -p $(EXT_LIBDIR)
62 cd $(EXT_LIBDIR) && ln -sf $(shell echo $(EXT_LIBDIR) | sed 's|[^/]\+|..|g')/$(ALTOSLIB_SRCDIR)/$(ALTOSLIB_JAR) .
64 $(SUPPORT_V4): $(SUPPORT_V4_SRCDIR)/$(SUPPORT_V4_JAR)
65 mkdir -p $(EXT_LIBDIR)
66 cd $(EXT_LIBDIR) && ln -sf $(SUPPORT_V4_SRCDIR)/$(SUPPORT_V4_JAR) .
68 $(GOOGLE_PLAY_SERVICES_LIB): $(GOOGLE_PLAY_SERVICES_LIB_SRCDIR)/$(GOOGLE_PLAY_SERVICES_LIB)
69 cp -a $(GOOGLE_PLAY_SERVICES_LIB_SRCDIR)/$(GOOGLE_PLAY_SERVICES_LIB) .
70 cd $(GOOGLE_PLAY_SERVICES_LIB) && $(SDK)/tools/android update project --target $(SDK_TARGET) --path .
72 $(JAVA_SRC_DIR)/BuildInfo.java: $(filter-out $(JAVA_SRC_DIR)/BuildInfo.java,$(shell echo $(JAVA_SRC)))
75 $(DRAWABLE_DIR)/%.png: ../icon/%.png
76 cd $(DRAWABLE_DIR) && ln -sf $(shell echo $(DRAWABLE_DIR) | sed 's|[^/]\+|..|g')/$< .
79 install-release: bin/AltosDroid-release.apk
80 $(ADB) install -r bin/AltosDroid-release.apk
82 install-debug: bin/AltosDroid-debug.apk
83 $(ADB) install -r bin/AltosDroid-debug.apk
85 bin/AltosDroid-debug.apk: $(SRC) $(ALTOSLIB) $(SUPPORT_V4) $(GOOGLE_PLAY_SERVICES_LIB)
88 bin/AltosDroid-release-unsigned.apk: $(SRC) $(ALTOSLIB) $(SUPPORT_V4) $(GOOGLE_PLAY_SERVICES_LIB)
91 bin/AltosDroid-release.apk: bin/AltosDroid-release-unsigned.apk
92 jarsigner -sigalg SHA1withDSA -digestalg SHA1 \
93 -keystore ~/altusmetrumllc/google-play-release.keystore \
94 -storepass:file ~/altusmetrumllc/google-play-passphrase \
95 -signedjar bin/AltosDroid-release-signed.apk \
96 bin/AltosDroid-release-unsigned.apk AltosDroid
97 if [ -f $(ZIPALIGN_A) ]; then \
99 bin/AltosDroid-release-signed.apk \
100 bin/AltosDroid-release.apk; \
103 bin/AltosDroid-release-signed.apk \
104 bin/AltosDroid-release.apk; \
107 release: bin/AltosDroid-release.apk
109 clean-local: $(GOOGLE_PLAY_SERVICES_LIB)
111 rm -f $(JAVA_SRC_DIR)/BuildInfo.java
114 rm -rf $(GOOGLE_PLAY_SERVICES_LIB)