doc: update copyright year assertions
[fw/altos] / altosdroid / Makefile.am
1 DBG_APK=app/build/outputs/apk/debug/app-debug.apk
2 REL_APK=app/build/outputs/apk/release/app-release.apk
3
4 if ANDROID
5 all_target=$(DBG_APK)
6 all_target += bin/AltosDroid-debug.apk
7 if ANDROID_RELEASE
8 all_target+=$(REL_APK)
9 all_target += bin/AltosDroid-release.apk
10 endif
11 else
12 all_target=
13 endif
14
15 SDK=$(ANDROID_SDK)
16 SDK_TARGET=$(shell sed -ne 's/^target=//p' project.properties)
17
18 DX=$(SDK)/platform-tools/dx
19 ADB=$(SDK)/platform-tools/adb
20 AAPT=$(SDK)/platform-tools/aapt
21 APKBUILDER=$(SDK)/tools/apkbuilder
22 ZIPALIGN_A=$(SDK)/tools/zipalign
23 ZIPALIGN_B=$(shell ls $(SDK)/build-tools/*/zipalign | tail -1)
24
25 JAVA_SRC_DIR=app/src/main/java/org/altusmetrum/AltosDroid
26 EXT_LIBDIR=app/libs
27 RES_DIR=app/src/main/res
28 DRAWABLE_DIR=$(RES_DIR)/drawable
29 LAYOUT_DIR=$(RES_DIR)/layout
30 MENU_DIR=$(RES_DIR)/menu
31 VALUES_DIR=$(RES_DIR)/values
32 XML_DIR=$(RES_DIR)/xml
33 ALTOSLIB_SRCDIR=../altoslib
34 ALTOSLIB_JAR=altoslib_$(ALTOSLIB_VERSION).jar
35
36 ALTOSLIB=$(EXT_LIBDIR)/$(ALTOSLIB_JAR)
37
38 JAVA_SRC=$(JAVA_SRC_DIR)/*.java $(JAVA_SRC_DIR)/BuildInfo.java
39
40 DRAWABLES=\
41     $(DRAWABLE_DIR)/redled.png \
42     $(DRAWABLE_DIR)/greenled.png \
43     $(DRAWABLE_DIR)/grayled.png
44
45 GRADLEW=JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 bash ./gradlew --no-daemon
46
47 LAYOUTS=$(LAYOUT_DIR)/*.xml
48 MENUS=$(MENU_DIR)/*.xml
49 VALUES=$(VALUES_DIR)/*.xml
50 XMLS=$(XML_DIR)/*.xml app/src/main/AndroidManifest.xml
51
52 RES=$(LAYOUTS) $(MENUS) $(VALUES) $(XMLS)
53
54 SRC=$(JAVA_SRC) $(DRAWABLES) $(RES)
55
56 all: $(all_target)
57
58 bin/AltosDroid-debug.apk: $(DBG_APK)
59         mkdir -p bin
60         cp $^ $@
61
62 bin/AltosDroid-release.apk: $(REL_APK)
63         mkdir -p bin
64         cp $^ $@
65
66 .NOTPARALLEL:
67
68 $(ALTOSLIB): $(ALTOSLIB_SRCDIR)/$(ALTOSLIB_JAR)
69         mkdir -p $(EXT_LIBDIR)
70         cd $(EXT_LIBDIR) && ln -sf $(shell echo $(EXT_LIBDIR) | sed 's|[^/]\+|..|g')/$(ALTOSLIB_SRCDIR)/$(ALTOSLIB_JAR) .
71
72 $(JAVA_SRC_DIR)/BuildInfo.java: $(filter-out $(JAVA_SRC_DIR)/BuildInfo.java,$(shell echo $(JAVA_SRC)))
73         ./buildinfo.sh
74
75 $(DRAWABLE_DIR)/%.png: ../icon/%.png
76         cd $(DRAWABLE_DIR) && ln -sf $(shell echo $(DRAWABLE_DIR) | sed 's|[^/]\+|..|g')/$< .
77
78 if ANDROID
79 install-release: $(REL_APK)
80         $(ADB) install -r $(REL_APK)
81
82 install-debug: $(DBG_APK)
83         $(ADB) install -r $(DBG_APK)
84
85 $(DBG_APK): $(SRC) $(ALTOSLIB)
86         $(GRADLEW) assembleDebug
87
88 $(REL_APK): $(SRC) $(ALTOSLIB)
89         $(GRADLEW) build
90
91 release: $(REL_APK)
92
93 clean-local: $(GOOGLE_PLAY_SERVICES_LIB)
94         $(GRADLEW) clean
95         rm -f $(JAVA_SRC_DIR)/BuildInfo.java
96         rm -f $(DRAWABLES)
97         rm -rf $(EXT_LIBDIR)
98         rm -rf $(GOOGLE_PLAY_SERVICES_LIB)
99
100 else
101
102 clean-local:
103
104 endif
105
106 clean: clean-local