-
Notifications
You must be signed in to change notification settings - Fork 17
/
Makefile
117 lines (89 loc) · 3.31 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
.PHONY: all clean clean-native run release build prepare compile config-release config-restore refresh-core-plugin refresh-store-plugin urn
# non-versioned include
-include vars.mk
export SHELL := /bin/bash
export BUILD := build
mkdir = @mkdir -p $(dir $@)
MOBILE_VERSION = $(shell cat config.xml \
| grep '^<widget' \
| sed -E 's|^.*version="([^"]+)".*|\1|')
allcss = $(shell find ../js/css/ -name "*.css" \
| grep -v 'reset.css')
alljs = $(shell echo "../js/main.js" \
&& find ../js/{config,controllers,handlers,lib,models} -name "*.js" \
| grep -v '(ignore|\.thread\.)')
ANDROID_UNSIGNED = platforms/android/build/outputs/apk/android-armv7-release-unsigned.apk
ANDROID_SIGNED = platforms/android/build/outputs/apk/android-armv7-release.apk
ANDROID_NATIVE = $(shell find native/ -type f -name "*so" | sed 's|native/|platforms/android/libs/|')
all: www/index.html
platforms/android/libs/%/libturtl_core.so: native/%/libturtl_core.so
$(mkdir)
cp $^ $@
run: all $(ANDROID_NATIVE) www/cacert.js
./scripts/cordova.sh run android
platforms/android/release-signing.properties: scripts/release-signing.properties.tpl
cat $< \
| sed "s|{{ANDROID_SIGN_KEYSTORE}}|$(ANDROID_SIGN_KEYSTORE)|g" \
| sed "s|{{ANDROID_SIGN_ALIAS}}|$(ANDROID_SIGN_ALIAS)|g" \
> $@
release: BUILDFLAGS += --release
release: platforms/android/release-signing.properties config-release build config-restore
build: compile
compile: prepare
./scripts/cordova.sh compile android $(BUILDFLAGS)
prepare: all $(ANDROID_NATIVE) www/cacert.js
./scripts/cordova.sh prepare android $(BUILDFLAGS)
www/cacert.js: scripts/cacert.pem
@echo "- $@: $^"
@echo "var turtl_core_openssl_pem = [" > $@
@cat $^ | sed 's|^|"|g' | sed 's|$$|",|g' >> $@
@echo "].join('\n');" >> $@
config-release: all
@mkdir -p $(BUILD)
cp www/config.js $(BUILD)/config.js.tmp
cp www/config.live.js www/config.js
config-restore:
mv $(BUILD)/config.js.tmp www/config.js
www/app/index.html: $(alljs) $(allcss) ../js/index.html
$(mkdir)
@cd ../js && make
@echo "- rsync project: " $?
@rsync \
-azz \
--exclude=node_modules \
--exclude=.git \
--exclude=tests \
--delete \
--delete-excluded \
--checksum \
../js/ \
www/app
@touch $@
www/version.js: ./scripts/gen-index ./config.xml
@echo "- www/version.js: " $?
@echo "var cordova_app_version = '$(MOBILE_VERSION)';" > www/version.js
www/config-core.js: ../core/config.yaml.default
@echo -n "var turtl_core_config = " > $@
./node_modules/.bin/js-yaml $^ >> $@
# if the app's index changed, we know to change this one
www/index.html: www/app/index.html ./scripts/gen-index www/version.js www/config-core.js
@echo "- index.html: " $?
@./scripts/gen-index
refresh-core-plugin:
cordova plugin remove com.lyonbros.turtlcore
cordova plugin add bundle/cordova-plugin-turtl-core/
refresh-store-plugin:
cordova plugin remove com.lyonbros.turtlstore
cordova plugin add bundle/cordova-plugin-turtl-store/
refresh-share-plugin:
cordova plugin remove cc.fovea.cordova.openwith
cordova plugin add bundle/cordova-plugin-openwith/
urn:
@echo "Is there a Ralphs around here?"
clean:
rm -rf www/app www/config-core.js www/index.html www/version.js www/cacert.js
rm -rf $(BUILD)
rm -rf platforms/android/build platforms/android/CordovaLib/build
rm -f www/index.html
clean-native:
find native -name "*.so" -exec rm -f {} \;