29f9c06217
Change-Id: I1a1694bf4ad463ed18c99c5471c53ca26578dfdb
79 lines
2.6 KiB
Text
79 lines
2.6 KiB
Text
#
|
|
# Common Makefile pieces for building Java / Android apps.
|
|
#
|
|
|
|
#
|
|
# BOOTSTRAPDIR needs to be set to this directory before starting this
|
|
#
|
|
|
|
# Probably would be best to just stop fooling around with the possibilities to
|
|
# set various stuff with the -env command line parameters (and environment
|
|
# variables?) and in a plethora of rc files, and hardcode construction of
|
|
# *all* required pathnames based on the app installation location for Android
|
|
# (and iOS), etc. We don't really win anything by having so many layers of
|
|
# configurability on platforms like Android and iOS where apps based on LO
|
|
# code are very much self-contained pre-packaged thingies.
|
|
APP_DATA_PATH=/data/data/$(APP_PACKAGE)
|
|
|
|
SODEST=libs/$(ANDROID_APP_ABI)
|
|
OBJLOCAL=obj/local/$(ANDROID_APP_ABI)
|
|
|
|
define COPYSO
|
|
$(error COPYSO should not be used now with DISABLE_DYNLOADING)
|
|
endef
|
|
|
|
define COPYJAR
|
|
cp $(1) libs
|
|
endef
|
|
|
|
#
|
|
# Helpful rules ...
|
|
#
|
|
|
|
#
|
|
# The Android SDK recommends you copy/paste some big -package-resources
|
|
# rule in order to not pack certain kinds of resources. Unfortunately this
|
|
# rule interacts with the rest of the ant code in horrible ways such that
|
|
# upgrading your SDK auto-breaks everything.
|
|
#
|
|
# Horrors below:
|
|
#
|
|
$(BOOTSTRAPDIR)/no-resource-compress.xml :
|
|
( \
|
|
android_sdk_ver=`grep 'Pkg.Revision' $(ANDROID_SDK_HOME)/tools/source.properties | sed 's/^.*=//' | sed 's/\..*//'` ; \
|
|
cp $(BOOTSTRAPDIR)/no-resource-compress-$$android_sdk_ver.xml $(BOOTSTRAPDIR)/no-resource-compress.xml ; \
|
|
if ! test -f $(BOOTSTRAPDIR)/no-resource-compress.xml; then \
|
|
echo "Unknown Android SDK version: $$android_sdk_ver"; \
|
|
exit 1; \
|
|
fi \
|
|
)
|
|
|
|
android_version_setup : $(BOOTSTRAPDIR)/no-resource-compress.xml
|
|
|
|
properties:
|
|
echo sdk.dir=$(ANDROID_SDK_HOME) >local.properties
|
|
echo sdk.dir=$(ANDROID_SDK_HOME) >../../Bootstrap/local.properties
|
|
echo "# File needed by ndk-gdb" >jni/Application.mk
|
|
echo "APP_ABI := $(ANDROID_APP_ABI)" > jni/Application.mk
|
|
echo "APP_PLATFORM := android-14" >> jni/Application.mk
|
|
|
|
install: build-ant
|
|
unset JAVA_HOME && $(ANT) debug install
|
|
@echo
|
|
@echo 'Run it with "make run"'
|
|
@echo
|
|
|
|
uninstall:
|
|
$(ANDROID_SDK_HOME)/platform-tools/adb uninstall $(APP_PACKAGE)
|
|
|
|
clean: android_version_setup properties
|
|
$(ANT) clean
|
|
rm -rf assets libs $(SODEST) $(OBJLOCAL)
|
|
|
|
# If you reinstall an app several times *on the emulator*, even if you
|
|
# uninstall it between, disk space seems to leak that won't get recycled until
|
|
# you stop and start... No idea if this holds for a device, too. (And you
|
|
# can't "stop" a device anyway.)
|
|
|
|
stop-start-cycle:
|
|
$(ANDROID_SDK_HOME)/platform-tools/adb shell stop && $(ANDROID_SDK_HOME)/platform-tools/adb shell start && sleep 10
|