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