3dphotoshoot

view android/Makefile @ 17:aef7f51f6397

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