ndktest

view Makefile @ 0:1310df7cdf25

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 23 Apr 2015 20:54:02 +0300
parents
children fe78cf853157
line source
1 android_platform = android-21
3 src = $(wildcard src/*.c)
4 obj = $(src:.c=.o)
5 name = ndktest
6 lib = libs/armeabi/lib$(name).so
7 apk-release = bin/$(name).apk
8 apk-debug = bin/$(name)-debug.apk
10 pkg = com.mutantstargoat.ndktest
11 act = android.app.NativeActivity
13 CC = arm-linux-androideabi-gcc
15 android_usr = $(NDK)/platforms/$(android_platform)/arch-arm/usr
16 android_inc = -I$(android_usr)/include
17 android_libs = -L$(android_usr)/lib -llog -landroid -lEGL -lGLESv1_CM
19 CFLAGS = -std=c99 -pedantic -Wall -g $(android_inc) -Isrc
20 LDFLAGS = -Wl,--fix-cortex-a8 $(android_libs)
22 .PHONY: debug
23 debug: $(apk-debug)
25 .PHONY: release
26 release: $(apk-release)
28 $(apk-debug): $(lib)
29 ant debug
31 $(apk-release): $(lib)
32 ant release
34 .PHONY: lib
35 lib: $(lib)
37 $(lib): $(obj)
38 @mkdir -p libs/armeabi
39 $(CC) -o $@ -shared $(obj) $(LDFLAGS)
41 .PHONY: clean
42 clean:
43 rm -f $(obj) $(lib) $(apk-release) $(apk-debug)
45 .PHONY: install
46 install: install-debug
48 .PHONY: install-debug
49 install-debug:
50 adb install -r $(apk-debug)
52 .PHONY: install-release
53 install-release:
54 adb install -r $(apk-release)
56 .PHONY: run
57 run:
58 adb shell am start -n $(pkg)/$(act)
60 .PHONY: stop
61 stop:
62 adb shell am force-stop $(pkg)