Ignore .dll files in libaltos
[fw/altos] / altosdroid / Makefile.am
1 if ANDROID
2 all_target=bin/AltosDroid-debug.apk bin/AltosDroid-release-unsigned.apk
3 else
4 all_target=
5 endif
6
7 SDK=$(ANDROID_SDK)
8 SDK_TARGET=$(shell sed -ne 's/^target=//p' project.properties)
9
10 DX=$(SDK)/platform-tools/dx
11 ADB=$(SDK)/platform-tools/adb
12 AAPT=$(SDK)/platform-tools/aapt
13 APKBUILDER=$(SDK)/tools/apkbuilder
14 ZIPALIGN=$(SDK)/tools/zipalign
15
16 JAVA_SRC_DIR=src/org/altusmetrum/AltosDroid
17 EXT_LIBDIR=libs
18 DRAWABLE_DIR=res/drawable
19 ALTOSLIB_SRCDIR=../altoslib
20 ALTOSLIB_JAR=altoslib_$(ALTOSLIB_VERSION).jar
21
22 ALTOSLIB=$(EXT_LIBDIR)/$(ALTOSLIB_JAR)
23
24 SUPPORT_V4_SRCDIR=$(SDK)/extras/android/support/v4
25 SUPPORT_V4_JAR=android-support-v4.jar
26
27 SUPPORT_V4=$(EXT_LIBDIR)/$(SUPPORT_V4_JAR)
28
29 GOOGLE_PLAY_SERVICES_LIB_SRCDIR=$(SDK)/extras/google/google_play_services/libproject
30 GOOGLE_PLAY_SERVICES_LIB=google-play-services_lib
31
32 JAVA_SRC=$(JAVA_SRC_DIR)/*.java
33
34 DRAWABLES=\
35     $(DRAWABLE_DIR)/redled.png \
36     $(DRAWABLE_DIR)/greenled.png \
37     $(DRAWABLE_DIR)/grayled.png
38
39 SRC=$(JAVA_SRC) $(DRAWABLES)
40
41 all: $(all_target)
42
43 $(EXT_LIBDIR):
44         mkdir -p $(EXT_LIBDIR)
45
46 $(ALTOSLIB): $(EXT_LIBDIR) $(ALTOSLIB_SRCDIR)/$(ALTOSLIB_JAR)
47         cd $(EXT_LIBDIR) && ln -sf $(shell echo $(EXT_LIBDIR) | sed 's|[^/]\+|..|g')/$(ALTOSLIB_SRCDIR)/$(ALTOSLIB_JAR) .
48
49 $(SUPPORT_V4): $(EXT_LIBDIR) $(SUPPORT_V4_SRCDIR)/$(SUPPORT_V4_JAR)
50         cd $(EXT_LIBDIR) && ln -sf $(SUPPORT_V4_SRCDIR)/$(SUPPORT_V4_JAR) .
51
52 $(GOOGLE_PLAY_SERVICES_LIB): $(GOOGLE_PLAY_SERVICES_LIB_SRCDIR)/$(GOOGLE_PLAY_SERVICES_LIB)
53         cp -a $(GOOGLE_PLAY_SERVICES_LIB_SRCDIR)/$(GOOGLE_PLAY_SERVICES_LIB) .
54         cd $(GOOGLE_PLAY_SERVICES_LIB) && $(SDK)/tools/android update project --target $(SDK_TARGET) --path .
55
56 $(JAVA_SRC_DIR)/BuildInfo.java: $(JAVA_SRC)
57         ./buildinfo.sh
58
59 $(DRAWABLE_DIR)/%.png: ../icon/%.png
60         cd $(DRAWABLE_DIR) && ln -sf $(shell echo $(DRAWABLE_DIR) | sed 's|[^/]\+|..|g')/$< .
61
62 if ANDROID
63 install-release: bin/AltosDroid-release.apk
64         $(ADB) install -r bin/AltosDroid-release.apk
65
66 install-debug: bin/AltosDroid-debug.apk
67         $(ADB) install -r bin/AltosDroid-debug.apk
68
69 bin/AltosDroid-debug.apk: $(SRC) $(ALTOSLIB) $(SUPPORT_V4) $(GOOGLE_PLAY_SERVICES_LIB)
70         ant debug
71
72 bin/AltosDroid-release-unsigned.apk: $(SRC) $(ALTOSLIB) $(SUPPORT_V4) $(GOOGLE_PLAY_SERVICES_LIB)
73         ant release
74
75 release: bin/AltosDroid-release-unsigned.apk
76         jarsigner -keystore release.keystore \
77            -signedjar bin/AltosDroid-release-signed.apk \
78            bin/AltosDroid-release-unsigned.apk AltosDroid
79         $(ZIPALIGN) -f 4 \
80            bin/AltosDroid-release-signed.apk \
81            bin/AltosDroid-release.apk
82
83 clean-local: $(GOOGLE_PLAY_SERVICES_LIB)
84         ant clean
85         rm -rf $(EXT_LIBDIR)
86         rm -f $(DRAWABLES)
87         rm -rf $(GOOGLE_PLAY_SERVICES_LIB)
88
89 else
90
91 clean-local:
92
93 endif
94
95 clean: clean-local