3dphotoshoot
view android/Makefile @ 12:abe7960e4a77
foo
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 06 Jun 2015 21:31:52 +0300 |
parents | c71c477521ca |
children | 8cfe061ddd5f |
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 res/data
41 ant debug
43 $(apk-release): $(lib) $(jsrc) AndroidManifest.xml res/data
44 ant release
46 res/data:
47 cd res && rm -f data && ln -s ../../data .
49 .PHONY: lib
50 lib: $(lib)
52 $(lib): $(obj)
53 @mkdir -p libs/armeabi
54 $(CXX) -o $@ -shared $(obj) $(LDFLAGS)
56 ant_files = *.xml *.properties proguard-project.txt
57 ant_dirs = bin libs res obj src gen
59 .PHONY: clean
60 clean:
61 rm -f $(obj) $(lib) $(apk-release) $(apk-debug) $(ant_files)
62 rm -rf $(ant_dirs)
64 .PHONY: install
65 install: install-debug
67 .PHONY: install-debug
68 install-debug:
69 adb install -r $(apk-debug)
71 .PHONY: install-release
72 install-release:
73 adb install -r $(apk-release)
75 .PHONY: uninstall
76 uninstall:
77 adb uninstall $(pkg)
79 .PHONY: run
80 run:
81 adb shell am start -n $(pkg)/$(act)
83 .PHONY: stop
84 stop:
85 adb shell am force-stop $(pkg)
87 AndroidManifest.xml: manifest.xml.in
88 android create project -p . -t $(android_platform) -k $(pkg) -a NativeActivity -n $(name)
89 cat manifest.xml.in | sed 's/$$APPNAME/$(name)/g' | sed 's/$$APPTITLE/$(title)/g' >$@
90 cd src && rm -f *.java && ln -s ../../src/android/*.java .
92 .PHONY: update-project
93 update-project: build.xml
94 android update project -p . -t $(android_platform)