3dphotoshoot

annotate android/Makefile @ 18:dccbd7d65517

moved to android-19 to make it work with android 4.x
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 10 Jun 2015 18:53:28 +0300
parents 06dc8b9b4f89
children 94b8ef9b8caa
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@18 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@18 26 #android_libs = -lstdc++ -llog -landroid -lEGL -lGLESv2
nuclear@18 27 android_libs = -llog -landroid -lEGL -lGLESv2
nuclear@0 28
nuclear@10 29 defs += -DANDROID -DAPP_NAME=\"$(name)\"
nuclear@10 30 CXXFLAGS = -Wall -g $(defs) -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 \
nuclear@0 31 $(android_inc) -I$(root)/src/android -I$(root)/src/gles $(incpaths)
nuclear@10 32 CFLAGS = -std=c99 $(CXXFLAGS)
nuclear@14 33 LDFLAGS = -Wl,--fix-cortex-a8 -Wl,-z,defs $(android_libs) $(libpaths) $(libs)
nuclear@0 34
nuclear@0 35 .PHONY: debug
nuclear@0 36 debug: $(apk-debug)
nuclear@0 37
nuclear@0 38 .PHONY: release
nuclear@0 39 release: $(apk-release)
nuclear@0 40
nuclear@13 41 $(apk-debug): $(lib) $(jsrc) AndroidManifest.xml assets/data assets/sdr
nuclear@0 42 ant debug
nuclear@0 43
nuclear@13 44 $(apk-release): $(lib) $(jsrc) AndroidManifest.xml assets/data assets/sdr
nuclear@0 45 ant release
nuclear@0 46
nuclear@13 47 assets/data:
nuclear@13 48 mkdir -p assets
nuclear@13 49 cd assets && rm -f data && ln -s ../../data .
nuclear@13 50
nuclear@13 51 assets/sdr:
nuclear@13 52 mkdir -p assets
nuclear@13 53 cd assets && rm -f sdr && ln -s ../../sdr .
nuclear@12 54
nuclear@0 55 .PHONY: lib
nuclear@0 56 lib: $(lib)
nuclear@0 57
nuclear@0 58 $(lib): $(obj)
nuclear@0 59 @mkdir -p libs/armeabi
nuclear@18 60 $(CC) -o $@ -shared $(obj) $(LDFLAGS)
nuclear@0 61
nuclear@0 62 ant_files = *.xml *.properties proguard-project.txt
nuclear@0 63 ant_dirs = bin libs res obj src gen
nuclear@0 64
nuclear@0 65 .PHONY: clean
nuclear@0 66 clean:
nuclear@0 67 rm -f $(obj) $(lib) $(apk-release) $(apk-debug) $(ant_files)
nuclear@0 68 rm -rf $(ant_dirs)
nuclear@0 69
nuclear@0 70 .PHONY: install
nuclear@0 71 install: install-debug
nuclear@0 72
nuclear@0 73 .PHONY: install-debug
nuclear@0 74 install-debug:
nuclear@0 75 adb install -r $(apk-debug)
nuclear@0 76
nuclear@0 77 .PHONY: install-release
nuclear@0 78 install-release:
nuclear@0 79 adb install -r $(apk-release)
nuclear@0 80
nuclear@0 81 .PHONY: uninstall
nuclear@0 82 uninstall:
nuclear@0 83 adb uninstall $(pkg)
nuclear@0 84
nuclear@0 85 .PHONY: run
nuclear@0 86 run:
nuclear@0 87 adb shell am start -n $(pkg)/$(act)
nuclear@0 88
nuclear@0 89 .PHONY: stop
nuclear@0 90 stop:
nuclear@0 91 adb shell am force-stop $(pkg)
nuclear@0 92
nuclear@7 93 AndroidManifest.xml: manifest.xml.in
nuclear@0 94 android create project -p . -t $(android_platform) -k $(pkg) -a NativeActivity -n $(name)
nuclear@0 95 cat manifest.xml.in | sed 's/$$APPNAME/$(name)/g' | sed 's/$$APPTITLE/$(title)/g' >$@
nuclear@0 96 cd src && rm -f *.java && ln -s ../../src/android/*.java .
nuclear@0 97
nuclear@0 98 .PHONY: update-project
nuclear@0 99 update-project: build.xml
nuclear@0 100 android update project -p . -t $(android_platform)
nuclear@18 101
nuclear@18 102 .PHONY: logcat
nuclear@18 103 logcat:
nuclear@18 104 adb logcat '$(name):V' 'DEBUG:V' '*:S'