nuclear@3: root = .. nuclear@3: include $(root)/proj.mk nuclear@3: nuclear@3: # --- android settings --- nuclear@3: android_platform = android-22 nuclear@3: name = $(bin) nuclear@3: pkgprefix = com.mutantstargoat nuclear@3: # ------------------------ nuclear@3: native_app_glue_dir = $(NDK)/sources/android/native_app_glue nuclear@3: nuclear@3: src += $(wildcard $(root)/src/android/*.c) \ nuclear@3: $(wildcard $(root)/src/gles/*.c) \ nuclear@3: $(native_app_glue_dir)/android_native_app_glue.c nuclear@3: nuclear@3: obj = $(src:.c=.o) $(ccsrc:.cc=.o) nuclear@3: lib = libs/armeabi/lib$(name).so nuclear@3: apk-release = bin/$(name).apk nuclear@3: apk-debug = bin/$(name)-debug.apk nuclear@3: nuclear@3: pkg = $(pkgprefix).$(name) nuclear@3: act = android.app.NativeActivity nuclear@3: nuclear@3: CC = arm-linux-androideabi-gcc nuclear@3: CXX = arm-linux-androideabi-g++ nuclear@3: nuclear@3: android_usr = $(NDK)/platforms/$(android_platform)/arch-arm/usr nuclear@3: android_inc = -I$(android_usr)/include -I$(native_app_glue_dir) nuclear@8: android_libs = -llog -landroid -lEGL -lGLESv1_CM nuclear@3: nuclear@8: CFLAGS = -std=c99 -Wall -g -DAPP_NAME=\"$(name)\" -march=armv7-a -mfloat-abi=softfp \ nuclear@3: $(android_inc) -I$(root)/src/android -I$(root)/src/gles $(incpaths) nuclear@8: LDFLAGS = -Wl,--fix-cortex-a8 -Wl,-z,defs $(android_libs) $(libpaths) -lm nuclear@3: nuclear@3: .PHONY: debug nuclear@3: debug: $(apk-debug) nuclear@3: nuclear@3: .PHONY: release nuclear@3: release: $(apk-release) nuclear@3: nuclear@3: $(apk-debug): $(lib) AndroidManifest.xml nuclear@3: ant debug nuclear@3: nuclear@3: $(apk-release): $(lib) AndroidManifest.xml nuclear@3: ant release nuclear@3: nuclear@3: .PHONY: lib nuclear@3: lib: $(lib) nuclear@3: nuclear@3: $(lib): $(obj) nuclear@3: @mkdir -p libs/armeabi nuclear@3: $(CC) -o $@ -shared $(obj) $(LDFLAGS) nuclear@3: nuclear@7: ant_files = *.xml *.properties proguard-project.txt nuclear@8: ant_dirs = bin libs res obj src nuclear@7: nuclear@3: .PHONY: clean nuclear@3: clean: nuclear@7: rm -f $(obj) $(lib) $(apk-release) $(apk-debug) $(ant_files) nuclear@7: rm -rf $(ant_dirs) nuclear@3: nuclear@3: .PHONY: install nuclear@3: install: install-debug nuclear@3: nuclear@3: .PHONY: install-debug nuclear@3: install-debug: nuclear@3: adb install -r $(apk-debug) nuclear@3: nuclear@3: .PHONY: install-release nuclear@3: install-release: nuclear@3: adb install -r $(apk-release) nuclear@3: nuclear@5: .PHONY: uninstall nuclear@5: uninstall: nuclear@5: adb uninstall $(pkg) nuclear@5: nuclear@3: .PHONY: run nuclear@3: run: nuclear@3: adb shell am start -n $(pkg)/$(act) nuclear@3: nuclear@3: .PHONY: stop nuclear@3: stop: nuclear@3: adb shell am force-stop $(pkg) nuclear@3: nuclear@7: AndroidManifest.xml: nuclear@7: android create project -p . -t $(android_platform) -k $(pkg) -a NativeActivity -n $(name) nuclear@7: cat manifest.xml.in | sed 's/$$APPNAME/$(name)/g' | sed 's/$$APPTITLE/$(title)/g' >$@ nuclear@7: nuclear@3: .PHONY: update-project nuclear@3: update-project: build.xml nuclear@7: android update project -p . -t $(android_platform)