3dphotoshoot

annotate android/Makefile @ 0:a4bf2687e406

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