3dphotoshoot

annotate android/Makefile @ 24:2712c5da2e00

getting sensor input (hack)
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 16 Jun 2015 06:17:59 +0300
parents a94af102872f
children
rev   line source
nuclear@0 1 root = ..
nuclear@0 2 include $(root)/proj.mk
nuclear@0 3
nuclear@0 4 # --- android settings ---
nuclear@18 5 android_platform = android-19
nuclear@0 6 name = $(bin)
nuclear@0 7 pkgprefix = com.mutantstargoat
nuclear@0 8 # ------------------------
nuclear@0 9
nuclear@0 10 src += $(wildcard $(root)/src/android/*.c)
nuclear@2 11 jsrc = $(wildcard $(root)/src/android/*.java)
nuclear@0 12
nuclear@19 13 obj = $(src:.c=.o) $(ccsrc:.cc=.o)
nuclear@0 14 lib = libs/armeabi/lib$(name).so
nuclear@0 15 apk-release = bin/$(name).apk
nuclear@0 16 apk-debug = bin/$(name)-debug.apk
nuclear@0 17
nuclear@0 18 pkg = $(pkgprefix).$(name)
nuclear@0 19 act = $(pkg).MainActivity
nuclear@0 20
nuclear@0 21 CC = arm-linux-androideabi-gcc
nuclear@0 22 CXX = arm-linux-androideabi-g++
nuclear@0 23
nuclear@18 24 #android_usr = $(NDK)/platforms/$(android_platform)/arch-arm/usr
nuclear@0 25 android_inc = -I$(native_app_glue_dir)
nuclear@19 26 android_libs = -lstdc++ -llog -landroid -lEGL -lGLESv2
nuclear@0 27
nuclear@10 28 defs += -DANDROID -DAPP_NAME=\"$(name)\"
nuclear@10 29 CXXFLAGS = -Wall -g $(defs) -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 \
nuclear@0 30 $(android_inc) -I$(root)/src/android -I$(root)/src/gles $(incpaths)
nuclear@10 31 CFLAGS = -std=c99 $(CXXFLAGS)
nuclear@14 32 LDFLAGS = -Wl,--fix-cortex-a8 -Wl,-z,defs $(android_libs) $(libpaths) $(libs)
nuclear@0 33
nuclear@0 34 .PHONY: debug
nuclear@0 35 debug: $(apk-debug)
nuclear@0 36
nuclear@0 37 .PHONY: release
nuclear@0 38 release: $(apk-release)
nuclear@0 39
nuclear@13 40 $(apk-debug): $(lib) $(jsrc) AndroidManifest.xml assets/data assets/sdr
nuclear@0 41 ant debug
nuclear@0 42
nuclear@13 43 $(apk-release): $(lib) $(jsrc) AndroidManifest.xml assets/data assets/sdr
nuclear@0 44 ant release
nuclear@0 45
nuclear@13 46 assets/data:
nuclear@13 47 mkdir -p assets
nuclear@13 48 cd assets && rm -f data && ln -s ../../data .
nuclear@13 49
nuclear@13 50 assets/sdr:
nuclear@13 51 mkdir -p assets
nuclear@13 52 cd assets && rm -f sdr && ln -s ../../sdr .
nuclear@12 53
nuclear@0 54 .PHONY: lib
nuclear@0 55 lib: $(lib)
nuclear@0 56
nuclear@0 57 $(lib): $(obj)
nuclear@0 58 @mkdir -p libs/armeabi
nuclear@19 59 $(CXX) -o $@ -shared $(obj) $(LDFLAGS)
nuclear@0 60
nuclear@0 61 ant_files = *.xml *.properties proguard-project.txt
nuclear@0 62 ant_dirs = bin libs res obj src gen
nuclear@0 63
nuclear@0 64 .PHONY: clean
nuclear@0 65 clean:
nuclear@0 66 rm -f $(obj) $(lib) $(apk-release) $(apk-debug) $(ant_files)
nuclear@0 67 rm -rf $(ant_dirs)
nuclear@23 68 rm -f assets/data assets/sdr
nuclear@24 69 [ -d assets ] && rmdir assets || true
nuclear@0 70
nuclear@0 71 .PHONY: install
nuclear@0 72 install: install-debug
nuclear@0 73
nuclear@0 74 .PHONY: install-debug
nuclear@0 75 install-debug:
nuclear@0 76 adb install -r $(apk-debug)
nuclear@0 77
nuclear@0 78 .PHONY: install-release
nuclear@0 79 install-release:
nuclear@0 80 adb install -r $(apk-release)
nuclear@0 81
nuclear@0 82 .PHONY: uninstall
nuclear@0 83 uninstall:
nuclear@0 84 adb uninstall $(pkg)
nuclear@0 85
nuclear@0 86 .PHONY: run
nuclear@0 87 run:
nuclear@0 88 adb shell am start -n $(pkg)/$(act)
nuclear@0 89
nuclear@0 90 .PHONY: stop
nuclear@0 91 stop:
nuclear@0 92 adb shell am force-stop $(pkg)
nuclear@0 93
nuclear@7 94 AndroidManifest.xml: manifest.xml.in
nuclear@0 95 android create project -p . -t $(android_platform) -k $(pkg) -a NativeActivity -n $(name)
nuclear@0 96 cat manifest.xml.in | sed 's/$$APPNAME/$(name)/g' | sed 's/$$APPTITLE/$(title)/g' >$@
nuclear@0 97 cd src && rm -f *.java && ln -s ../../src/android/*.java .
nuclear@0 98
nuclear@0 99 .PHONY: update-project
nuclear@0 100 update-project: build.xml
nuclear@0 101 android update project -p . -t $(android_platform)
nuclear@18 102
nuclear@18 103 .PHONY: logcat
nuclear@18 104 logcat:
nuclear@19 105 adb logcat $(name):V AndroidRuntime:V DEBUG:V '*:S'