3 # Copyright (C) 2015-2016 Free Software Foundation, Inc.
5 # Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
6 # National Institute of Advanced Industrial Science and Technology (AIST)
7 # Registration Number H13PRO009
9 # This file is part of GNU Emacs.
11 # GNU Emacs is free software: you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation, either version 3 of the License, or
14 # (at your option) any later version.
16 # GNU Emacs is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
26 # Generate charset maps in etc/charsets.
33 top_srcdir
= @top_srcdir@
35 charsetdir
= ${top_srcdir}/etc
/charsets
36 lispintdir
= ${top_srcdir}/lisp
/international
37 mapfiledir
= ${srcdir}/mapfiles
39 GLIBC_CHARMAPS
= ${srcdir}/glibc
41 AM_DEFAULT_VERBOSITY
= @AM_DEFAULT_VERBOSITY@
42 AM_V_GEN
= $(am__v_GEN_@AM_V@
)
43 am__v_GEN_
= $(am__v_GEN_@AM_DEFAULT_V@
)
44 am__v_GEN_0
= @echo
" GEN " $@
;
47 AM_V_at
= $(am__v_at_@AM_V@
)
48 am__v_at_
= $(am__v_at_@AM_DEFAULT_V@
)
52 # Note: We can not prepend "ISO-" to these map files because of file
55 8859-2.map
8859-3.map
8859-4.map
8859-5.map
8859-6.map
8859-7.map \
56 8859-8.map
8859-9.map
8859-10.map
8859-11.map
8859-13.map
8859-14.map \
57 8859-15.map
8859-16.map
60 IBM037.map IBM038.map \
61 IBM256.map IBM273.map IBM274.map IBM275.map IBM277.map IBM278.map \
62 IBM280.map IBM281.map IBM284.map IBM285.map IBM290.map IBM297.map \
63 IBM420.map IBM423.map IBM424.map IBM437.map IBM500.map IBM850.map \
64 IBM851.map IBM852.map IBM855.map IBM856.map IBM857.map IBM860.map \
65 IBM861.map IBM862.map IBM863.map IBM864.map IBM865.map IBM866.map \
66 IBM868.map IBM869.map IBM870.map IBM871.map IBM874.map IBM875.map \
67 IBM880.map IBM891.map IBM903.map IBM904.map IBM905.map IBM918.map \
68 IBM1004.map IBM1026.map IBM1047.map
71 CP737.map CP775.map CP1125.map\
72 CP1250.map CP1251.map CP1252.map CP1253.map CP1254.map \
73 CP1255.map CP1256.map CP1257.map CP1258.map \
77 CJK
= GB2312.map GBK.map GB180302.map GB180304.map \
78 BIG5.map BIG5-HKSCS.map\
79 CNS-1.map CNS-2.map CNS-3.map CNS-4.map CNS-5.map CNS-6.map CNS-7.map \
81 JISX0201.map JISX0208.map JISX0212.map JISX2131.map JISX2132.map \
82 JISC6226.map CP932-2BYTE.map JISX213A.map\
83 KSC5601.map KSC5636.map JOHAB.map
85 MISC
= KOI-8.map KOI8-R.map KOI8-U.map KOI8-T.map ALTERNATIVNYJ.map \
87 TIS-620.map VISCII.map VSCII.map VSCII-2.map\
88 KA-PS.map KA-ACADEMY.map \
89 HP-ROMAN8.map NEXTSTEP.map MACINTOSH.map EBCDICUK.map EBCDICUS.map \
90 stdenc.map symbol.map \
94 # Emacs-mule charsets.
95 MULE
= MULE-ethiopic.map MULE-ipa.map MULE-is13194.map \
96 MULE-sisheng.map MULE-tibetan.map \
97 MULE-lviscii.map MULE-uviscii.map
99 SED_SCRIPT
= jisx2131-filter
101 TRANS_TABLE
= cp51932.el eucjp-ms.el
102 TRANS_TABLE
:= $(addprefix ${lispintdir}/,${TRANS_TABLE})
104 CHARSETS
= ${ISO8859} ${IBM} ${CODEPAGE} ${CJK} ${MISC} ${MULE}
105 CHARSETS
:= $(addprefix ${charsetdir}/,${CHARSETS})
109 all: ${srcdir}/charsets.stamp
111 ${srcdir}/charsets.stamp
: ${CHARSETS} ${TRANS_TABLE}
112 ${AM_V_GEN}echo timestamp
> $@
114 ## Rules for each charset.
116 mapconv
= ${srcdir}/mapconv
117 run_mapconv
= AWK
=${AWK} ${srcdir}/mapconv
118 big5
= ${srcdir}/big5.awk
119 compact
= ${srcdir}/compact.awk
120 cp51932
= ${srcdir}/cp51932.awk
121 cp932
= ${srcdir}/cp932.awk
122 eucjp_ms
= ${srcdir}/eucjp-ms.awk
123 gb180302
= ${srcdir}/gb180302.awk
124 gb180304
= ${srcdir}/gb180304.awk
125 kuten
= ${srcdir}/kuten.awk
127 ## Short aliases, eg VSCII.map = ${charsetdir}/VSCII.map
129 .PHONY
: $(notdir ${1})
133 $(foreach mfile
,${CHARSETS} ${TRANS_TABLE},$(eval
$(call map_template
,$(mfile
))))
135 ${charsetdir}/VSCII.map
: ${GLIBC_CHARMAPS}/TCVN5712-1.gz
${mapconv} ${compact}
136 ${AM_V_GEN}${run_mapconv} $< '/^<.*[ ]\/x[0-9a-f].[ ]/' GLIBC-1
${compact} > $@
138 ${charsetdir}/VSCII-2.map
: ${GLIBC_CHARMAPS}/TCVN5712-1.gz
${mapconv} ${compact}
139 ${AM_V_GEN}${run_mapconv} $< '/^<.*[ ]\/x[2-7a-f].[ ]/' GLIBC-1
${compact} \
140 | sed
's/0x20-0x7F.*/0x00-0x7F 0x0000/' > $@
142 ${charsetdir}/ALTERNATIVNYJ.map
: ${charsetdir}/IBM866.map
143 ${AM_V_GEN}(echo
"# Modified from $(notdir $<) according to the chart at" && \
144 echo
"# http://www.cyrillic.com/ref/cyrillic/koi-8alt.html," && \
145 echo
"# with guesses for the Unicodes of the glyphs." && \
147 -e
'/0xF2/ s/ .*/ 0x2019/' \
148 -e
'/0xF3/ s/ .*/ 0x2018/' \
149 -e
'/0xF4/ s/ .*/ 0x0301/' \
150 -e
'/0xF5/ s/ .*/ 0x0300/' \
151 -e
'/0xF6/ s/ .*/ 0x203A/' \
152 -e
'/0xF7/ s/ .*/ 0x2039/' \
153 -e
'/0xF8/ s/ .*/ 0x2191/' \
154 -e
'/0xF9/ s/ .*/ 0x2193/' \
155 -e
'/0xFA/ s/ .*/ 0x00B1/' \
156 -e
'/0xFB/ s/ .*/ 0x00F7/' < $< ) > $@
158 ${charsetdir}/MIK.map
: ${mapfiledir}/bulgarian-mik.txt
${mapconv} ${compact}
159 ${AM_V_GEN}${run_mapconv} $< '1,$$' CZYBORRA
${compact} > $@
161 ${charsetdir}/PTCP154.map
: ${mapfiledir}/PTCP154
${mapconv} ${compact}
162 ${AM_V_GEN}${run_mapconv} $< '/^0x/' IANA
${compact} > $@
164 ${charsetdir}/stdenc.map
: ${mapfiledir}/stdenc.txt
${mapconv} ${compact}
165 ${AM_V_GEN}${run_mapconv} $< '/^[0-9A-Fa-f]/' UNICODE
${compact} > $@
167 ${charsetdir}/symbol.map
: ${mapfiledir}/symbol.txt
${mapconv} ${compact}
168 ${AM_V_GEN}${run_mapconv} $< '/^[0-9A-Fa-f]/' UNICODE
${compact} > $@
170 ${charsetdir}/CP720.map
: ${mapfiledir}/CP720.map
173 ${charsetdir}/CP858.map
: ${mapfiledir}/CP858.map
176 ${charsetdir}/CP949-2BYTE.map
: ${GLIBC_CHARMAPS}/CP949.gz
${mapconv} ${compact}
177 ${AM_V_GEN}${run_mapconv} $< '/^<.*[ ]\/x[89a-f]/' GLIBC-2
${compact} > $@
179 ${charsetdir}/GB2312.map
: ${GLIBC_CHARMAPS}/GB2312.gz
${mapconv} ${compact}
180 ${AM_V_GEN}${run_mapconv} $< '/^<.*[ ]\/x[a-f]/' GLIBC-2-7
${compact} > $@
182 ${charsetdir}/GBK.map
: ${GLIBC_CHARMAPS}/GBK.gz
${mapconv} ${compact}
183 ${AM_V_GEN}${run_mapconv} $< '/^<.*[ ]\/x[89a-f]/' GLIBC-2
${compact} > $@
185 ${charsetdir}/GB180302.map
: ${GLIBC_CHARMAPS}/GB18030.gz
${mapconv} ${gb180302}
186 ${AM_V_GEN}${run_mapconv} $< '/^<.*[ ]\/x..\/x..[ ]/' GLIBC-2
${gb180302} > $@
188 ${charsetdir}/GB180304.map
: ${charsetdir}/GB180302.map
${gb180304}
189 ${AM_V_GEN}$(AWK
) -f
${gb180304} < $< > $@
191 ${charsetdir}/JISX0201.map
: ${GLIBC_CHARMAPS}/JIS_X0201.gz
${mapconv} ${compact}
192 ${AM_V_GEN}(${mapconv} $< '/^<.*[ ]\/x[0-9]/' GLIBC-1
${compact} && \
193 echo
"# Generated by hand" && \
194 echo
"0xA1-0xDF 0xFF61" ) > $@
196 ${charsetdir}/JISX0208.map
: ${GLIBC_CHARMAPS}/EUC-JP.gz
${mapconv}
197 ${AM_V_GEN}${run_mapconv} $< '/^<.*[ ]\/x[a-f]/' GLIBC-2-7 \
198 | sed
's/0x2015/0x2014/' > $@
200 ${charsetdir}/JISX0212.map
: ${GLIBC_CHARMAPS}/EUC-JP.gz
${mapconv} ${compact}
201 ${AM_V_GEN}${run_mapconv} $< '/^<.*[ ]\/x8f/ s,/x8f,,' GLIBC-2-7
${compact} > $@
203 jisx2131-filter
: ${mapfiledir}/JISX213A.map
204 ${AM_V_at}sed
-n
-e
'/^#/d' -e
's,.*0x\([0-9A-Z]*\)$$,/0x0*\1$$/d,p' < $< > $@
206 ${charsetdir}/JISX2131.map
: ${GLIBC_CHARMAPS}/EUC-JISX0213.gz
${mapconv} jisx2131-filter
207 ${AM_V_GEN}${run_mapconv} $< '/^<.*[ ]\/x[a-f]/' GLIBC-2-7 \
208 | sed
-f jisx2131-filter \
209 | sed
-e
's/0x2015/0x2014/' -e
's/0x2299/0x29BF/' > $@
211 ${charsetdir}/JISX2132.map
: ${GLIBC_CHARMAPS}/EUC-JISX0213.gz
${mapconv}
212 ${AM_V_GEN}${run_mapconv} $< '/^<.*[ ]\/x8f/ s,/x8f,,' GLIBC-2-7
> $@
214 ${charsetdir}/JISX213A.map
: ${mapfiledir}/JISX213A.map
217 ${charsetdir}/CP932-2BYTE.map
: ${mapfiledir}/CP932.TXT
${mapconv} ${cp932}
218 ${AM_V_GEN}${run_mapconv} $< '/^0x[89A-F][0-9A-F][0-9A-F]/' UNICODE2
${cp932} > $@
220 ${lispintdir}/cp51932.el
: ${charsetdir}/CP932-2BYTE.map
${cp51932}
221 ${AM_V_GEN}$(AWK
) -f
${cp51932} < $< > $@
223 ${lispintdir}/eucjp-ms.el
: ${GLIBC_CHARMAPS}/EUC-JP-MS.gz
${eucjp_ms}
224 ${AM_V_GEN}gunzip
-c
$< |
$(AWK
) -f
${eucjp_ms} > $@
226 # As Uni2JIS doesn't contain mappings of characters added to Unicode
227 # recently, we add them manually here (including one correction for
228 # U+005C vs U+FF3C). These changes are based on bogytech's blog at
229 # http://bogytech.blogspot.jp/search/label/emacs.
230 ${charsetdir}/JISC6226.map
: ${mapfiledir}/Uni2JIS
${mapconv} ${kuten}
231 ${AM_V_GEN}(${run_mapconv} $< '/^[^#].*0-/' YASUOKA
${kuten} \
232 | sed
-e
'/0x2140/s/005C/FF3C/' && \
233 echo
'0x3442 0x3D4E' && echo
'0x374E 0x25874' && \
234 echo
'0x3764 0x28EF6' && echo
'0x513D 0x2F80F' && \
235 echo
'0x7045 0x9724' ) > $@
237 ${charsetdir}/KSC5601.map
: ${GLIBC_CHARMAPS}/EUC-KR.gz
${mapconv} ${compact}
238 ${AM_V_GEN}${run_mapconv} $< '/^<.*[ ]\/x[a-f]/' GLIBC-2-7
${compact} > $@
240 ${charsetdir}/BIG5.map
: ${GLIBC_CHARMAPS}/BIG5.gz
${mapconv} ${compact}
241 ${AM_V_GEN}${run_mapconv} $< '/^<.*[ ]\/x[a-f]/' GLIBC-2
> $@
243 ${charsetdir}/BIG5-1.map
: ${charsetdir}/BIG5.map
${mapconv} ${big5}
244 ${AM_V_GEN}(echo
"# Generated from $(notdir $<)" && \
245 sed
-n
-e
'/0xa140/,/0xc8fe/p' < $< |
$(AWK
) -f
${big5} ) > $@
247 ${charsetdir}/BIG5-2.map
: ${charsetdir}/BIG5.map
${mapconv} ${big5}
248 ${AM_V_GEN}(echo
"# Generated from $(notdir $<)" && \
249 sed
-n
-e
'/0xc940/,$$ p' < $< |
$(AWK
) -f
${big5} ) > $@
251 ${charsetdir}/BIG5-HKSCS.map
: ${GLIBC_CHARMAPS}/BIG5-HKSCS.gz
${mapconv} ${compact}
252 ${AM_V_GEN}${run_mapconv} $< '/^<.*[ ]\/x[89a-f].\//' GLIBC-2
${compact} > $@
254 ${charsetdir}/JOHAB.map
: ${GLIBC_CHARMAPS}/JOHAB.gz
${mapconv} ${compact}
255 ${AM_V_GEN}${run_mapconv} $< '/^<.*[ ]\/x[89a-f]/' GLIBC-2
${compact} > $@
257 ${charsetdir}/CNS-1.map
: ${GLIBC_CHARMAPS}/EUC-TW.gz
${mapconv} ${compact}
258 ${AM_V_GEN}${run_mapconv} $< '/^<.*[ ]\/x[a-f]/' GLIBC-2-7
${compact} > $@
260 # ${charsetdir}/CNS-1.map: ${mapfiledir}/cns2ucsdkw.txt ${mapconv} ${compact}
261 # ${AM_V_GEN}${run_mapconv} $< '/^C1/' KANJI-DATABASE ${compact} > $@
263 ${charsetdir}/CNS-2.map
: ${mapfiledir}/cns2ucsdkw.txt
${mapconv} ${compact}
264 ${AM_V_GEN}${run_mapconv} $< '/^C2/' KANJI-DATABASE
${compact} > $@
266 ${charsetdir}/CNS-3.map
: ${mapfiledir}/cns2ucsdkw.txt
${mapconv} ${compact}
267 ${AM_V_GEN}${run_mapconv} $< '/^C3/' KANJI-DATABASE
${compact} > $@
269 ${charsetdir}/CNS-4.map
: ${mapfiledir}/cns2ucsdkw.txt
${mapconv} ${compact}
270 ${AM_V_GEN}${run_mapconv} $< '/^C4/' KANJI-DATABASE
${compact} > $@
272 ${charsetdir}/CNS-5.map
: ${mapfiledir}/cns2ucsdkw.txt
${mapconv} ${compact}
273 ${AM_V_GEN}${run_mapconv} $< '/^C5/' KANJI-DATABASE
${compact} > $@
275 ${charsetdir}/CNS-6.map
: ${mapfiledir}/cns2ucsdkw.txt
${mapconv} ${compact}
276 ${AM_V_GEN}${run_mapconv} $< '/^C6/' KANJI-DATABASE
${compact} > $@
278 ${charsetdir}/CNS-7.map
: ${mapfiledir}/cns2ucsdkw.txt
${mapconv} ${compact}
279 ${AM_V_GEN}${run_mapconv} $< '/^C7/' KANJI-DATABASE
${compact} > $@
281 ${charsetdir}/CNS-F.map
: ${GLIBC_CHARMAPS}/EUC-TW.gz
${mapconv} ${compact}
282 ${AM_V_GEN}${run_mapconv} $< '/^<.*\/x8e\/xaf/ s,/x8e/xaf,,' GLIBC-2-7
${compact} > $@
284 # General target to produce map files for mule charsets.
285 ${charsetdir}/MULE-
%.map
: ${mapfiledir}/MULE-
%.map
288 # General target to produce map files for ISO-8859, GEORGIAN, and
289 # EBCDIC charsets. We can not use the original file name because of
290 # file name limit on DOS. "KA" is ISO 639 language code for Georgian.
292 ${charsetdir}/8859-%.map
: ${GLIBC_CHARMAPS}/ISO-8859-
%.gz
${mapconv} ${compact}
293 ${AM_V_GEN}${run_mapconv} $< '/^<.*[ ]\/x/' GLIBC-1
${compact} > $@
295 ${charsetdir}/KA-
%.map
: ${GLIBC_CHARMAPS}/GEORGIAN-
%.gz
${mapconv} ${compact}
296 ${AM_V_GEN}${run_mapconv} $< '/^<.*[ ]\/x/' GLIBC-1
${compact} > $@
298 ${charsetdir}/EBCDIC
%.map
: ${GLIBC_CHARMAPS}/EBCDIC-
%.gz
${mapconv} ${compact}
299 ${AM_V_GEN}${run_mapconv} $< '/^<.*[ ]\/x/' GLIBC-1
${compact} > $@
301 # General target to produce map files for single-byte charsets.
303 ${charsetdir}/%.map
: ${GLIBC_CHARMAPS}/%.gz
${mapconv} ${compact}
304 ${AM_V_GEN}${run_mapconv} $< '/^<.*[ ]\/x/' GLIBC-1
${compact} > $@
307 .PHONY
: clean bootstrap-clean
distclean maintainer-clean extraclean
312 bootstrap-clean
: clean
317 maintainer-clean
: distclean
319 ## Do not remove these files, even in a bootstrap. They rarely change.
321 rm -f
${CHARSETS} ${TRANS_TABLE} ${srcdir}/charsets.stamp