labyrinth

view android/Makefile @ 8:d3f1f74067b0

ops, forgot to swapbuffers on the android side
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 04 May 2015 04:56:44 +0300
parents b557812c45db
children
line source
1 root = ..
2 include $(root)/proj.mk
4 # --- android settings ---
5 android_platform = android-22
6 name = $(bin)
7 pkgprefix = com.mutantstargoat
8 # ------------------------
9 native_app_glue_dir = $(NDK)/sources/android/native_app_glue
11 src += $(wildcard $(root)/src/android/*.c) \
12 $(wildcard $(root)/src/gles/*.c) \
13 $(native_app_glue_dir)/android_native_app_glue.c
15 obj = $(src:.c=.o) $(ccsrc:.cc=.o)
16 lib = libs/armeabi/lib$(name).so
17 apk-release = bin/$(name).apk
18 apk-debug = bin/$(name)-debug.apk
20 pkg = $(pkgprefix).$(name)
21 act = android.app.NativeActivity
23 CC = arm-linux-androideabi-gcc
24 CXX = arm-linux-androideabi-g++
26 android_usr = $(NDK)/platforms/$(android_platform)/arch-arm/usr
27 android_inc = -I$(android_usr)/include -I$(native_app_glue_dir)
28 android_libs = -llog -landroid -lEGL -lGLESv1_CM
30 CFLAGS = -std=c99 -Wall -g -DAPP_NAME=\"$(name)\" -march=armv7-a -mfloat-abi=softfp \
31 $(android_inc) -I$(root)/src/android -I$(root)/src/gles $(incpaths)
32 LDFLAGS = -Wl,--fix-cortex-a8 -Wl,-z,defs $(android_libs) $(libpaths) -lm
34 .PHONY: debug
35 debug: $(apk-debug)
37 .PHONY: release
38 release: $(apk-release)
40 $(apk-debug): $(lib) AndroidManifest.xml
41 ant debug
43 $(apk-release): $(lib) AndroidManifest.xml
44 ant release
46 .PHONY: lib
47 lib: $(lib)
49 $(lib): $(obj)
50 @mkdir -p libs/armeabi
51 $(CC) -o $@ -shared $(obj) $(LDFLAGS)
53 ant_files = *.xml *.properties proguard-project.txt
54 ant_dirs = bin libs res obj src
56 .PHONY: clean
57 clean:
58 rm -f $(obj) $(lib) $(apk-release) $(apk-debug) $(ant_files)
59 rm -rf $(ant_dirs)
61 .PHONY: install
62 install: install-debug
64 .PHONY: install-debug
65 install-debug:
66 adb install -r $(apk-debug)
68 .PHONY: install-release
69 install-release:
70 adb install -r $(apk-release)
72 .PHONY: uninstall
73 uninstall:
74 adb uninstall $(pkg)
76 .PHONY: run
77 run:
78 adb shell am start -n $(pkg)/$(act)
80 .PHONY: stop
81 stop:
82 adb shell am force-stop $(pkg)
84 AndroidManifest.xml:
85 android create project -p . -t $(android_platform) -k $(pkg) -a NativeActivity -n $(name)
86 cat manifest.xml.in | sed 's/$$APPNAME/$(name)/g' | sed 's/$$APPTITLE/$(title)/g' >$@
88 .PHONY: update-project
89 update-project: build.xml
90 android update project -p . -t $(android_platform)