istereo2

view android/Makefile @ 23:7d795dade0bc

first pass at android port... compiles!
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 03 Oct 2015 06:10:30 +0300
parents
children 9d53a4938ce8
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)
16 obj = $(src:.c=.o) $(ccsrc:.cc=.o)
17 lib = libs/armeabi/lib$(name).so
18 apk-release = bin/$(name).apk
19 apk-debug = bin/$(name)-debug.apk
21 pkg = $(pkgprefix).$(name)
22 act = android.app.NativeActivity
24 CC = arm-linux-androideabi-gcc
25 CXX = arm-linux-androideabi-g++
27 android_libs = -lstdc++ -llog -landroid -lEGL -lGLESv2
29 defs += -DANDROID -DAPP_NAME=\"$(name)\" -DNO_FREETYPE -DHAVE_OPENGL_H
30 CXXFLAGS = -Wall -g $(defs) -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 \
31 $(android_inc) -I$(root)/src -I$(root)/src/android $(incdir)
32 CFLAGS = -std=c99 $(CXXFLAGS)
33 LDFLAGS = -Wl,--fix-cortex-a8 -Wl,-z,defs $(android_libs) $(libpaths) -lm
35 .PHONY: debug
36 debug: $(apk-debug)
38 .PHONY: release
39 release: $(apk-release)
41 $(apk-debug): $(lib) $(jsrc) AndroidManifest.xml assets/data assets/sdr
42 ant debug
44 $(apk-release): $(lib) $(jsrc) AndroidManifest.xml assets/data assets/sdr
45 ant release
47 assets/data:
48 mkdir -p assets
49 cd assets && rm -f data && ln -s ../../data .
51 assets/sdr:
52 mkdir -p assets
53 cd assets && rm -f sdr && ln -s ../../sdr .
55 .PHONY: lib
56 lib: $(lib)
58 $(lib): $(obj)
59 @mkdir -p libs/armeabi
60 $(CXX) -o $@ -shared $(obj) $(LDFLAGS)
62 ant_files = *.xml *.properties proguard-project.txt
63 ant_dirs = bin libs res obj src gen
65 .PHONY: clean
66 clean:
67 rm -f $(obj) $(lib) $(apk-release) $(apk-debug) $(ant_files)
68 rm -rf $(ant_dirs)
69 rm -f assets/data assets/sdr
70 [ -d assets ] && rmdir assets || true
72 .PHONY: install
73 install: install-debug
75 .PHONY: install-debug
76 install-debug:
77 adb install -r $(apk-debug)
79 .PHONY: install-release
80 install-release:
81 adb install -r $(apk-release)
83 .PHONY: uninstall
84 uninstall:
85 adb uninstall $(pkg)
87 .PHONY: run
88 run:
89 adb shell am start -n $(pkg)/$(act)
91 .PHONY: stop
92 stop:
93 adb shell am force-stop $(pkg)
95 AndroidManifest.xml: manifest.xml.in
96 android create project -p . -t $(android_platform) -k $(pkg) -a NativeActivity -n $(name)
97 cat manifest.xml.in | sed 's/$$APPNAME/$(name)/g' | sed 's/$$APPTITLE/$(title)/g' >$@
98 # cd src && rm -f *.java && ln -s ../../src/android/*.java .
100 .PHONY: update-project
101 update-project: build.xml
102 android update project -p . -t $(android_platform)
104 .PHONY: logcat
105 logcat:
106 adb logcat $(name):V AndroidRuntime:V DEBUG:V '*:S'