nuclear@23: bin = stereotunnel nuclear@23: root = .. nuclear@23: src = $(wildcard $(root)/src/*.c) nuclear@23: ccsrc = $(wildcard $(root)/src/*.cc) nuclear@23: nuclear@23: include $(root)/libs/Makefile nuclear@23: nuclear@23: # --- android settings --- nuclear@23: android_platform = android-19 nuclear@23: name = $(bin) nuclear@23: pkgprefix = com.mutantstargoat nuclear@23: # ------------------------ nuclear@23: nuclear@23: src += $(wildcard $(root)/src/android/*.c) nuclear@24: jsrc = $(wildcard $(root)/src/android/*.java) nuclear@23: nuclear@23: obj = $(src:.c=.o) $(ccsrc:.cc=.o) nuclear@23: lib = libs/armeabi/lib$(name).so nuclear@23: apk-release = bin/$(name).apk nuclear@23: apk-debug = bin/$(name)-debug.apk nuclear@23: nuclear@23: pkg = $(pkgprefix).$(name) nuclear@24: act = $(pkg).MainActivity nuclear@23: nuclear@23: CC = arm-linux-androideabi-gcc nuclear@23: CXX = arm-linux-androideabi-g++ nuclear@23: nuclear@23: android_libs = -lstdc++ -llog -landroid -lEGL -lGLESv2 nuclear@23: nuclear@23: defs += -DANDROID -DAPP_NAME=\"$(name)\" -DNO_FREETYPE -DHAVE_OPENGL_H nuclear@23: CXXFLAGS = -Wall -g $(defs) -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 \ nuclear@23: $(android_inc) -I$(root)/src -I$(root)/src/android $(incdir) nuclear@23: CFLAGS = -std=c99 $(CXXFLAGS) nuclear@23: LDFLAGS = -Wl,--fix-cortex-a8 -Wl,-z,defs $(android_libs) $(libpaths) -lm nuclear@23: nuclear@23: .PHONY: debug nuclear@23: debug: $(apk-debug) nuclear@23: nuclear@23: .PHONY: release nuclear@23: release: $(apk-release) nuclear@23: nuclear@23: $(apk-debug): $(lib) $(jsrc) AndroidManifest.xml assets/data assets/sdr nuclear@23: ant debug nuclear@23: nuclear@23: $(apk-release): $(lib) $(jsrc) AndroidManifest.xml assets/data assets/sdr nuclear@23: ant release nuclear@23: nuclear@23: assets/data: nuclear@23: mkdir -p assets nuclear@23: cd assets && rm -f data && ln -s ../../data . nuclear@23: nuclear@23: assets/sdr: nuclear@23: mkdir -p assets nuclear@23: cd assets && rm -f sdr && ln -s ../../sdr . nuclear@23: nuclear@23: .PHONY: lib nuclear@23: lib: $(lib) nuclear@23: nuclear@23: $(lib): $(obj) nuclear@23: @mkdir -p libs/armeabi nuclear@23: $(CXX) -o $@ -shared $(obj) $(LDFLAGS) nuclear@23: nuclear@23: ant_files = *.xml *.properties proguard-project.txt nuclear@23: ant_dirs = bin libs res obj src gen nuclear@23: nuclear@23: .PHONY: clean nuclear@23: clean: nuclear@23: rm -f $(obj) $(lib) $(apk-release) $(apk-debug) $(ant_files) nuclear@23: rm -rf $(ant_dirs) nuclear@23: rm -f assets/data assets/sdr nuclear@23: [ -d assets ] && rmdir assets || true nuclear@23: nuclear@23: .PHONY: install nuclear@23: install: install-debug nuclear@23: nuclear@23: .PHONY: install-debug nuclear@23: install-debug: nuclear@23: adb install -r $(apk-debug) nuclear@23: nuclear@23: .PHONY: install-release nuclear@23: install-release: nuclear@23: adb install -r $(apk-release) nuclear@23: nuclear@23: .PHONY: uninstall nuclear@23: uninstall: nuclear@23: adb uninstall $(pkg) nuclear@23: nuclear@23: .PHONY: run nuclear@23: run: nuclear@23: adb shell am start -n $(pkg)/$(act) nuclear@23: nuclear@23: .PHONY: stop nuclear@23: stop: nuclear@23: adb shell am force-stop $(pkg) nuclear@23: nuclear@23: AndroidManifest.xml: manifest.xml.in nuclear@23: android create project -p . -t $(android_platform) -k $(pkg) -a NativeActivity -n $(name) nuclear@23: cat manifest.xml.in | sed 's/$$APPNAME/$(name)/g' | sed 's/$$APPTITLE/$(title)/g' >$@ nuclear@24: cd src && rm -f *.java && ln -s ../../src/android/*.java . nuclear@23: nuclear@23: .PHONY: update-project nuclear@23: update-project: build.xml nuclear@23: android update project -p . -t $(android_platform) nuclear@23: nuclear@23: .PHONY: logcat nuclear@23: logcat: nuclear@23: adb logcat $(name):V AndroidRuntime:V DEBUG:V '*:S'