labyrinth

annotate 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
rev   line source
nuclear@3 1 root = ..
nuclear@3 2 include $(root)/proj.mk
nuclear@3 3
nuclear@3 4 # --- android settings ---
nuclear@3 5 android_platform = android-22
nuclear@3 6 name = $(bin)
nuclear@3 7 pkgprefix = com.mutantstargoat
nuclear@3 8 # ------------------------
nuclear@3 9 native_app_glue_dir = $(NDK)/sources/android/native_app_glue
nuclear@3 10
nuclear@3 11 src += $(wildcard $(root)/src/android/*.c) \
nuclear@3 12 $(wildcard $(root)/src/gles/*.c) \
nuclear@3 13 $(native_app_glue_dir)/android_native_app_glue.c
nuclear@3 14
nuclear@3 15 obj = $(src:.c=.o) $(ccsrc:.cc=.o)
nuclear@3 16 lib = libs/armeabi/lib$(name).so
nuclear@3 17 apk-release = bin/$(name).apk
nuclear@3 18 apk-debug = bin/$(name)-debug.apk
nuclear@3 19
nuclear@3 20 pkg = $(pkgprefix).$(name)
nuclear@3 21 act = android.app.NativeActivity
nuclear@3 22
nuclear@3 23 CC = arm-linux-androideabi-gcc
nuclear@3 24 CXX = arm-linux-androideabi-g++
nuclear@3 25
nuclear@3 26 android_usr = $(NDK)/platforms/$(android_platform)/arch-arm/usr
nuclear@3 27 android_inc = -I$(android_usr)/include -I$(native_app_glue_dir)
nuclear@3 28 android_libs = -L$(android_usr)/lib -llog -landroid -lEGL -lGLESv1_CM
nuclear@3 29
nuclear@3 30 CFLAGS = -std=c99 -Wall -g -DAPP_NAME=\"$(name)\" \
nuclear@3 31 $(android_inc) -I$(root)/src/android -I$(root)/src/gles $(incpaths)
nuclear@3 32 LDFLAGS = -Wl,--fix-cortex-a8 $(android_libs) $(libpaths)
nuclear@3 33
nuclear@3 34 .PHONY: debug
nuclear@3 35 debug: $(apk-debug)
nuclear@3 36
nuclear@3 37 .PHONY: release
nuclear@3 38 release: $(apk-release)
nuclear@3 39
nuclear@3 40 $(apk-debug): $(lib) AndroidManifest.xml
nuclear@3 41 ant debug
nuclear@3 42
nuclear@3 43 $(apk-release): $(lib) AndroidManifest.xml
nuclear@3 44 ant release
nuclear@3 45
nuclear@3 46 .PHONY: lib
nuclear@3 47 lib: $(lib)
nuclear@3 48
nuclear@3 49 $(lib): $(obj)
nuclear@3 50 @mkdir -p libs/armeabi
nuclear@3 51 $(CC) -o $@ -shared $(obj) $(LDFLAGS)
nuclear@3 52
nuclear@3 53 .PHONY: clean
nuclear@3 54 clean:
nuclear@3 55 rm -f $(obj) $(lib) $(apk-release) $(apk-debug)
nuclear@3 56
nuclear@3 57 .PHONY: install
nuclear@3 58 install: install-debug
nuclear@3 59
nuclear@3 60 .PHONY: install-debug
nuclear@3 61 install-debug:
nuclear@3 62 adb install -r $(apk-debug)
nuclear@3 63
nuclear@3 64 .PHONY: install-release
nuclear@3 65 install-release:
nuclear@3 66 adb install -r $(apk-release)
nuclear@3 67
nuclear@3 68 .PHONY: run
nuclear@3 69 run:
nuclear@3 70 adb shell am start -n $(pkg)/$(act)
nuclear@3 71
nuclear@3 72 .PHONY: stop
nuclear@3 73 stop:
nuclear@3 74 adb shell am force-stop $(pkg)
nuclear@3 75
nuclear@3 76 .PHONY: update-project
nuclear@3 77 update-project: build.xml
nuclear@3 78 android update project --path . --target $(android_platform)