labyrinth

view android/Makefile @ 4:f35596f110bc

fixed .hgignore
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 01 May 2015 04:38:43 +0300
parents
children c8826e5ebec1
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 = -L$(android_usr)/lib -llog -landroid -lEGL -lGLESv1_CM
30 CFLAGS = -std=c99 -Wall -g -DAPP_NAME=\"$(name)\" \
31 $(android_inc) -I$(root)/src/android -I$(root)/src/gles $(incpaths)
32 LDFLAGS = -Wl,--fix-cortex-a8 $(android_libs) $(libpaths)
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 .PHONY: clean
54 clean:
55 rm -f $(obj) $(lib) $(apk-release) $(apk-debug)
57 .PHONY: install
58 install: install-debug
60 .PHONY: install-debug
61 install-debug:
62 adb install -r $(apk-debug)
64 .PHONY: install-release
65 install-release:
66 adb install -r $(apk-release)
68 .PHONY: run
69 run:
70 adb shell am start -n $(pkg)/$(act)
72 .PHONY: stop
73 stop:
74 adb shell am force-stop $(pkg)
76 .PHONY: update-project
77 update-project: build.xml
78 android update project --path . --target $(android_platform)