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