-
Notifications
You must be signed in to change notification settings - Fork 99
Expand file tree
/
Copy pathMakefile
More file actions
168 lines (134 loc) · 7.15 KB
/
Makefile
File metadata and controls
168 lines (134 loc) · 7.15 KB
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
LSC ?= ./node_modules/.bin/lsc
PYTHON ?= python
run ::
gulp run
dev ::
gulp dev
build ::
gulp build
deps ::
npm i
gulp build
worker.js :: worker.ls
$(LSC) -c worker.ls
js/deps.js ::
gulp webpack:build
manifest :: js/deps.js
perl -pi -e 's/# [A-Z].*\n/# @{[`date`]}/m' manifest.appcache
upload ::
rsync -avzP server.* main.* view.* styles.css about.html index.html js root@moe0:code/
checkout ::
@if ! git ls-remote --exit-code https://github.com/g0v/moedict-data.git HEAD > /dev/null 2>&1; then echo "ERROR: 無法存取遠端 repo: https://github.com/g0v/moedict-data.git"; echo "請檢查網路連線、GitHub 可用性,或稍後重試。"; exit 1; fi
rm -rf moedict-data && git clone --depth 1 https://github.com/g0v/moedict-data.git
@if ! git ls-remote --exit-code https://github.com/g0v/moedict-data-twblg.git HEAD > /dev/null 2>&1; then echo "ERROR: 無法存取遠端 repo: https://github.com/g0v/moedict-data-twblg.git"; echo "請檢查網路連線、GitHub 可用性,或稍後重試。"; exit 1; fi
rm -rf moedict-data-twblg && git clone --depth 1 https://github.com/g0v/moedict-data-twblg.git
@if ! git ls-remote --exit-code https://github.com/g0v/moedict-data-hakka.git HEAD > /dev/null 2>&1; then echo "ERROR: 無法存取遠端 repo: https://github.com/g0v/moedict-data-hakka.git"; echo "請檢查網路連線、GitHub 可用性,或稍後重試。"; exit 1; fi
rm -rf moedict-data-hakka && git clone --depth 1 https://github.com/g0v/moedict-data-hakka.git
@if ! git ls-remote --exit-code https://github.com/g0v/moedict-data-csld.git HEAD > /dev/null 2>&1; then echo "ERROR: 無法存取遠端 repo: https://github.com/g0v/moedict-data-csld.git"; echo "請檢查網路連線、GitHub 可用性,或稍後重試。"; exit 1; fi
rm -rf moedict-data-csld && git clone --depth 1 https://github.com/g0v/moedict-data-csld.git
@if ! git ls-remote --exit-code https://github.com/g0v/moedict-epub.git HEAD > /dev/null 2>&1; then echo "ERROR: 無法存取遠端 repo: https://github.com/g0v/moedict-epub.git"; echo "請檢查網路連線、GitHub 可用性,或稍後重試。"; exit 1; fi
rm -rf moedict-epub && git clone https://github.com/g0v/moedict-epub.git
moedict-data :: checkout symlinks pinyin
MOEDICT_REVISED_XZ_URL ?= https://github.com/g0v/moedict-data/raw/refs/heads/master/dict-revised.json.xz
MOEDICT_REVISED_XZ := moedict-data/dict-revised.json.xz
MOEDICT_REVISED_JSON := moedict-data/dict-revised.json
$(MOEDICT_REVISED_XZ) ::
mkdir -p moedict-data
curl -fL "$(MOEDICT_REVISED_XZ_URL)" -o "$(MOEDICT_REVISED_XZ)"
$(MOEDICT_REVISED_JSON) :: $(MOEDICT_REVISED_XZ)
xz -dc "$(MOEDICT_REVISED_XZ)" > "$(MOEDICT_REVISED_JSON)"
dict-revised.pua.json :: $(MOEDICT_REVISED_JSON)
ln -fs "$(MOEDICT_REVISED_JSON)" dict-revised.pua.json
dict-twblg.json dict-twblg-ext.json ::
[ -d moedict-data-twblg ] || git clone --depth 1 https://github.com/g0v/moedict-data-twblg.git
ln -fs "moedict-data-twblg/$@" "$@"
dict-hakka.json ::
[ -d moedict-data-hakka ] || git clone --depth 1 https://github.com/g0v/moedict-data-hakka.git
ln -fs "moedict-data-hakka/$@" "$@"
dict-csld.json ::
[ -d moedict-data-csld ] || git clone --depth 1 https://github.com/g0v/moedict-data-csld.git
ln -fs "moedict-data-csld/$@" "$@"
offline :: $(MOEDICT_REVISED_JSON) deps
perl link2pack.pl a < a.txt
perl link2pack.pl t < t.txt
perl link2pack.pl h < h.txt
-perl link2pack.pl c < c.txt
perl special2pack.pl
full :: translation dict-twblg.json dict-twblg-ext.json dict-hakka.json deps worker.js
ln -fs "moedict-data/dict-revised-translated.json" dict-revised.pua.json
$(PYTHON) translation-data/csld2json.py
ln -fs "translation-data/csld-translation.json" dict-csld.json
$(LSC) json2prefix.ls a
$(LSC) autolink.ls a | perl sort-json.pl | env LC_ALL=C sort > a.txt
$(LSC) json2prefix.ls t
$(LSC) autolink.ls t | perl sort-json.pl | env LC_ALL=C sort > t.txt
$(LSC) json2prefix.ls h
$(LSC) autolink.ls h | perl sort-json.pl | env LC_ALL=C sort > h.txt
-$(LSC) json2prefix.ls c
-$(LSC) autolink.ls c | perl sort-json.pl | env LC_ALL=C sort > c.txt
perl link2pack.pl a < a.txt
perl link2pack.pl t < t.txt
perl link2pack.pl h < h.txt
-perl link2pack.pl c < c.txt
perl special2pack.pl
symlinks :: translation
ln -fs ../moedict-data/dict-revised-translated.json moedict-epub/dict-revised.json
cd moedict-epub && perl json2unicode.pl > dict-revised.unicode.json
cd moedict-epub && perl json2unicode.pl sym-pua.txt > dict-revised.pua.json
ln -fs moedict-epub/dict-revised.unicode.json dict-revised.unicode.json
ln -fs moedict-epub/dict-revised.pua.json dict-revised.pua.json
ln -fs moedict-data-twblg/dict-twblg.json dict-twblg.json
ln -fs moedict-data-twblg/dict-twblg-ext.json dict-twblg-ext.json
ln -fs moedict-data-hakka/dict-hakka.json dict-hakka.json
ln -fs moedict-data-csld/dict-csld.json dict-csld.json
offline-dev :: offline moedict-data deps translation
#lsc json2prefix.ls a
#lsc autolink.ls a | perl sort-json.pl | env LC_ALL=C sort > a.txt
#lsc json2prefix.ls t
#lsc autolink.ls t | perl sort-json.pl | env LC_ALL=C sort > t.txt
#lsc json2prefix.ls h
#lsc autolink.ls h | perl sort-json.pl | env LC_ALL=C sort > h.txt
#-lsc json2prefix.ls c
#-lsc autolink.ls c | perl sort-json.pl | env LC_ALL=C sort > c.txt
$(LSC) cat2special.ls
csld :: worker.js
$(PYTHON) translation-data/csld2json.py
cp translation-data/csld-translation.json dict-csld.json
$(LSC) json2prefix.ls c
$(LSC) autolink.ls c | perl sort-json.pl | env LC_ALL=C sort > c.txt
perl link2pack.pl c < c.txt
cp moedict-data-csld/index.json c/
hakka :: worker.js
$(LSC) json2prefix.ls h
$(LSC) autolink.ls h | perl sort-json.pl | env LC_ALL=C sort > h.txt
perl link2pack.pl h < h.txt
twblg :: worker.js
$(LSC) json2prefix.ls t
$(LSC) autolink.ls t | perl sort-json.pl | env LC_ALL=C sort > t.txt
perl link2pack.pl t < t.txt
$(PYTHON) twblg_index.py
pinyin ::
perl build-pinyin-lookup.pl a
perl build-pinyin-lookup.pl t
perl build-pinyin-lookup.pl h
perl build-pinyin-lookup.pl c
translation :: $(MOEDICT_REVISED_JSON) translation-data
$(PYTHON) translation-data/xml2txt.py
$(PYTHON) translation-data/txt2json.py
cp translation-data/moe-translation.json moedict-data/dict-revised-translated.json
translation-data :: translation-data/handedict.txt translation-data/cedict.txt translation-data/cfdict.xml
translation-data/handedict.txt :
# cd translation-data && curl -L http://www.handedict.de/handedict/handedict-20110528.tar.bz2 | tar -Oxvj -f - handedict-20110528/handedict_nb.u8 > handedict.txt
cd translation-data && curl -fL https://handedict.zydeo.net/api/export/download -o handedict.u8.gz && gzip -dc handedict.u8.gz > handedict.txt && rm -f handedict.u8.gz
translation-data/cedict.txt :
cd translation-data && curl -L https://www.mdbg.net/chinese/export/cedict/cedict_1_0_ts_utf-8_mdbg.txt.gz | gunzip > cedict.txt
translation-data/cfdict.xml :
cd translation-data && curl -L -O https://www.moedict.tw/translation-data/cfdict.xml
clean-translation-data ::
rm -f translation-data/cfdict.xml translation-data/cedict.txt translation-data/handedict.txt
all :: data/0/100.html
tar jxf data.tar.bz2
clean ::
git clean -xdf
emulate ::
make -C cordova emulate