3dphotoshoot

view android/Makefile @ 10:c71c477521ca

converting to GLES2 and C++
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 31 May 2015 00:40:26 +0300
parents 7f6e6eb3d20e
children abe7960e4a77
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) -lm
34 .PHONY: debug
35 debug: $(apk-debug)
37 .PHONY: release
38 release: $(apk-release)
40 $(apk-debug): $(lib) $(jsrc) AndroidManifest.xml
41 ant debug
43 $(apk-release): $(lib) $(jsrc) AndroidManifest.xml
44 ant release
46 .PHONY: lib
47 lib: $(lib)
49 $(lib): $(obj)
50 @mkdir -p libs/armeabi
51 $(CXX) -o $@ -shared $(obj) $(LDFLAGS)
53 ant_files = *.xml *.properties proguard-project.txt
54 ant_dirs = bin libs res obj src gen
56 .PHONY: clean
57 clean:
58 rm -f $(obj) $(lib) $(apk-release) $(apk-debug) $(ant_files)
59 rm -rf $(ant_dirs)
61 .PHONY: install
62 install: install-debug
64 .PHONY: install-debug
65 install-debug:
66 adb install -r $(apk-debug)
68 .PHONY: install-release
69 install-release:
70 adb install -r $(apk-release)
72 .PHONY: uninstall
73 uninstall:
74 adb uninstall $(pkg)
76 .PHONY: run
77 run:
78 adb shell am start -n $(pkg)/$(act)
80 .PHONY: stop
81 stop:
82 adb shell am force-stop $(pkg)
84 AndroidManifest.xml: manifest.xml.in
85 android create project -p . -t $(android_platform) -k $(pkg) -a NativeActivity -n $(name)
86 cat manifest.xml.in | sed 's/$$APPNAME/$(name)/g' | sed 's/$$APPTITLE/$(title)/g' >$@
87 cd src && rm -f *.java && ln -s ../../src/android/*.java .
89 .PHONY: update-project
90 update-project: build.xml
91 android update project -p . -t $(android_platform)