1 # Makefile -- Makefile to generate charset maps in etc/charsets.
2 # Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
3 # National Institute of Advanced Industrial Science and Technology (AIST)
4 # Registration Number H13PRO009
6 # This file is part of GNU Emacs.
8 # GNU Emacs is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
13 # GNU Emacs is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
23 # If your system doesn't have the directory /usr/share/i18n/charmaps,
24 # get the source of the latest glibc, gzip all the charmap files in
25 # the directory "localedate/charmaps", and set the variable
26 # GLIBC_CHARMAPS to that directory.
28 GLIBC_CHARMAPS
=/usr
/share
/i18n
/charmaps
30 CHARSETS
= ${ISO8859} ${IBM} ${CODEPAGE} ${CJK} ${MISC} ${MULE}
32 # Note: We can not prepend "ISO-" to these map files because of file
35 8859-2.map
8859-3.map
8859-4.map
8859-5.map
8859-6.map
8859-7.map \
36 8859-8.map
8859-9.map
8859-10.map
8859-11.map
8859-13.map
8859-14.map \
37 8859-15.map
8859-16.map
40 IBM037.map IBM038.map \
41 IBM256.map IBM273.map IBM274.map IBM275.map IBM277.map IBM278.map \
42 IBM280.map IBM281.map IBM284.map IBM285.map IBM290.map IBM297.map \
43 IBM420.map IBM423.map IBM424.map IBM437.map IBM500.map IBM850.map \
44 IBM851.map IBM852.map IBM855.map IBM856.map IBM857.map IBM860.map \
45 IBM861.map IBM862.map IBM863.map IBM864.map IBM865.map IBM866.map \
46 IBM868.map IBM869.map IBM870.map IBM871.map IBM874.map IBM875.map \
47 IBM880.map IBM891.map IBM903.map IBM904.map IBM905.map IBM918.map \
48 IBM1004.map IBM1026.map IBM1047.map
51 CP737.map CP775.map CP1125.map\
52 CP1250.map CP1251.map CP1252.map CP1253.map CP1254.map \
53 CP1255.map CP1256.map CP1257.map CP1258.map \
57 CJK
= GB2312.map GBK.map GB180302.map GB180304.map \
58 BIG5.map BIG5-HKSCS.map\
59 CNS-1.map CNS-2.map CNS-3.map CNS-4.map CNS-5.map CNS-6.map CNS-7.map \
61 JISX0201.map JISX0208.map JISX0212.map JISX2131.map JISX2132.map \
62 JISC6226.map CP932-2BYTE.map JISX213A.map\
63 KSC5601.map KSC5636.map JOHAB.map
65 MISC
= KOI-8.map KOI8-R.map KOI8-U.map KOI8-T.map ALTERNATIVNYJ.map \
67 TIS-620.map VISCII.map VSCII.map VSCII-2.map\
68 KA-PS.map KA-ACADEMY.map \
69 HP-ROMAN8.map NEXTSTEP.map MACINTOSH.map EBCDICUK.map EBCDICUS.map \
70 stdenc.map symbol.map \
74 # Emacs-mule charsets.
75 MULE
= MULE-ethiopic.map MULE-ipa.map MULE-is13194.map \
76 MULE-sisheng.map MULE-tibetan.map \
77 MULE-lviscii.map MULE-uviscii.map
79 TRANS_TABLE
= cp51932.el eucjp-ms.el
80 SED_SCRIPT
= jisx2131-filter
82 all: ${CHARSETS} ${TRANS_TABLE}
86 # Rules for each charset
88 VSCII.map
: ${GLIBC_CHARMAPS}/TCVN5712-1.gz mapconv compact.awk
90 @.
/mapconv
$< '/^<.*[ ]\/x[0-9a-f].[ ]/' GLIBC-1 compact.awk
> $@
92 VSCII-2.map
: ${GLIBC_CHARMAPS}/TCVN5712-1.gz mapconv compact.awk
94 @.
/mapconv
$< '/^<.*[ ]\/x[2-7a-f].[ ]/' GLIBC-1 compact.awk \
95 | sed
's/0x20-0x7F.*/0x00-0x7F 0x0000/' > $@
97 ALTERNATIVNYJ.map
: IBM866.map
99 @echo
"# Modified from IBM866.map according to the chart at" > $@
100 @echo
"# http://www.cyrillic.com/ref/cyrillic/koi-8alt.html," >> $@
101 @echo
"# with guesses for the Unicodes of the glyphs." >> $@
103 -e
'/0xF2/ s/ .*/ 0x2019/' \
104 -e
'/0xF3/ s/ .*/ 0x2018/' \
105 -e
'/0xF4/ s/ .*/ 0x0301/' \
106 -e
'/0xF5/ s/ .*/ 0x0300/' \
107 -e
'/0xF6/ s/ .*/ 0x203A/' \
108 -e
'/0xF7/ s/ .*/ 0x2039/' \
109 -e
'/0xF8/ s/ .*/ 0x2191/' \
110 -e
'/0xF9/ s/ .*/ 0x2193/' \
111 -e
'/0xFA/ s/ .*/ 0x00B1/' \
112 -e
'/0xFB/ s/ .*/ 0x00F7/' < $< >> $@
114 MIK.map
: mapfiles
/bulgarian-mik.txt mapconv compact.awk
116 @.
/mapconv
$< '1,$$' CZYBORRA compact.awk
> $@
118 PTCP154.map
: mapfiles
/PTCP154 mapconv compact.awk
120 @.
/mapconv
$< '/^0x/' IANA compact.awk
> $@
122 stdenc.map
: mapfiles
/stdenc.txt mapconv compact.awk
124 @.
/mapconv
$< '/^[0-9A-Fa-f]/' UNICODE compact.awk
> $@
126 symbol.map
: mapfiles
/symbol.txt mapconv compact.awk
128 @.
/mapconv
$< '/^[0-9A-Fa-f]/' UNICODE compact.awk
> $@
130 CP720.map
: mapfiles
/CP720.map
134 CP858.map
: mapfiles
/CP858.map
138 CP949-2BYTE.map
: ${GLIBC_CHARMAPS}/CP949.gz mapconv compact.awk
140 @.
/mapconv
$< '/^<.*[ ]\/x[89a-f]/' GLIBC-2 compact.awk
> $@
142 GB2312.map
: ${GLIBC_CHARMAPS}/GB2312.gz mapconv compact.awk
144 @.
/mapconv
$< '/^<.*[ ]\/x[a-f]/' GLIBC-2-7 compact.awk
> $@
146 GBK.map
: ${GLIBC_CHARMAPS}/GBK.gz mapconv compact.awk
148 @.
/mapconv
$< '/^<.*[ ]\/x[89a-f]/' GLIBC-2 compact.awk
> $@
150 GB180302.map
: ${GLIBC_CHARMAPS}/GB18030.gz mapconv gb180302.awk
152 @.
/mapconv
$< '/^<.*[ ]\/x..\/x..[ ]/' GLIBC-2 gb180302.awk
> $@
154 GB180304.map
: GB180302.map gb180304.awk
156 @
$(AWK
) -f gb180304.awk
< $< > $@
158 JISX0201.map
: ${GLIBC_CHARMAPS}/JIS_X0201.gz mapconv compact.awk
160 @.
/mapconv
$< '/^<.*[ ]\/x[0-9]/' GLIBC-1 compact.awk
> $@
161 @echo
"# Generated by hand" >> $@
162 @echo
"0xA1-0xDF 0xFF61" >> $@
164 JISX0208.map
: ${GLIBC_CHARMAPS}/EUC-JP.gz mapconv
166 @.
/mapconv
$< '/^<.*[ ]\/x[a-f]/' GLIBC-2-7 \
167 | sed
's/0x2015/0x2014/' > $@
169 JISX0212.map
: ${GLIBC_CHARMAPS}/EUC-JP.gz mapconv compact.awk
171 @.
/mapconv
$< '/^<.*[ ]\/x8f/ s,/x8f,,' GLIBC-2-7 compact.awk
> $@
173 jisx2131-filter
: mapfiles
/JISX213A.map
174 @sed
-n
-e
'/^#/d' -e
's,.*0x\([0-9A-Z]*\)$$,/0x0*\1$$/d,p' < $< > $@
176 JISX2131.map
: ${GLIBC_CHARMAPS}/EUC-JISX0213.gz mapconv jisx2131-filter
178 @.
/mapconv
$< '/^<.*[ ]\/x[a-f]/' GLIBC-2-7 \
179 | sed
-f jisx2131-filter \
180 | sed
-e
's/0x2015/0x2014/' -e
's/0x2299/0x29BF/' > $@
182 JISX2132.map
: ${GLIBC_CHARMAPS}/EUC-JISX0213.gz mapconv
184 @.
/mapconv
$< '/^<.*[ ]\/x8f/ s,/x8f,,' GLIBC-2-7
> $@
186 JISX213A.map
: mapfiles
/JISX213A.map
190 CP932-2BYTE.map
: mapfiles
/CP932.TXT mapconv cp932.awk
192 @.
/mapconv
$< '/^0x[89A-F][0-9A-F][0-9A-F]/' UNICODE2 cp932.awk
> $@
194 cp51932.el
: CP932-2BYTE.map cp51932.awk
195 @
$(AWK
) -f cp51932.awk
< CP932-2BYTE.map
> $@
197 eucjp-ms.el
: ${GLIBC_CHARMAPS}/EUC-JP-MS.gz eucjp-ms.awk
198 @zcat
$< |
$(AWK
) -f eucjp-ms.awk
> $@
200 JISC6226.map
: mapfiles
/Uni2JIS mapconv kuten.awk
202 # As Uni2JIS doesn't contain mappings of characters added to Unicode
203 # recently, we add them manually here (including one correction for
204 # U+005C vs U+FF3C). These changes are based on bogytech's blog at
205 # http://bogytech.blogspot.jp/search/label/emacs.
206 @.
/mapconv
$< '/^[^#].*0-/' YASUOKA kuten.awk \
207 | sed
-e
'/0x2140/s/005C/FF3C/' \
208 -e
'$$ a 0x3442 0x3D4E' \
209 -e
'$$ a 0x374E 0x25874' \
210 -e
'$$ a 0x3764 0x28EF6' \
211 -e
'$$ a 0x513D 0x2F80F' \
212 -e
'$$ a 0x7045 0x9724' > $@
214 KSC5601.map
: ${GLIBC_CHARMAPS}/EUC-KR.gz mapconv compact.awk
216 @.
/mapconv
$< '/^<.*[ ]\/x[a-f]/' GLIBC-2-7 compact.awk
> $@
218 BIG5.map
: ${GLIBC_CHARMAPS}/BIG5.gz mapconv compact.awk
220 @.
/mapconv
$< '/^<.*[ ]\/x[a-f]/' GLIBC-2
> $@
222 BIG5-1.map
: BIG5.map mapconv big5.awk
224 @echo
"# Generated from $<" > $@
225 @sed
-n
-e
'/0xa140/,/0xc8fe/p' < $< | gawk
-f big5.awk
>> $@
227 BIG5-2.map
: BIG5.map mapconv big5.awk
229 @echo
"# Generated from $<" > $@
230 @sed
-n
-e
'/0xc940/,$$ p' < $< | gawk
-f big5.awk
>> $@
232 BIG5-HKSCS.map
: ${GLIBC_CHARMAPS}/BIG5-HKSCS.gz mapconv compact.awk
234 @.
/mapconv
$< '/^<.*[ ]\/x[89a-f].\//' GLIBC-2 compact.awk
> $@
236 JOHAB.map
: ${GLIBC_CHARMAPS}/JOHAB.gz mapconv compact.awk
238 @.
/mapconv
$< '/^<.*[ ]\/x[89a-f]/' GLIBC-2 compact.awk
> $@
240 CNS-1.map
: ${GLIBC_CHARMAPS}/EUC-TW.gz mapconv compact.awk
242 @.
/mapconv
$< '/^<.*[ ]\/x[a-f]/' GLIBC-2-7 compact.awk
> $@
244 # CNS-1.map: mapfiles/cns2ucsdkw.txt mapconv compact.awk
246 # @./mapconv $< '/^C1/' KANJI-DATABASE compact.awk > $@
248 CNS-2.map
: mapfiles
/cns2ucsdkw.txt mapconv compact.awk
250 @.
/mapconv
$< '/^C2/' KANJI-DATABASE compact.awk
> $@
252 CNS-3.map
: mapfiles
/cns2ucsdkw.txt mapconv compact.awk
254 @.
/mapconv
$< '/^C3/' KANJI-DATABASE compact.awk
> $@
256 CNS-4.map
: mapfiles
/cns2ucsdkw.txt mapconv compact.awk
258 @.
/mapconv
$< '/^C4/' KANJI-DATABASE compact.awk
> $@
260 CNS-5.map
: mapfiles
/cns2ucsdkw.txt mapconv compact.awk
262 @.
/mapconv
$< '/^C5/' KANJI-DATABASE compact.awk
> $@
264 CNS-6.map
: mapfiles
/cns2ucsdkw.txt mapconv compact.awk
266 @.
/mapconv
$< '/^C6/' KANJI-DATABASE compact.awk
> $@
268 CNS-7.map
: mapfiles
/cns2ucsdkw.txt mapconv compact.awk
270 @.
/mapconv
$< '/^C7/' KANJI-DATABASE compact.awk
> $@
272 CNS-F.map
: ${GLIBC_CHARMAPS}/EUC-TW.gz mapconv compact.awk
274 @.
/mapconv
$< '/^<.*\/x8e\/xaf/ s,/x8e/xaf,,' GLIBC-2-7 compact.awk
> $@
276 # General target to produce map files for mule charsets.
277 MULE-
%.map
: mapfiles
/MULE-
%.map
281 # General target to produce map files for ISO-8859, GEORGIAN, and
282 # EBCDIC charsets. We can not use the original file name because of
283 # file name limit on DOS. "KA" is ISO 639 language code for Georgian.
285 8859-%.map
: ${GLIBC_CHARMAPS}/ISO-8859-
%.gz mapconv compact.awk
287 @.
/mapconv
$< '/^<.*[ ]\/x/' GLIBC-1 compact.awk
> $@
289 KA-
%.map
: ${GLIBC_CHARMAPS}/GEORGIAN-
%.gz mapconv compact.awk
291 @.
/mapconv
$< '/^<.*[ ]\/x/' GLIBC-1 compact.awk
> $@
293 EBCDIC
%.map
: ${GLIBC_CHARMAPS}/EBCDIC-
%.gz mapconv compact.awk
295 @.
/mapconv
$< '/^<.*[ ]\/x/' GLIBC-1 compact.awk
> $@
297 # General target to produce map files for single-byte charsets.
299 %.map
: ${GLIBC_CHARMAPS}/%.gz mapconv compact.awk
301 @.
/mapconv
$< '/^<.*[ ]\/x/' GLIBC-1 compact.awk
> $@
304 @for f in
${CHARSETS}; do \
305 if
test -r
$$f; then \
306 if
! cmp
-s
$$f ..
/..
/etc
/charsets
/$$f; then \
308 cp
$$f ..
/..
/etc
/charsets
; \
312 @for f in
${TRANS_TABLE}; do \
313 if
test -r
$$f; then \
314 if
! cmp
-s
$$f ..
/..
/lisp
/international
/$$f; then \
316 cp
$$f ..
/..
/lisp
/international
; \
321 # Clear files that are automatically generated.
323 rm -f
${CHARSETS} ${TRANS_TABLE} ${SED_SCRIPT}