X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosdroid%2FMakefile.am;h=f9f69662b9e25541ff0a9b65a1c1307170f3141b;hp=daa649631ce8b8e9757e7b1f2c3e163aaf1d3642;hb=HEAD;hpb=795fba09a3ca273cd2daeeb7d9fed6bae6fa6a86 diff --git a/altosdroid/Makefile.am b/altosdroid/Makefile.am index daa64963..f9f69662 100644 --- a/altosdroid/Makefile.am +++ b/altosdroid/Makefile.am @@ -1,5 +1,13 @@ +DBG_APK=app/build/outputs/apk/debug/app-debug.apk +REL_APK=app/build/outputs/apk/release/app-release.apk + if ANDROID -all_target=bin/AltosDroid-debug.apk bin/AltosDroid-release-unsigned.apk +all_target=$(DBG_APK) +all_target += bin/AltosDroid-debug.apk +if ANDROID_RELEASE +all_target+=$(REL_APK) +all_target += bin/AltosDroid-release.apk +endif else all_target= endif @@ -11,72 +19,88 @@ DX=$(SDK)/platform-tools/dx ADB=$(SDK)/platform-tools/adb AAPT=$(SDK)/platform-tools/aapt APKBUILDER=$(SDK)/tools/apkbuilder -ZIPALIGN=$(SDK)/tools/zipalign - -SRC_DIR=src/org/altusmetrum/AltosDroid -EXT_LIBDIR=libs +ZIPALIGN_A=$(SDK)/tools/zipalign +ZIPALIGN_B=$(shell ls $(SDK)/build-tools/*/zipalign | tail -1) + +JAVA_SRC_DIR=app/src/main/java/org/altusmetrum/AltosDroid +EXT_LIBDIR=app/libs +RES_DIR=app/src/main/res +DRAWABLE_DIR=$(RES_DIR)/drawable +LAYOUT_DIR=$(RES_DIR)/layout +MENU_DIR=$(RES_DIR)/menu +VALUES_DIR=$(RES_DIR)/values +XML_DIR=$(RES_DIR)/xml ALTOSLIB_SRCDIR=../altoslib ALTOSLIB_JAR=altoslib_$(ALTOSLIB_VERSION).jar ALTOSLIB=$(EXT_LIBDIR)/$(ALTOSLIB_JAR) -SUPPORT_V4_SRCDIR=$(SDK)/extras/android/support/v4 -SUPPORT_V4_JAR=android-support-v4.jar +JAVA_SRC=$(JAVA_SRC_DIR)/*.java $(JAVA_SRC_DIR)/BuildInfo.java + +DRAWABLES=\ + $(DRAWABLE_DIR)/redled.png \ + $(DRAWABLE_DIR)/greenled.png \ + $(DRAWABLE_DIR)/grayled.png + +GRADLEW=JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 bash ./gradlew --no-daemon -SUPPORT_V4=$(EXT_LIBDIR)/$(SUPPORT_V4_JAR) +LAYOUTS=$(LAYOUT_DIR)/*.xml +MENUS=$(MENU_DIR)/*.xml +VALUES=$(VALUES_DIR)/*.xml +XMLS=$(XML_DIR)/*.xml app/src/main/AndroidManifest.xml -GOOGLE_PLAY_SERVICES_LIB_SRCDIR=$(SDK)/extras/google/google_play_services/libproject -GOOGLE_PLAY_SERVICES_LIB=google-play-services_lib +RES=$(LAYOUTS) $(MENUS) $(VALUES) $(XMLS) -SRC=$(SRC_DIR)/*.java +SRC=$(JAVA_SRC) $(DRAWABLES) $(RES) all: $(all_target) -$(EXT_LIBDIR): - mkdir -p $(EXT_LIBDIR) +bin/AltosDroid-debug.apk: $(DBG_APK) + mkdir -p bin + cp $^ $@ -$(ALTOSLIB): $(EXT_LIBDIR) $(ALTOSLIB_SRCDIR)/$(ALTOSLIB_JAR) - cd $(EXT_LIBDIR) && ln -sf $(shell echo $(EXT_LIBDIR) | sed 's|[^/]\+|..|g')/$(ALTOSLIB_SRCDIR)/$(ALTOSLIB_JAR) . +bin/AltosDroid-release.apk: $(REL_APK) + mkdir -p bin + cp $^ $@ -$(SUPPORT_V4): $(EXT_LIBDIR) $(SUPPORT_V4_SRCDIR)/$(SUPPORT_V4_JAR) - cd $(EXT_LIBDIR) && ln -sf $(SUPPORT_V4_SRCDIR)/$(SUPPORT_V4_JAR) . +.NOTPARALLEL: -$(GOOGLE_PLAY_SERVICES_LIB): $(GOOGLE_PLAY_SERVICES_LIB_SRCDIR)/$(GOOGLE_PLAY_SERVICES_LIB) - cp -a $(GOOGLE_PLAY_SERVICES_LIB_SRCDIR)/$(GOOGLE_PLAY_SERVICES_LIB) . - cd $(GOOGLE_PLAY_SERVICES_LIB) && $(SDK)/tools/android update project --target $(SDK_TARGET) --path . +$(ALTOSLIB): $(ALTOSLIB_SRCDIR)/$(ALTOSLIB_JAR) + mkdir -p $(EXT_LIBDIR) + cd $(EXT_LIBDIR) && ln -sf $(shell echo $(EXT_LIBDIR) | sed 's|[^/]\+|..|g')/$(ALTOSLIB_SRCDIR)/$(ALTOSLIB_JAR) . -$(SRC_DIR)/BuildInfo.java: $(SRC) +$(JAVA_SRC_DIR)/BuildInfo.java: $(filter-out $(JAVA_SRC_DIR)/BuildInfo.java,$(shell echo $(JAVA_SRC))) ./buildinfo.sh +$(DRAWABLE_DIR)/%.png: ../icon/%.png + cd $(DRAWABLE_DIR) && ln -sf $(shell echo $(DRAWABLE_DIR) | sed 's|[^/]\+|..|g')/$< . + if ANDROID -install-release: bin/AltosDroid-release.apk - $(ADB) install -r bin/AltosDroid-release.apk +install-release: $(REL_APK) + $(ADB) install -r $(REL_APK) -install-debug: bin/AltosDroid-debug.apk - $(ADB) install -r bin/AltosDroid-debug.apk +install-debug: $(DBG_APK) + $(ADB) install -r $(DBG_APK) -bin/AltosDroid-debug.apk: $(SRC) $(ALTOSLIB) $(SUPPORT_V4) $(GOOGLE_PLAY_SERVICES_LIB) - ant debug +$(DBG_APK): $(SRC) $(ALTOSLIB) + $(GRADLEW) assembleDebug -bin/AltosDroid-release-unsigned.apk: $(SRC) $(ALTOSLIB) $(SUPPORT_V4) $(GOOGLE_PLAY_SERVICES_LIB) - ant release +$(REL_APK): $(SRC) $(ALTOSLIB) + $(GRADLEW) build -sign: - jarsigner -keystore release.keystore \ - -signedjar bin/AltosDroid-release-signed.apk \ - bin/AltosDroid-release-unsigned.apk AltosDroid - $(SDK)/tools/zipalign -f 4 \ - bin/AltosDroid-release-signed.apk \ - bin/AltosDroid-release.apk +release: $(REL_APK) -clean: $(GOOGLE_PLAY_SERVICES_LIB) - ant clean +clean-local: $(GOOGLE_PLAY_SERVICES_LIB) + $(GRADLEW) clean + rm -f $(JAVA_SRC_DIR)/BuildInfo.java + rm -f $(DRAWABLES) rm -rf $(EXT_LIBDIR) rm -rf $(GOOGLE_PLAY_SERVICES_LIB) else -clean: +clean-local: endif +clean: clean-local