3dphotoshoot

annotate android/Makefile @ 15:2d48f65da357

assman
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 07 Jun 2015 20:40:37 +0300
parents 8cfe061ddd5f
children dccbd7d65517
rev   line source
nuclear@0 1 root = ..
nuclear@0 2 include $(root)/proj.mk
nuclear@0 3
nuclear@0 4 # --- android settings ---
nuclear@0 5 android_platform = android-22
nuclear@0 6 name = $(bin)
nuclear@0 7 pkgprefix = com.mutantstargoat
nuclear@0 8 # ------------------------
nuclear@0 9
nuclear@0 10 src += $(wildcard $(root)/src/android/*.c)
nuclear@2 11 jsrc = $(wildcard $(root)/src/android/*.java)
nuclear@0 12
nuclear@0 13 obj = $(src:.c=.o) $(ccsrc:.cc=.o)
nuclear@0 14 lib = libs/armeabi/lib$(name).so
nuclear@0 15 apk-release = bin/$(name).apk
nuclear@0 16 apk-debug = bin/$(name)-debug.apk
nuclear@0 17
nuclear@0 18 pkg = $(pkgprefix).$(name)
nuclear@0 19 act = $(pkg).MainActivity
nuclear@0 20
nuclear@0 21 CC = arm-linux-androideabi-gcc
nuclear@0 22 CXX = arm-linux-androideabi-g++
nuclear@0 23
nuclear@0 24 android_usr = $(NDK)/platforms/$(android_platform)/arch-arm/usr
nuclear@0 25 android_inc = -I$(native_app_glue_dir)
nuclear@10 26 android_libs = -lstdc++ -llog -landroid -lEGL -lGLESv2
nuclear@0 27
nuclear@10 28 defs += -DANDROID -DAPP_NAME=\"$(name)\"
nuclear@10 29 CXXFLAGS = -Wall -g $(defs) -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 \
nuclear@0 30 $(android_inc) -I$(root)/src/android -I$(root)/src/gles $(incpaths)
nuclear@10 31 CFLAGS = -std=c99 $(CXXFLAGS)
nuclear@14 32 LDFLAGS = -Wl,--fix-cortex-a8 -Wl,-z,defs $(android_libs) $(libpaths) $(libs)
nuclear@0 33
nuclear@0 34 .PHONY: debug
nuclear@0 35 debug: $(apk-debug)
nuclear@0 36
nuclear@0 37 .PHONY: release
nuclear@0 38 release: $(apk-release)
nuclear@0 39
nuclear@13 40 $(apk-debug): $(lib) $(jsrc) AndroidManifest.xml assets/data assets/sdr
nuclear@0 41 ant debug
nuclear@0 42
nuclear@13 43 $(apk-release): $(lib) $(jsrc) AndroidManifest.xml assets/data assets/sdr
nuclear@0 44 ant release
nuclear@0 45
nuclear@13 46 assets/data:
nuclear@13 47 mkdir -p assets
nuclear@13 48 cd assets && rm -f data && ln -s ../../data .
nuclear@13 49
nuclear@13 50 assets/sdr:
nuclear@13 51 mkdir -p assets
nuclear@13 52 cd assets && rm -f sdr && ln -s ../../sdr .
nuclear@12 53
nuclear@0 54 .PHONY: lib
nuclear@0 55 lib: $(lib)
nuclear@0 56
nuclear@0 57 $(lib): $(obj)
nuclear@0 58 @mkdir -p libs/armeabi
nuclear@10 59 $(CXX) -o $@ -shared $(obj) $(LDFLAGS)
nuclear@0 60
nuclear@0 61 ant_files = *.xml *.properties proguard-project.txt
nuclear@0 62 ant_dirs = bin libs res obj src gen
nuclear@0 63
nuclear@0 64 .PHONY: clean
nuclear@0 65 clean:
nuclear@0 66 rm -f $(obj) $(lib) $(apk-release) $(apk-debug) $(ant_files)
nuclear@0 67 rm -rf $(ant_dirs)
nuclear@0 68
nuclear@0 69 .PHONY: install
nuclear@0 70 install: install-debug
nuclear@0 71
nuclear@0 72 .PHONY: install-debug
nuclear@0 73 install-debug:
nuclear@0 74 adb install -r $(apk-debug)
nuclear@0 75
nuclear@0 76 .PHONY: install-release
nuclear@0 77 install-release:
nuclear@0 78 adb install -r $(apk-release)
nuclear@0 79
nuclear@0 80 .PHONY: uninstall
nuclear@0 81 uninstall:
nuclear@0 82 adb uninstall $(pkg)
nuclear@0 83
nuclear@0 84 .PHONY: run
nuclear@0 85 run:
nuclear@0 86 adb shell am start -n $(pkg)/$(act)
nuclear@0 87
nuclear@0 88 .PHONY: stop
nuclear@0 89 stop:
nuclear@0 90 adb shell am force-stop $(pkg)
nuclear@0 91
nuclear@7 92 AndroidManifest.xml: manifest.xml.in
nuclear@0 93 android create project -p . -t $(android_platform) -k $(pkg) -a NativeActivity -n $(name)
nuclear@0 94 cat manifest.xml.in | sed 's/$$APPNAME/$(name)/g' | sed 's/$$APPTITLE/$(title)/g' >$@
nuclear@0 95 cd src && rm -f *.java && ln -s ../../src/android/*.java .
nuclear@0 96
nuclear@0 97 .PHONY: update-project
nuclear@0 98 update-project: build.xml
nuclear@0 99 android update project -p . -t $(android_platform)