istereo2

annotate android/Makefile @ 33:3784a2d4bed5

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