nuclear@0: root = .. nuclear@0: include $(root)/proj.mk nuclear@0: nuclear@0: # --- android settings --- nuclear@18: android_platform = android-19 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@19: 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@18: #android_usr = $(NDK)/platforms/$(android_platform)/arch-arm/usr nuclear@0: android_inc = -I$(native_app_glue_dir) nuclear@19: android_libs = -lstdc++ -llog -landroid -lEGL -lGLESv2 nuclear@0: nuclear@10: defs += -DANDROID -DAPP_NAME=\"$(name)\" nuclear@10: CXXFLAGS = -Wall -g $(defs) -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 \ nuclear@0: $(android_inc) -I$(root)/src/android -I$(root)/src/gles $(incpaths) nuclear@10: CFLAGS = -std=c99 $(CXXFLAGS) nuclear@14: LDFLAGS = -Wl,--fix-cortex-a8 -Wl,-z,defs $(android_libs) $(libpaths) $(libs) 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@13: $(apk-debug): $(lib) $(jsrc) AndroidManifest.xml assets/data assets/sdr nuclear@0: ant debug nuclear@0: nuclear@13: $(apk-release): $(lib) $(jsrc) AndroidManifest.xml assets/data assets/sdr nuclear@0: ant release nuclear@0: nuclear@13: assets/data: nuclear@13: mkdir -p assets nuclear@13: cd assets && rm -f data && ln -s ../../data . nuclear@13: nuclear@13: assets/sdr: nuclear@13: mkdir -p assets nuclear@13: cd assets && rm -f sdr && ln -s ../../sdr . nuclear@12: nuclear@0: .PHONY: lib nuclear@0: lib: $(lib) nuclear@0: nuclear@0: $(lib): $(obj) nuclear@0: @mkdir -p libs/armeabi nuclear@19: $(CXX) -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@23: rm -f assets/data assets/sdr nuclear@24: [ -d assets ] && rmdir assets || true 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) nuclear@18: nuclear@18: .PHONY: logcat nuclear@18: logcat: nuclear@19: adb logcat $(name):V AndroidRuntime:V DEBUG:V '*:S'