3dphotoshoot

annotate android/Makefile @ 3:9df99687a2ff

the old camera API is horrible
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 15 May 2015 05:15:47 +0300
parents a4bf2687e406
children 7f6e6eb3d20e
rev   line source
nuclear@0 1 root = ..
nuclear@0 2 include $(root)/proj.mk
nuclear@0 3
nuclear@0 4 # --- android settings ---
nuclear@0 5 android_platform = android-22
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@0 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@0 24 android_usr = $(NDK)/platforms/$(android_platform)/arch-arm/usr
nuclear@0 25 android_inc = -I$(native_app_glue_dir)
nuclear@0 26 android_libs = -llog -landroid -lEGL -lGLESv1_CM
nuclear@0 27
nuclear@0 28 CFLAGS = -std=c99 -Wall -g -DAPP_NAME=\"$(name)\" -march=armv7-a -mfloat-abi=softfp \
nuclear@0 29 $(android_inc) -I$(root)/src/android -I$(root)/src/gles $(incpaths)
nuclear@0 30 LDFLAGS = -Wl,--fix-cortex-a8 -Wl,-z,defs $(android_libs) $(libpaths) -lm
nuclear@0 31
nuclear@0 32 .PHONY: debug
nuclear@0 33 debug: $(apk-debug)
nuclear@0 34
nuclear@0 35 .PHONY: release
nuclear@0 36 release: $(apk-release)
nuclear@0 37
nuclear@2 38 $(apk-debug): $(lib) $(jsrc) AndroidManifest.xml
nuclear@0 39 ant debug
nuclear@0 40
nuclear@2 41 $(apk-release): $(lib) $(jsrc) AndroidManifest.xml
nuclear@0 42 ant release
nuclear@0 43
nuclear@0 44 .PHONY: lib
nuclear@0 45 lib: $(lib)
nuclear@0 46
nuclear@0 47 $(lib): $(obj)
nuclear@0 48 @mkdir -p libs/armeabi
nuclear@0 49 $(CC) -o $@ -shared $(obj) $(LDFLAGS)
nuclear@0 50
nuclear@0 51 ant_files = *.xml *.properties proguard-project.txt
nuclear@0 52 ant_dirs = bin libs res obj src gen
nuclear@0 53
nuclear@0 54 .PHONY: clean
nuclear@0 55 clean:
nuclear@0 56 rm -f $(obj) $(lib) $(apk-release) $(apk-debug) $(ant_files)
nuclear@0 57 rm -rf $(ant_dirs)
nuclear@0 58
nuclear@0 59 .PHONY: install
nuclear@0 60 install: install-debug
nuclear@0 61
nuclear@0 62 .PHONY: install-debug
nuclear@0 63 install-debug:
nuclear@0 64 adb install -r $(apk-debug)
nuclear@0 65
nuclear@0 66 .PHONY: install-release
nuclear@0 67 install-release:
nuclear@0 68 adb install -r $(apk-release)
nuclear@0 69
nuclear@0 70 .PHONY: uninstall
nuclear@0 71 uninstall:
nuclear@0 72 adb uninstall $(pkg)
nuclear@0 73
nuclear@0 74 .PHONY: run
nuclear@0 75 run:
nuclear@0 76 adb shell am start -n $(pkg)/$(act)
nuclear@0 77
nuclear@0 78 .PHONY: stop
nuclear@0 79 stop:
nuclear@0 80 adb shell am force-stop $(pkg)
nuclear@0 81
nuclear@0 82 AndroidManifest.xml:
nuclear@0 83 android create project -p . -t $(android_platform) -k $(pkg) -a NativeActivity -n $(name)
nuclear@0 84 cat manifest.xml.in | sed 's/$$APPNAME/$(name)/g' | sed 's/$$APPTITLE/$(title)/g' >$@
nuclear@0 85 cd src && rm -f *.java && ln -s ../../src/android/*.java .
nuclear@0 86
nuclear@0 87 .PHONY: update-project
nuclear@0 88 update-project: build.xml
nuclear@0 89 android update project -p . -t $(android_platform)