-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
137 lines (112 loc) · 3.98 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/usr/bin/make -f
# coding: utf-8
#
# @(#) Makefile for GNU Make
#
# USAGE
#
# export PATH="$PATH:/path-to-android-sdk/tools"
# export PATH="$PATH:$JAVA_HOME/bin"
#
# make all
#
# make release
# make debug # optional
#
# DESCRIPTION
#
# We use this file in order to:
#
# 1. generate the sqlite database from yaml source
# 2. build Android binary packages
#
# You can use Eclipse to do (2.), but
# you still need to use this Makefile to do (1.) in Linux
#
# RUNNING THE COMMAND-LINE ANDROID EMULATOR
#
# Create an Android device with name "FamilyBrowser_avd":
# shell> android
# # goto Virtual Devices > New
# # create new device FamilyBrowser_avd for Platform 1.6
# Start the Android emulator:
# shell> emulator -avd FamilyBrowser_avd &
# # creates a window with title "5554:FamilyBrowser_avd"
# Install $(APK_DIRECTORY)/FamilyBrowser-debug.apk into the emulator:
# shell> adb install $(APK_DIRECTORY)/FamilyBrowser-debug.apk
#
_DROID_APP_NAME ?= FamilyBrowser
_DROID_APP_PACKAGE ?= ca.chaves.familyBrowser
_DROID_APP_VERSION ?= 2
_DROID_APP_KEYSTORE ?= share/certs/$(_DROID_APP_NAME).keystore
_DROID_TEST_NAME := $(_DROID_APP_NAME)Test
_DROID_TEST_PACKAGE := $(_DROID_APP_PACKAGE).test
# id 4 = Android 1.6 (API level 4)
_DROID_SDK_VERSION ?= 4
# where the final .apk files are created (inside test/, main/)
# Ant will use "build/", Eclipse will use "bin/"
#APK_DIRECTORY := build
APK_DIRECTORY := bin
#--------------------------------------- phony targets
all : release debug
clean :
bash share/tools/build_app.bash clean
clobber :
bash share/tools/build_app.bash clobber
# build a debug package
debug : \
main/$(APK_DIRECTORY)/$(_DROID_APP_NAME)-debug.apk \
test/$(APK_DIRECTORY)/$(_DROID_TEST_NAME)-debug.apk
# build a release package
release : \
main/$(APK_DIRECTORY)/$(_DROID_APP_NAME)-release.apk \
test/$(APK_DIRECTORY)/$(_DROID_TEST_NAME)-release.apk
@cp -f main/$(APK_DIRECTORY)/$(_DROID_APP_NAME)-release.apk $(_DROID_APP_NAME).apk
@echo "Upload $(_DROID_APP_NAME).apk to https://market.android.com/details?id=ca.chaves.familyBrowser"
.PHONY : all debug release clean clobber
#--------------------------------------- generated sources
sources : \
android/jni/ca_chaves_android_util_POSIX.hpp
android/jni/ca_chaves_android_util_POSIX.hpp : debug
javah -classpath android/bin/classes/ \
-o android/jni/ca_chaves_android_util_POSIX.hpp \
ca.chaves.android.util.POSIX
# remove trailing blanks - I do not like them
remove-trailing-blanks :
sed -i -e "s/\s*$$//" Makefile
find . \
-name \*.java \
-o -name \*.xml \
-o -name \*.yaml \
-o -name \*.py \
-o -name \*.txt \
| xargs -r sed -i -e "s/\s*$$//"
.PHONY : sources remove-trailing-blanks
#--------------------------------------- file targets
main/build.xml main/project.properties main/local.properties \
test/build.xml test/project.properties test/local.properties :
bash share/tools/build_app.bash init
main/$(APK_DIRECTORY)/$(_DROID_APP_NAME)-release.apk \
test/$(APK_DIRECTORY)/$(_DROID_TEST_NAME)-release.apk : \
$(_DROID_APP_KEYSTORE) \
main/tarball/databases/v$(_DROID_APP_VERSION).db
bash share/tools/build_app.bash release
main/$(APK_DIRECTORY)/$(_DROID_APP_NAME)-debug.apk \
test/$(APK_DIRECTORY)/$(_DROID_TEST_NAME)-debug.apk : \
$(_DROID_APP_KEYSTORE) \
main/tarball/databases/v$(_DROID_APP_VERSION).db
bash share/tools/build_app.bash debug
# process familyTree.yaml
main/tarball/databases/v$(_DROID_APP_VERSION).db : \
familyTree.yaml \
share/tools/familyTree_yaml.py
bash share/tools/build_app.bash database
# create keystore for signing release packages
$(_DROID_APP_KEYSTORE) :
bash share/tools/build_app.bash keystore
.NOTPARALLEL : \
main/$(APK_DIRECTORY)/$(_DROID_APP_NAME)-debug.apk \
main/$(APK_DIRECTORY)/$(_DROID_APP_NAME)-release.apk \
test/$(APK_DIRECTORY)/$(_DROID_TEST_NAME)-debug.apk \
test/$(APK_DIRECTORY)/$(_DROID_TEST_NAME)-release.apk
#--------------------------------------- The End