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