ndktest

annotate Makefile @ 0:1310df7cdf25

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