3dphotoshoot

view android/Makefile @ 3:9df99687a2ff

the old camera API is horrible
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 15 May 2015 05:15:47 +0300
parents a4bf2687e406
children 7f6e6eb3d20e
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 = -llog -landroid -lEGL -lGLESv1_CM
28 CFLAGS = -std=c99 -Wall -g -DAPP_NAME=\"$(name)\" -march=armv7-a -mfloat-abi=softfp \
29 $(android_inc) -I$(root)/src/android -I$(root)/src/gles $(incpaths)
30 LDFLAGS = -Wl,--fix-cortex-a8 -Wl,-z,defs $(android_libs) $(libpaths) -lm
32 .PHONY: debug
33 debug: $(apk-debug)
35 .PHONY: release
36 release: $(apk-release)
38 $(apk-debug): $(lib) $(jsrc) AndroidManifest.xml
39 ant debug
41 $(apk-release): $(lib) $(jsrc) AndroidManifest.xml
42 ant release
44 .PHONY: lib
45 lib: $(lib)
47 $(lib): $(obj)
48 @mkdir -p libs/armeabi
49 $(CC) -o $@ -shared $(obj) $(LDFLAGS)
51 ant_files = *.xml *.properties proguard-project.txt
52 ant_dirs = bin libs res obj src gen
54 .PHONY: clean
55 clean:
56 rm -f $(obj) $(lib) $(apk-release) $(apk-debug) $(ant_files)
57 rm -rf $(ant_dirs)
59 .PHONY: install
60 install: install-debug
62 .PHONY: install-debug
63 install-debug:
64 adb install -r $(apk-debug)
66 .PHONY: install-release
67 install-release:
68 adb install -r $(apk-release)
70 .PHONY: uninstall
71 uninstall:
72 adb uninstall $(pkg)
74 .PHONY: run
75 run:
76 adb shell am start -n $(pkg)/$(act)
78 .PHONY: stop
79 stop:
80 adb shell am force-stop $(pkg)
82 AndroidManifest.xml:
83 android create project -p . -t $(android_platform) -k $(pkg) -a NativeActivity -n $(name)
84 cat manifest.xml.in | sed 's/$$APPNAME/$(name)/g' | sed 's/$$APPTITLE/$(title)/g' >$@
85 cd src && rm -f *.java && ln -s ../../src/android/*.java .
87 .PHONY: update-project
88 update-project: build.xml
89 android update project -p . -t $(android_platform)