ndktest

diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Makefile	Thu Apr 23 20:54:02 2015 +0300
     1.3 @@ -0,0 +1,62 @@
     1.4 +android_platform = android-21
     1.5 +
     1.6 +src = $(wildcard src/*.c)
     1.7 +obj = $(src:.c=.o)
     1.8 +name = ndktest
     1.9 +lib = libs/armeabi/lib$(name).so
    1.10 +apk-release = bin/$(name).apk
    1.11 +apk-debug = bin/$(name)-debug.apk
    1.12 +
    1.13 +pkg = com.mutantstargoat.ndktest
    1.14 +act = android.app.NativeActivity
    1.15 +
    1.16 +CC = arm-linux-androideabi-gcc
    1.17 +
    1.18 +android_usr = $(NDK)/platforms/$(android_platform)/arch-arm/usr
    1.19 +android_inc = -I$(android_usr)/include
    1.20 +android_libs = -L$(android_usr)/lib -llog -landroid -lEGL -lGLESv1_CM
    1.21 +
    1.22 +CFLAGS = -std=c99 -pedantic -Wall -g $(android_inc) -Isrc
    1.23 +LDFLAGS = -Wl,--fix-cortex-a8 $(android_libs)
    1.24 +
    1.25 +.PHONY: debug
    1.26 +debug: $(apk-debug)
    1.27 +
    1.28 +.PHONY: release
    1.29 +release: $(apk-release)
    1.30 +
    1.31 +$(apk-debug): $(lib)
    1.32 +	ant debug
    1.33 +
    1.34 +$(apk-release): $(lib)
    1.35 +	ant release
    1.36 +
    1.37 +.PHONY: lib
    1.38 +lib: $(lib)
    1.39 +
    1.40 +$(lib): $(obj)
    1.41 +	@mkdir -p libs/armeabi
    1.42 +	$(CC) -o $@ -shared $(obj) $(LDFLAGS)
    1.43 +
    1.44 +.PHONY: clean
    1.45 +clean:
    1.46 +	rm -f $(obj) $(lib) $(apk-release) $(apk-debug)
    1.47 +
    1.48 +.PHONY: install
    1.49 +install: install-debug
    1.50 +
    1.51 +.PHONY: install-debug
    1.52 +install-debug:
    1.53 +	adb install -r $(apk-debug)
    1.54 +
    1.55 +.PHONY: install-release
    1.56 +install-release:
    1.57 +	adb install -r $(apk-release)
    1.58 +
    1.59 +.PHONY: run
    1.60 +run:
    1.61 +	adb shell am start -n $(pkg)/$(act)
    1.62 +
    1.63 +.PHONY: stop
    1.64 +stop:
    1.65 +	adb shell am force-stop $(pkg)