labyrinth

diff android/Makefile @ 3:45b91185b298

android port
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 01 May 2015 04:36:50 +0300
parents
children c8826e5ebec1
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/android/Makefile	Fri May 01 04:36:50 2015 +0300
     1.3 @@ -0,0 +1,78 @@
     1.4 +root = ..
     1.5 +include $(root)/proj.mk
     1.6 +
     1.7 +# --- android settings ---
     1.8 +android_platform = android-22
     1.9 +name = $(bin)
    1.10 +pkgprefix = com.mutantstargoat
    1.11 +# ------------------------
    1.12 +native_app_glue_dir = $(NDK)/sources/android/native_app_glue
    1.13 +
    1.14 +src += $(wildcard $(root)/src/android/*.c) \
    1.15 +	   $(wildcard $(root)/src/gles/*.c) \
    1.16 +	   $(native_app_glue_dir)/android_native_app_glue.c
    1.17 +
    1.18 +obj = $(src:.c=.o) $(ccsrc:.cc=.o)
    1.19 +lib = libs/armeabi/lib$(name).so
    1.20 +apk-release = bin/$(name).apk
    1.21 +apk-debug = bin/$(name)-debug.apk
    1.22 +
    1.23 +pkg = $(pkgprefix).$(name)
    1.24 +act = android.app.NativeActivity
    1.25 +
    1.26 +CC = arm-linux-androideabi-gcc
    1.27 +CXX = arm-linux-androideabi-g++
    1.28 +
    1.29 +android_usr = $(NDK)/platforms/$(android_platform)/arch-arm/usr
    1.30 +android_inc = -I$(android_usr)/include -I$(native_app_glue_dir)
    1.31 +android_libs = -L$(android_usr)/lib -llog -landroid -lEGL -lGLESv1_CM
    1.32 +
    1.33 +CFLAGS = -std=c99 -Wall -g -DAPP_NAME=\"$(name)\" \
    1.34 +		 $(android_inc) -I$(root)/src/android -I$(root)/src/gles $(incpaths)
    1.35 +LDFLAGS = -Wl,--fix-cortex-a8 $(android_libs) $(libpaths)
    1.36 +
    1.37 +.PHONY: debug
    1.38 +debug: $(apk-debug)
    1.39 +
    1.40 +.PHONY: release
    1.41 +release: $(apk-release)
    1.42 +
    1.43 +$(apk-debug): $(lib) AndroidManifest.xml
    1.44 +	ant debug
    1.45 +
    1.46 +$(apk-release): $(lib) AndroidManifest.xml
    1.47 +	ant release
    1.48 +
    1.49 +.PHONY: lib
    1.50 +lib: $(lib)
    1.51 +
    1.52 +$(lib): $(obj)
    1.53 +	@mkdir -p libs/armeabi
    1.54 +	$(CC) -o $@ -shared $(obj) $(LDFLAGS)
    1.55 +
    1.56 +.PHONY: clean
    1.57 +clean:
    1.58 +	rm -f $(obj) $(lib) $(apk-release) $(apk-debug)
    1.59 +
    1.60 +.PHONY: install
    1.61 +install: install-debug
    1.62 +
    1.63 +.PHONY: install-debug
    1.64 +install-debug:
    1.65 +	adb install -r $(apk-debug)
    1.66 +
    1.67 +.PHONY: install-release
    1.68 +install-release:
    1.69 +	adb install -r $(apk-release)
    1.70 +
    1.71 +.PHONY: run
    1.72 +run:
    1.73 +	adb shell am start -n $(pkg)/$(act)
    1.74 +
    1.75 +.PHONY: stop
    1.76 +stop:
    1.77 +	adb shell am force-stop $(pkg)
    1.78 +
    1.79 +.PHONY: update-project
    1.80 +update-project: build.xml
    1.81 +	android update project --path . --target $(android_platform)