3dphotoshoot

view android/Makefile @ 27:3d082c566b53

fixed all the bugs, pc version works
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 18 Jun 2015 04:32:25 +0300
parents a94af102872f
children
line source
1 root = ..
2 include $(root)/proj.mk
4 # --- android settings ---
5 android_platform = android-19
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)
68 rm -f assets/data assets/sdr
69 [ -d assets ] && rmdir assets || true
71 .PHONY: install
72 install: install-debug
74 .PHONY: install-debug
75 install-debug:
76 adb install -r $(apk-debug)
78 .PHONY: install-release
79 install-release:
80 adb install -r $(apk-release)
82 .PHONY: uninstall
83 uninstall:
84 adb uninstall $(pkg)
86 .PHONY: run
87 run:
88 adb shell am start -n $(pkg)/$(act)
90 .PHONY: stop
91 stop:
92 adb shell am force-stop $(pkg)
94 AndroidManifest.xml: manifest.xml.in
95 android create project -p . -t $(android_platform) -k $(pkg) -a NativeActivity -n $(name)
96 cat manifest.xml.in | sed 's/$$APPNAME/$(name)/g' | sed 's/$$APPTITLE/$(title)/g' >$@
97 cd src && rm -f *.java && ln -s ../../src/android/*.java .
99 .PHONY: update-project
100 update-project: build.xml
101 android update project -p . -t $(android_platform)
103 .PHONY: logcat
104 logcat:
105 adb logcat $(name):V AndroidRuntime:V DEBUG:V '*:S'