]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blob - includes/zhtable/Makefile
MediaWiki 1.15.0
[autoinstallsdev/mediawiki.git] / includes / zhtable / Makefile
1 #
2 # Creating the file ZhConversion.php used for Simplified/Traditional
3 # Chinese conversion. It gets the basic conversion table from the Unihan 
4 # database, and construct the phrase tables using phrase libraries in
5 # the SCIM packages and the libtabe package. There are also special
6 # tables used to for adjustment. 
7 #
8
9 GREP = LANG=zh_CN.UTF8 grep
10 SED = LANG=zh_CN.UTF8 sed
11 DIFF = LANG=zh_CN.UTF8 diff
12 CC ?= gcc
13
14 SF_MIRROR = easynews
15 SCIM_TABLES_VER = 0.5.9
16 SCIM_PINYIN_VER = 0.5.91
17 LIBTABE_VER = 0.2.3
18
19 # Installation directory
20 INSTDIR = /usr/local/share/zhdaemons/
21
22 all: ZhConversion.php tradphrases.notsure simpphrases.notsure wordlist toHans.dict toHant.dict toCN.dict toTW.dict toHK.dict toSG.dict
23
24 # Download Unihan database and Traditional Chinese / Simplified Chinese phrases files
25 Unihan.zip:
26         wget -nc ftp://ftp.unicode.org/Public/UNIDATA/Unihan.zip
27
28 scim-tables-$(SCIM_TABLES_VER).tar.gz:
29         wget -nc http://$(SF_MIRROR).dl.sourceforge.net/sourceforge/scim/scim-tables-$(SCIM_TABLES_VER).tar.gz
30
31 scim-pinyin-$(SCIM_PINYIN_VER).tar.gz:
32         wget -nc http://$(SF_MIRROR).dl.sourceforge.net/sourceforge/scim/scim-pinyin-$(SCIM_PINYIN_VER).tar.gz
33
34 libtabe-$(LIBTABE_VER).tgz:
35         wget -nc http://$(SF_MIRROR).dl.sourceforge.net/sourceforge/libtabe/libtabe-$(LIBTABE_VER).tgz
36
37 # Extract the file from a comressed files
38 Unihan.txt: Unihan.zip
39         unzip -oq Unihan.zip
40
41 EZ.txt.in: scim-tables-$(SCIM_TABLES_VER).tar.gz
42         tar -xzf scim-tables-$(SCIM_TABLES_VER).tar.gz -O scim-tables-$(SCIM_TABLES_VER)/tables/zh/EZ-Big.txt.in > EZ.txt.in
43
44 Wubi.txt.in: scim-tables-$(SCIM_TABLES_VER).tar.gz
45         tar -xzf scim-tables-$(SCIM_TABLES_VER).tar.gz -O scim-tables-$(SCIM_TABLES_VER)/tables/zh/Wubi.txt.in > Wubi.txt.in
46
47 Ziranma.txt.in: scim-tables-$(SCIM_TABLES_VER).tar.gz
48         tar -xzf scim-tables-$(SCIM_TABLES_VER).tar.gz -O scim-tables-$(SCIM_TABLES_VER)/tables/zh/Ziranma.txt.in > Ziranma.txt.in
49
50
51 phrase_lib.txt: scim-pinyin-$(SCIM_PINYIN_VER).tar.gz
52         tar -xzf scim-pinyin-$(SCIM_PINYIN_VER).tar.gz -O scim-pinyin-$(SCIM_PINYIN_VER)/data/phrase_lib.txt > phrase_lib.txt
53
54 tsi.src: libtabe-$(LIBTABE_VER).tgz     
55         tar -xzf libtabe-$(LIBTABE_VER).tgz -O libtabe/tsi-src/tsi.src > tsi.src
56
57 # Make a word list
58 wordlist: phrase_lib.txt EZ.txt.in tsi.src
59         iconv -c -f big5 -t utf8 tsi.src | $(SED) 's/# //g' | $(SED) 's/[ ][0-9].*//' > wordlist
60         $(SED) 's/\(.*\)\t[0-9][0-9]*.*/\1/' phrase_lib.txt | $(SED) '1,5d' >> wordlist
61         $(SED) '1,/BEGIN_TABLE/d' EZ.txt.in | colrm 1 8 | $(SED) 's/\t.*//' | $(GREP) "^...*" >> wordlist
62         sort wordlist | uniq | $(SED) 's/ //g' > t
63         mv t wordlist
64
65 printutf8: printutf8.c
66         $(CC) -o printutf8 printutf8.c
67
68 unihan.t2s.t: Unihan.txt printutf8
69         $(GREP) kSimplifiedVariant Unihan.txt | $(SED)  '/#/d' | $(SED)  's/kSimplifiedVariant//' | ./printutf8 > unihan.t2s.t
70
71 trad2simp.t: trad2simp.manual unihan.t2s.t
72         cp unihan.t2s.t tmp1
73         for I in `colrm 11 < trad2simp.manual` ; do $(SED) "/^$$I/d" tmp1 > tmp2; mv tmp2 tmp1; done
74         cat trad2simp.manual tmp1 > trad2simp.t
75
76 unihan.s2t.t: Unihan.txt printutf8
77         $(GREP) kTraditionalVariant Unihan.txt | $(SED)  '/#/d' | $(SED)  's/kTraditionalVariant//' | ./printutf8 > unihan.s2t.t
78
79 simp2trad.t: unihan.s2t.t simp2trad.manual
80         cp unihan.s2t.t tmp1
81         for I in `colrm 11 < simp2trad.manual` ; do $(SED) "/^$$I/d" tmp1 > tmp2; mv tmp2 tmp1; done
82         cat simp2trad.manual tmp1 > simp2trad.t
83
84 t2s_1tomany.t: trad2simp.t
85         $(GREP) -s ".\{19,\}" trad2simp.t | $(SED)  's/U+...../"/' | $(SED)  's/|U+...../"=>"/' | $(SED)  's/|U+.....//g' | $(SED)  's/|/",/' > t2s_1tomany.t
86
87 t2s_1to1.t: trad2simp.t s2t_1tomany.t
88         $(SED)  "/.*|.*|.*|.*/d" trad2simp.t | $(SED)  's/U+[0-9a-z][0-9a-z]*/"/' | $(SED)  's/|U+[0-9a-z][0-9a-z]*/"=>"/' | $(SED)  's/|/",/' > t2s_1to1.t
89         $(GREP)  '"."=>"..",' s2t_1tomany.t | $(SED) 's/\("."\)=>".\(.\)",/"\2"=>\1,/' >> t2s_1to1.t
90         $(GREP)  '"."=>"...",' s2t_1tomany.t | $(SED) 's/\("."\)=>".\(.\).",/"\2"=>\1,/' >> t2s_1to1.t
91         $(GREP)  '"."=>"...",' s2t_1tomany.t | $(SED) 's/\("."\)=>"..\(.\)",/"\2"=>\1,/' >> t2s_1to1.t
92         $(GREP)  '"."=>"....",' s2t_1tomany.t | $(SED) 's/\("."\)=>".\(.\)..",/"\2"=>\1,/' >> t2s_1to1.t
93         $(GREP)  '"."=>"....",' s2t_1tomany.t | $(SED) 's/\("."\)=>"..\(.\).",/"\2"=>\1,/' >> t2s_1to1.t
94         $(GREP)  '"."=>"....",' s2t_1tomany.t | $(SED) 's/\("."\)=>"...\(.\)",/"\2"=>\1,/' >> t2s_1to1.t
95         sort t2s_1to1.t | uniq > t
96         mv t t2s_1to1.t
97
98
99 s2t_1tomany.t: simp2trad.t
100         $(GREP) -s ".\{19,\}" simp2trad.t | $(SED)  's/U+...../"/' | $(SED)  's/|U+...../"=>"/' | $(SED)  's/|U+.....//g' | $(SED)  's/|/",/' > s2t_1tomany.t
101
102 s2t_1to1.t: simp2trad.t t2s_1tomany.t
103         $(SED)  "/.*|.*|.*|.*/d" simp2trad.t | $(SED)  's/U+[0-9a-z][0-9a-z]*/"/' | $(SED)  's/|U+[0-9a-z][0-9a-z]*/"=>"/' | $(SED)  's/|/",/' > s2t_1to1.t
104         $(GREP)  '"."=>"..",' t2s_1tomany.t | $(SED) 's/\("."\)=>".\(.\)",/"\2"=>\1,/' >> s2t_1to1.t
105         $(GREP)  '"."=>"...",' t2s_1tomany.t | $(SED) 's/\("."\)=>".\(.\).",/"\2"=>\1,/' >> s2t_1to1.t
106         $(GREP)  '"."=>"...",' t2s_1tomany.t | $(SED) 's/\("."\)=>"..\(.\)",/"\2"=>\1,/' >> s2t_1to1.t
107         $(GREP)  '"."=>"....",' t2s_1tomany.t | $(SED) 's/\("."\)=>".\(.\)..",/"\2"=>\1,/' >> s2t_1to1.t
108         $(GREP)  '"."=>"....",' t2s_1tomany.t | $(SED) 's/\("."\)=>"..\(.\).",/"\2"=>\1,/' >> s2t_1to1.t
109         $(GREP)  '"."=>"....",' t2s_1tomany.t | $(SED) 's/\("."\)=>"...\(.\)",/"\2"=>\1,/' >> s2t_1to1.t
110         sort s2t_1to1.t | uniq > t
111         mv t s2t_1to1.t
112
113 tphrase.t: EZ.txt.in tsi.src
114         colrm 1 8 < EZ.txt.in | $(SED) 's/\t//g' | $(GREP) "^.\{2,4\}[0-9]" | $(SED) 's/[0-9]//g' > t
115         iconv -c -f big5 -t utf8 tsi.src | $(SED) 's/ [0-9].*//g' | $(SED) 's/[# ]//g'| $(GREP) "^.\{2,4\}"  >> t
116         sort t | uniq > tphrase.t
117
118 alltradphrases.t: tphrase.t s2t_1tomany.t tradphrases_exclude.manual
119         for i in `cat s2t_1tomany.t | $(SED) 's/.*=>".//' | $(SED) 's/"//g' |$(SED) 's/,/\n/' | $(SED) 's/\(.\)/\1\n/g' |sort | uniq`; do $(GREP) -s $$i tphrase.t ; done  > alltradphrases.t || true
120         cat alltradphrases.t | $(GREP) -vf tradphrases_exclude.manual > alltradphrases.tt ; mv alltradphrases.tt alltradphrases.t
121
122
123 tradphrases_2.t: alltradphrases.t
124         cat alltradphrases.t | $(GREP)  "^..$$" | sort | uniq > tradphrases_2.t
125
126 tradphrases_3.t: alltradphrases.t
127         cat alltradphrases.t | $(GREP)  "^...$$" | sort | uniq > tradphrases_3.t
128         for i in `cat tradphrases_2.t`; do $(GREP) $$i tradphrases_3.t ; done | sort | uniq > t3 || true
129         $(DIFF) t3 tradphrases_3.t | $(GREP) ">" | $(SED) 's/> //' > t
130         mv t tradphrases_3.t
131
132
133 tradphrases_4.t: alltradphrases.t
134         cat alltradphrases.t | $(GREP)  "^....$$" | sort | uniq > tradphrases_4.t
135         for i in `cat tradphrases_2.t`; do $(GREP) $$i tradphrases_4.t ; done | sort | uniq > t3 || true
136         $(DIFF) t3 tradphrases_4.t | $(GREP) ">" | $(SED) 's/> //' > t
137         mv t tradphrases_4.t
138         for i in `cat tradphrases_3.t`; do $(GREP) $$i tradphrases_4.t ; done | sort | uniq > t3 || true
139         $(DIFF) t3 tradphrases_4.t | $(GREP) ">" | $(SED) 's/> //' > t
140         mv t tradphrases_4.t
141
142 tradphrases.t: tradphrases.manual tradphrases_2.t tradphrases_3.t tradphrases_4.t t2s_1tomany.t
143         cat tradphrases.manual tradphrases_2.t tradphrases_3.t tradphrases_4.t |sort | uniq > tradphrases.t
144         for i in `$(SED) 's/"\(.\).*/\1/' t2s_1tomany.t ` ; do $(GREP) $$i tradphrases.t ; done | $(DIFF) tradphrases.t - | $(GREP) '<' | $(SED) 's/< //' > t
145         for i in `$(SED) 's/"\(..\)..*/\1/' t2s_1tomany.t ` ; do $(GREP) $$i tradphrases.t ; done | $(DIFF) tradphrases.t - | $(GREP) '<' | $(SED) 's/< //' >> t
146         mv t tradphrases.t
147         cat tradphrases.t | sort | uniq > t
148         mv t tradphrases.t
149
150 tradphrases.notsure: tradphrases_2.t tradphrases_3.t tradphrases_4.t t2s_1tomany.t
151         cat tradphrases_2.t tradphrases_3.t tradphrases_4.t |sort | uniq > t
152         for i in `$(SED) 's/"\(.\).*/\1/' t2s_1tomany.t ` ; do $(GREP) $$i t; done | $(DIFF) t - | $(GREP) '>' | $(SED) 's/> //' > tradphrases.notsure
153
154
155 ph.t: phrase_lib.txt
156         $(SED) 's/[\t0-9a-zA-Z]//g' phrase_lib.txt | $(GREP) "^.\{2,4\}$$" > ph.t
157
158 Wubi.t: Wubi.txt.in
159         $(SED) '1,/BEGIN_TABLE/d' Wubi.txt.in | colrm 1 8 | $(SED) 's/\t.*//' | $(GREP) "^...*" > Wubi.t
160
161 Ziranma.t: Ziranma.txt.in
162         $(SED) '1,/BEGIN_TABLE/d' Ziranma.txt.in | colrm 1 8 | $(SED) 's/\t.*//' | $(GREP) "^...*" > Ziranma.t
163
164
165 allsimpphrases.t: t2s_1tomany.t ph.t Wubi.t Ziranma.t simpphrases_exclude.manual
166         rm -f allsimpphrases.t
167         for i in `cat t2s_1tomany.t | $(SED) 's/.*=>".//' | $(SED) 's/"//g' | $(SED) 's/,/\n/' | $(SED) 's/\(.\)/\1\n/g' | sort | uniq `; do $(GREP) $$i Wubi.t >> allsimpphrases.t; done
168         for i in `cat t2s_1tomany.t | $(SED) 's/.*=>".//' | $(SED) 's/"//g' | $(SED) 's/,/\n/' | $(SED) 's/\(.\)/\1\n/g' | sort | uniq `; do $(GREP) $$i Ziranma.t >> allsimpphrases.t; done
169         for i in `cat t2s_1tomany.t | $(SED) 's/.*=>".//' | $(SED) 's/"//g' | $(SED) 's/,/\n/' | $(SED) 's/\(.\)/\1\n/g' | sort | uniq `; do $(GREP) $$i ph.t >> allsimpphrases.t; done
170         cat allsimpphrases.t | $(GREP) -vf simpphrases_exclude.manual > allsimpphrases.tt ; mv allsimpphrases.tt allsimpphrases.t
171
172 simpphrases_2.t: allsimpphrases.t
173         cat allsimpphrases.t | $(GREP) "^..$$" | sort | uniq > simpphrases_2.t
174
175 simpphrases_3.t: allsimpphrases.t
176         cat allsimpphrases.t | $(GREP) "^...$$" | sort | uniq > simpphrases_3.t
177         for i in `cat simpphrases_2.t`; do $(GREP) $$i simpphrases_3.t ; done | sort | uniq > t3 || true
178         $(DIFF) t3 simpphrases_3.t | $(GREP) ">" | $(SED) 's/> //' > t
179         mv t simpphrases_3.t
180
181 simpphrases_4.t: allsimpphrases.t
182         cat allsimpphrases.t | $(GREP) "^....$$" | sort | uniq > simpphrases_4.t
183         rm -f t
184         for i in `cat simpphrases_2.t`; do $(GREP) $$i simpphrases_4.t >> t; done || true
185         sort t | uniq > t3
186         $(DIFF) t3 simpphrases_4.t | $(GREP) ">" | $(SED) 's/> //' > t
187         mv t simpphrases_4.t
188         for i in `cat simpphrases_3.t`; do $(GREP) $$i simpphrases_4.t; done | sort | uniq > t3 || true
189         $(DIFF) t3 simpphrases_4.t | $(GREP) ">" | $(SED) 's/> //' > t
190         mv t simpphrases_4.t
191
192 simpphrases.t: simpphrases.manual simpphrases_2.t simpphrases_3.t simpphrases_4.t t2s_1tomany.t
193         cat simpphrases.manual simpphrases_2.t simpphrases_3.t simpphrases_4.t > simpphrases.t
194         for i in `$(SED) 's/"\(.\).*/\1/' t2s_1tomany.t ` ; do $(GREP) $$i simpphrases.t ; done | $(DIFF) simpphrases.t - | $(GREP) '<' | $(SED) 's/< //' > t
195         for i in `$(SED) 's/"\(..\)..*/\1/' t2s_1tomany.t ` ; do $(GREP) $$i simpphrases.t ; done | $(DIFF) simpphrases.t - | $(GREP) '<' | $(SED) 's/< //' >> t
196         mv t simpphrases.t
197         cat simpphrases.t | sort | uniq > t
198         mv t simpphrases.t
199
200 simpphrases.notsure: simpphrases_2.t simpphrases_3.t simpphrases_4.t t2s_1tomany.t
201         cat simpphrases_2.t simpphrases_3.t simpphrases_4.t > t
202         for i in `$(SED) 's/"\(.\).*/\1/' t2s_1tomany.t ` ; do $(GREP) $$i t ; done | $(DIFF) t - | $(GREP) '>' | $(SED) 's/> //' > simpphrases.notsure
203
204 trad2simp1to1.t: t2s_1tomany.t t2s_1to1.t trad2simp_noconvert.manual
205         $(SED)  's/\(.......\).*/\1",/' t2s_1tomany.t > tt
206         colrm 1 7 < trad2simp.manual | colrm 3 > trad2simpcharsrc.t
207         colrm 1 17 < trad2simp.manual | colrm 3 > trad2simpchardest.t
208         cat trad2simpcharsrc.t | $(GREP) -f trad2simpchardest.t > trad2simprepeatedchar.t
209         cat tt | $(GREP) -vf trad2simprepeatedchar.t > trad2simp1to1.t
210         cat t2s_1to1.t >> trad2simp1to1.t
211         cat trad2simp1to1.t | $(GREP) -vf trad2simp_noconvert.manual > tt
212         mv tt trad2simp1to1.t
213
214 simp2trad1to1.t: s2t_1tomany.t s2t_1to1.t simp2trad.manual simp2trad_noconvert.manual
215         $(SED)  's/\(.......\).*/\1",/' s2t_1tomany.t > tt
216         colrm 1 7 < simp2trad.manual | colrm 3 > simp2tradcharsrc.t
217         colrm 1 17 < simp2trad.manual | colrm 3 > simp2tradchardest.t
218         cat simp2tradcharsrc.t | $(GREP) -f simp2tradchardest.t > simp2tradrepeatedchar.t
219         cat tt | $(GREP) -vf simp2tradrepeatedchar.t > simp2trad1to1.t
220         cat s2t_1to1.t >> simp2trad1to1.t
221         cat simp2trad1to1.t | $(GREP) -vf simp2trad_noconvert.manual > tt
222         mv tt simp2trad1to1.t
223
224 trad2simp.php: trad2simp1to1.t tradphrases.t trad2simp_supp_unset.manual trad2simp_supp_set.manual
225         printf '<?php\n$$trad2simp=array(' > trad2simp.php
226         cat trad2simp1to1.t >> trad2simp.php
227         $(SED) 's/\(.*\)\t\(.*\)/"\1" => "\2",/' trad2simp_supp_set.manual >> trad2simp.php
228         printf ');\n$$str=\n"' >> trad2simp.php
229         cat tradphrases.t >> trad2simp.php
230         printf '";\n$$t=strtr($$str, $$trad2simp);\necho $$t;\n?>' >> trad2simp.php
231         cat trad2simp1to1.t | $(GREP) -vf trad2simp_supp_unset.manual > tt
232         mv tt trad2simp1to1.t
233
234 simp2trad.php: simp2trad1to1.t simpphrases.t simp2trad_supp_set.manual
235         printf '<?php\n$$simp2trad=array(' > simp2trad.php
236         cat simp2trad1to1.t >> simp2trad.php
237         $(SED) 's/\(.*\)\t\(.*\)/"\1" => "\2",/' simp2trad_supp_set.manual >> simp2trad.php
238         printf ');\n$$str=\n"' >> simp2trad.php
239         cat simpphrases.t >> simp2trad.php
240         printf '";\n$$t=strtr($$str, $$simp2trad);\necho $$t;\n?>' >> simp2trad.php
241
242 simp2trad.phrases.t: trad2simp.php tradphrases.t simp2trad_supp_set.manual
243         php -f trad2simp.php | $(SED)  's/\(.*\)/"\1" => /' > tmp1
244         cat tradphrases.t | $(SED)  's/\(.*\)/"\1",/' > tmp2
245         paste tmp1 tmp2 > simp2trad.phrases.t
246         colrm 3 < simp2trad_supp_set.manual > simp2trad_supp_noconvert.t
247         cat trad2simp.php | $(GREP) -vf simp2trad_supp_noconvert.t > trad2simp.tt
248         mv trad2simp.tt trad2simp.php
249
250 trad2simp.phrases.t: simp2trad.php simpphrases.t trad2simp_supp_set.manual
251         php -f simp2trad.php | $(SED)  's/\(.*\)/"\1" => /' > tmp1
252         cat simpphrases.t | $(SED)  's/\(.*\)/"\1",/' > tmp2
253         paste tmp1 tmp2 > trad2simp.phrases.t
254         colrm 3 < trad2simp_supp_set.manual > trad2simp_supp_noconvert.t
255         cat simp2trad.php | $(GREP) -vf trad2simp_supp_noconvert.t > simp2trad.tt
256         mv simp2trad.tt simp2trad.php
257
258 toHans.dict: trad2simp1to1.t trad2simp.phrases.t toSimp.manual
259         cat trad2simp1to1.t | $(SED) 's/[, \t]//g' | $(SED) 's/=>/\t/' > toHans.dict
260         cat trad2simp.phrases.t | $(SED) 's/[, \t]//g' | $(SED) 's/=>/\t/' >> toHans.dict
261         cat toSimp.manual | $(SED) 's/ //g' | $(SED) 's/\(^.*\)\t\(.*\)/"\1"\t"\2"/' >> toHans.dict
262
263 toHant.dict: simp2trad1to1.t simp2trad.phrases.t toTrad.manual
264         cat simp2trad1to1.t | $(SED) 's/[, \t]//g' | $(SED) 's/=>/\t/' > toHant.dict
265         cat simp2trad.phrases.t | $(SED) 's/[, \t]//g' | $(SED) 's/=>/\t/' >> toHant.dict
266         cat toTrad.manual | $(SED) 's/ //g' | $(SED) 's/\(^.*\)\t\(.*\)/"\1"\t"\2"/' >> toHant.dict
267
268 toTW.dict: toTW.manual
269         cat toTW.manual | $(SED) 's/ //g' | $(SED) 's/\(^.*\)\t\(.*\)/"\1"\t"\2"/' > toTW.dict
270
271 toHK.dict: toHK.manual
272         cat toHK.manual | $(SED) 's/ //g' | $(SED) 's/\(^.*\)\t\(.*\)/"\1"\t"\2"/' > toHK.dict
273
274 toCN.dict: toCN.manual
275         cat toCN.manual | $(SED) 's/ //g' | $(SED) 's/\(^.*\)\t\(.*\)/"\1"\t"\2"/' > toCN.dict
276
277 toSG.dict: toSG.manual
278         cat toSG.manual | $(SED) 's/ //g' | $(SED) 's/\(^.*\)\t\(.*\)/"\1"\t"\2"/' > toSG.dict
279
280 ZhConversion.php: simp2trad1to1.t simp2trad.phrases.t trad2simp1to1.t trad2simp.phrases.t toSimp.manual toTrad.manual toCN.manual toHK.manual toSG.manual toTW.manual
281         printf '<?php\n/**\n * Simplified / Traditional Chinese conversion tables\n' > ZhConversion.php
282         printf ' *\n * Automatically generated using code and data in includes/zhtable/\n' >> ZhConversion.php
283         printf ' * Do not modify directly!\n */\n\n' >> ZhConversion.php
284         printf '$$zh2Hant = array(\n' >> ZhConversion.php
285         cat simp2trad1to1.t >> ZhConversion.php
286         echo >> ZhConversion.php
287         cat simp2trad.phrases.t >> ZhConversion.php
288         $(SED) 's/\(.*\)\t\(.*\)/"\1" => "\2",/' toTrad.manual >> ZhConversion.php
289         echo ');' >> ZhConversion.php
290         echo >> ZhConversion.php
291         printf '$$zh2Hans = array(\n' >> ZhConversion.php
292         cat trad2simp1to1.t >> ZhConversion.php
293         echo >> ZhConversion.php
294         cat trad2simp.phrases.t >> ZhConversion.php
295         $(SED) 's/\(.*\)\t\(.*\)/"\1" => "\2",/' toSimp.manual >> ZhConversion.php
296         echo ');' >> ZhConversion.php
297         echo >> ZhConversion.php
298         printf '$$zh2TW = array(\n' >> ZhConversion.php
299         $(SED) 's/\(.*\)\t\(.*\)/"\1" => "\2",/' toTW.manual >> ZhConversion.php
300         echo ');' >> ZhConversion.php
301         echo >> ZhConversion.php
302         printf '$$zh2HK = array(\n' >> ZhConversion.php
303         $(SED) 's/\(.*\)\t\(.*\)/"\1" => "\2",/' toHK.manual >> ZhConversion.php
304         echo ');' >> ZhConversion.php
305         echo >> ZhConversion.php
306         printf '$$zh2CN = array(\n' >> ZhConversion.php
307         $(SED) 's/\(.*\)\t\(.*\)/"\1" => "\2",/' toCN.manual >> ZhConversion.php
308         echo ');' >> ZhConversion.php
309         echo >> ZhConversion.php
310         printf '$$zh2SG = array(\n' >> ZhConversion.php
311         $(SED) 's/\(.*\)\t\(.*\)/"\1" => "\2",/' toSG.manual >> ZhConversion.php
312         echo >> ZhConversion.php
313         printf ');' >> ZhConversion.php
314
315 clean: cleantmp cleandl
316
317 cleantmp:
318         # Stuff unpacked from the files fetched by wget
319         rm -f \
320                 Unihan.txt \
321                 EZ.txt.in \
322                 Wubi.txt.in \
323                 Ziranma.txt.in \
324                 phrase_lib.txt \
325                 tsi.src
326         # Temporary files and other trash
327         rm -f ZhConversion.php tmp1 tmp2 tmp3 t3 *.t trad2simp.php simp2trad.php *.dict printutf8 *~ \
328                 simpphrases.notsure tradphrases.notsure wordlist
329
330 cleandl:
331         rm -f \
332                 Unihan.zip \
333                 scim-tables-$(SCIM_TABLES_VER).tar.gz \
334                 scim-pinyin-$(SCIM_PINYIN_VER).tar.gz \
335                 libtabe-$(LIBTABE_VER).tgz
336