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