labyrinth

annotate android/Makefile @ 8:d3f1f74067b0

ops, forgot to swapbuffers on the android side
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 04 May 2015 04:56:44 +0300
parents b557812c45db
children
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@8 28 android_libs = -llog -landroid -lEGL -lGLESv1_CM
nuclear@3 29
nuclear@8 30 CFLAGS = -std=c99 -Wall -g -DAPP_NAME=\"$(name)\" -march=armv7-a -mfloat-abi=softfp \
nuclear@3 31 $(android_inc) -I$(root)/src/android -I$(root)/src/gles $(incpaths)
nuclear@8 32 LDFLAGS = -Wl,--fix-cortex-a8 -Wl,-z,defs $(android_libs) $(libpaths) -lm
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@7 53 ant_files = *.xml *.properties proguard-project.txt
nuclear@8 54 ant_dirs = bin libs res obj src
nuclear@7 55
nuclear@3 56 .PHONY: clean
nuclear@3 57 clean:
nuclear@7 58 rm -f $(obj) $(lib) $(apk-release) $(apk-debug) $(ant_files)
nuclear@7 59 rm -rf $(ant_dirs)
nuclear@3 60
nuclear@3 61 .PHONY: install
nuclear@3 62 install: install-debug
nuclear@3 63
nuclear@3 64 .PHONY: install-debug
nuclear@3 65 install-debug:
nuclear@3 66 adb install -r $(apk-debug)
nuclear@3 67
nuclear@3 68 .PHONY: install-release
nuclear@3 69 install-release:
nuclear@3 70 adb install -r $(apk-release)
nuclear@3 71
nuclear@5 72 .PHONY: uninstall
nuclear@5 73 uninstall:
nuclear@5 74 adb uninstall $(pkg)
nuclear@5 75
nuclear@3 76 .PHONY: run
nuclear@3 77 run:
nuclear@3 78 adb shell am start -n $(pkg)/$(act)
nuclear@3 79
nuclear@3 80 .PHONY: stop
nuclear@3 81 stop:
nuclear@3 82 adb shell am force-stop $(pkg)
nuclear@3 83
nuclear@7 84 AndroidManifest.xml:
nuclear@7 85 android create project -p . -t $(android_platform) -k $(pkg) -a NativeActivity -n $(name)
nuclear@7 86 cat manifest.xml.in | sed 's/$$APPNAME/$(name)/g' | sed 's/$$APPTITLE/$(title)/g' >$@
nuclear@7 87
nuclear@3 88 .PHONY: update-project
nuclear@3 89 update-project: build.xml
nuclear@7 90 android update project -p . -t $(android_platform)