Makefile 16 KB

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