Update NEWS.
[glibc.git] / localedata / Makefile
blob9ae2e5c161d60d119d48b066ed20efd25f243797
1 # Copyright (C) 1996-2022 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
4 # The GNU C Library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # The GNU C Library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, see
16 # <https://www.gnu.org/licenses/>.
18 # Makefile for installing locale data source files.
20 subdir := localedata
22 include ../Makeconfig
24 # List with all available character set descriptions.
25 charmaps := $(wildcard charmaps/[A-I]*) $(wildcard charmaps/[J-Z]*)
27 # List with all available character set descriptions.
28 locales := $(wildcard locales/*)
31 subdir-dirs = tests-mbwc
32 vpath %.c tests-mbwc
33 vpath %.h tests-mbwc
36 test-srcs := collate-test xfrm-test tst-fmon tst-rpmatch tst-trans \
37 tst-ctype tst-langinfo-newlocale tst-langinfo-setlocale \
38 tst-langinfo-newlocale-static tst-langinfo-setlocale-static \
39 tst-numeric
40 # List of test input files (list sorted alphabetically):
41 test-input := \
42 am_ET.UTF-8 \
43 az_AZ.UTF-8 \
44 be_BY.UTF-8 \
45 ber_DZ.UTF-8 \
46 ber_MA.UTF-8 \
47 bg_BG.UTF-8 \
48 br_FR.UTF-8 \
49 bs_BA.UTF-8 \
50 C.UTF-8 \
51 ckb_IQ.UTF-8 \
52 cmn_TW.UTF-8 \
53 crh_UA.UTF-8 \
54 cs_CZ.UTF-8 \
55 csb_PL.UTF-8 \
56 cv_RU.UTF-8 \
57 cy_GB.UTF-8 \
58 da_DK.ISO-8859-1 \
59 de_DE.ISO-8859-1 \
60 dsb_DE.UTF-8 \
61 dz_BT.UTF-8 \
62 en_US.ISO-8859-1 \
63 en_US.UTF-8 \
64 eo.UTF-8 \
65 es_ES.UTF-8 \
66 et_EE.UTF-8 \
67 fa_IR.UTF-8 \
68 fi_FI.UTF-8 \
69 fil_PH.UTF-8 \
70 fr_CA.UTF-8 \
71 fr_FR.UTF-8 \
72 fur_IT.UTF-8 \
73 gez_ER.UTF-8@abegede \
74 ha_NG.UTF-8 \
75 hr_HR.ISO-8859-2 \
76 hr_HR.UTF-8 \
77 hsb_DE.UTF-8 \
78 hu_HU.UTF-8 \
79 ig_NG.UTF-8 \
80 ik_CA.UTF-8 \
81 is_IS.UTF-8 \
82 kk_KZ.UTF-8 \
83 ku_TR.UTF-8 \
84 ky_KG.UTF-8 \
85 ln_CD.UTF-8 \
86 lt_LT.UTF-8 \
87 lv_LV.UTF-8 \
88 mi_NZ.UTF-8 \
89 ml_IN.UTF-8 \
90 mn_MN.UTF-8 \
91 mr_IN.UTF-8 \
92 mt_MT.UTF-8 \
93 nan_TW.UTF-8@latin \
94 nb_NO.UTF-8 \
95 om_KE.UTF-8 \
96 or_IN.UTF-8 \
97 os_RU.UTF-8 \
98 pl_PL.UTF-8 \
99 ps_AF.UTF-8 \
100 ro_RO.UTF-8 \
101 ru_RU.UTF-8 \
102 sah_RU.UTF-8 \
103 sc_IT.UTF-8 \
104 se_NO.UTF-8 \
105 si_LK.UTF-8 \
106 sq_AL.UTF-8 \
107 sr_RS.UTF-8 \
108 sv_SE.ISO-8859-1 \
109 sv_SE.UTF-8 \
110 szl_PL.UTF-8 \
111 tg_TJ.UTF-8 \
112 tk_TM.UTF-8 \
113 tr_TR.UTF-8 \
114 tt_RU.UTF-8 \
115 tt_RU.UTF-8@iqtelif \
116 ug_CN.UTF-8 \
117 uk_UA.UTF-8 \
118 uz_UZ.UTF-8 \
119 vi_VN.UTF-8 \
120 yi_US.UTF-8 \
121 yo_NG.UTF-8 \
122 zh_CN.UTF-8 \
123 $(NULL)
125 test-input-data = $(addsuffix .in, $(test-input))
126 test-output := $(foreach s, .out .xout, \
127 $(addsuffix $s, $(basename $(test-input))))
128 ld-test-names := test1 test2 test3 test4 test5 test6 test7
129 ld-test-srcs := $(addprefix tests/,$(addsuffix .cm,$(ld-test-names)) \
130 $(addsuffix .def,$(ld-test-names)) \
131 $(addsuffix .ds,test5 test6) \
132 test6.c trans.def)
134 fmon-tests = n01y12 n02n40 n10y31 n11y41 n12y11 n20n32 n30y20 n41n00 \
135 y01y10 y02n22 y22n42 y30y21 y32n31 y40y00 y42n21
137 generated += $(test-input) $(test-output) sort-test.out tst-locale.out \
138 tst-leaks.mtrace mtrace-tst-leaks.out
139 generated-dirs += $(ld-test-names) tt_TT de_DE.437 \
140 $(addprefix tstfmon_,$(fmon-tests)) \
142 ifeq ($(run-built-tests),yes)
143 locale_test_suite := tst_iswalnum tst_iswalpha tst_iswcntrl \
144 tst_iswctype tst_iswdigit tst_iswgraph \
145 tst_iswlower tst_iswprint tst_iswpunct \
146 tst_iswspace tst_iswupper tst_iswxdigit tst_mblen \
147 tst_mbrlen tst_mbrtowc tst_mbsrtowcs tst_mbstowcs \
148 tst_mbtowc tst_strcoll tst_strfmon tst_strxfrm \
149 tst_swscanf tst_towctrans tst_towlower \
150 tst_towupper tst_wcrtomb tst_wcscat tst_wcschr \
151 tst_wcscmp tst_wcscoll tst_wcscpy tst_wcscspn \
152 tst_wcslen tst_wcsncat tst_wcsncmp tst_wcsncpy \
153 tst_wcspbrk tst_wcsrtombs tst_wcsspn tst_wcsstr \
154 tst_wcstod tst_wcstok tst_wcstombs tst_wcswidth \
155 tst_wcsxfrm tst_wctob tst_wctomb tst_wctrans \
156 tst_wctype tst_wcwidth
158 tests = \
159 $(locale_test_suite) \
160 bug-iconv-trans \
161 bug-setlocale1 \
162 bug-usesetlocale \
163 tst-c-utf8-consistency \
164 tst-digits \
165 tst-iconv-math-trans \
166 tst-leaks \
167 tst-mbswcs1 \
168 tst-mbswcs2 \
169 tst-mbswcs3 \
170 tst-mbswcs4 \
171 tst-mbswcs5 \
172 tst-mbswcs6 \
173 tst-setlocale \
174 tst-setlocale2 \
175 tst-setlocale3 \
176 tst-sscanf \
177 tst-strfmon1 \
178 tst-wctype \
179 tst-xlocale1 \
180 tst-xlocale2 \
181 # tests
183 tests-static = bug-setlocale1-static
184 tests += $(tests-static)
185 ifeq (yes,$(build-shared))
186 ifneq (no,$(PERL))
187 tests-special += $(objpfx)mtrace-tst-leaks.out
188 endif
189 endif
190 endif
191 tests-container = \
192 tst-localedef-hardlinks
194 # Files to install.
195 ifeq ($(INSTALL_UNCOMPRESSED),yes)
196 # This option is for testing inside the testroot container, as the
197 # container does not include a working gunzip program.
198 install-others := $(addprefix $(inst_i18ndir)/, \
199 $(charmaps) \
200 $(locales))
201 else
202 install-others := $(addprefix $(inst_i18ndir)/, \
203 $(addsuffix .gz, $(charmaps)) \
204 $(locales))
205 endif
207 tests: $(objdir)/iconvdata/gconv-modules
209 tests-static += tst-langinfo-newlocale-static tst-langinfo-setlocale-static
211 ifeq ($(run-built-tests),yes)
212 tests-special += $(objpfx)sort-test.out $(objpfx)tst-fmon.out \
213 $(objpfx)tst-locale.out $(objpfx)tst-rpmatch.out \
214 $(objpfx)tst-trans.out $(objpfx)tst-ctype.out \
215 $(objpfx)tst-langinfo-newlocale.out \
216 $(objpfx)tst-langinfo-setlocale.out \
217 $(objpfx)tst-langinfo-newlocale-static.out \
218 $(objpfx)tst-langinfo-setlocale-static.out \
219 $(objpfx)tst-numeric.out
220 # We have to generate locales (list sorted alphabetically)
221 LOCALES := \
222 am_ET.UTF-8 \
223 az_AZ.UTF-8 \
224 be_BY.UTF-8 \
225 ber_DZ.UTF-8 \
226 ber_MA.UTF-8 \
227 bg_BG.UTF-8 \
228 br_FR.UTF-8 \
229 bs_BA.UTF-8 \
230 C.UTF-8 \
231 ckb_IQ.UTF-8 \
232 cmn_TW.UTF-8 \
233 crh_UA.UTF-8 \
234 cs_CZ.UTF-8 \
235 csb_PL.UTF-8 \
236 cv_RU.UTF-8 \
237 cy_GB.UTF-8 \
238 da_DK.ISO-8859-1 \
239 de_DE.ISO-8859-1 \
240 de_DE.UTF-8 \
241 dsb_DE.UTF-8 \
242 dz_BT.UTF-8 \
243 en_GB.UTF-8 \
244 en_US.ANSI_X3.4-1968 \
245 en_US.ISO-8859-1\
246 en_US.UTF-8 \
247 eo.UTF-8 \
248 es_ES.UTF-8 \
249 et_EE.UTF-8 \
250 fa_IR.UTF-8 \
251 fi_FI.UTF-8 \
252 fil_PH.UTF-8 \
253 fr_CA.UTF-8 \
254 fr_FR.ISO-8859-1 \
255 fr_FR.UTF-8 \
256 fur_IT.UTF-8 \
257 gez_ER.UTF-8@abegede \
258 ha_NG.UTF-8 \
259 hr_HR.ISO-8859-2 \
260 hr_HR.UTF-8 \
261 hsb_DE.UTF-8 \
262 hu_HU.UTF-8 \
263 ig_NG.UTF-8 \
264 ik_CA.UTF-8 \
265 is_IS.UTF-8 \
266 ja_JP.EUC-JP \
267 ja_JP.SJIS \
268 ja_JP.UTF-8 \
269 kk_KZ.UTF-8 \
270 ku_TR.UTF-8 \
271 ky_KG.UTF-8 \
272 ln_CD.UTF-8 \
273 lt_LT.UTF-8 \
274 lv_LV.UTF-8 \
275 mi_NZ.UTF-8 \
276 ml_IN.UTF-8 \
277 mn_MN.UTF-8 \
278 mr_IN.UTF-8 \
279 mt_MT.UTF-8 \
280 nan_TW.UTF-8@latin \
281 nb_NO.ISO-8859-1 \
282 nb_NO.UTF-8 \
283 nl_NL.UTF-8 \
284 nn_NO.ISO-8859-1 \
285 om_KE.UTF-8 \
286 or_IN.UTF-8 \
287 os_RU.UTF-8 \
288 pl_PL.UTF-8 \
289 ps_AF.UTF-8 \
290 ro_RO.UTF-8 \
291 ru_RU.UTF-8 \
292 sah_RU.UTF-8 \
293 sc_IT.UTF-8 \
294 se_NO.UTF-8 \
295 si_LK.UTF-8 \
296 sq_AL.UTF-8 \
297 sr_RS.UTF-8 \
298 sv_SE.ISO-8859-1 \
299 sv_SE.UTF-8 \
300 szl_PL.UTF-8 \
301 tg_TJ.UTF-8 \
302 tk_TM.UTF-8 \
303 tr_TR.ISO-8859-9 \
304 tr_TR.UTF-8 \
305 tt_RU.UTF-8 \
306 tt_RU.UTF-8@iqtelif \
307 ug_CN.UTF-8 \
308 uk_UA.UTF-8 \
309 uz_UZ.UTF-8 \
310 vi_VN.UTF-8 \
311 yi_US.UTF-8 \
312 yo_NG.UTF-8 \
313 zh_CN.UTF-8 \
314 zh_TW.EUC-TW \
315 $(NULL)
317 include ../gen-locales.mk
319 $(objpfx)tst-iconv-math-trans.out: $(gen-locales)
320 endif
322 include ../Rules
324 ifeq ($(INSTALL_UNCOMPRESSED),yes)
325 # Install the charmap files as-is. This option is for testing inside
326 # the testroot container, as the container does not include a working
327 # gunzip program.
328 $(inst_i18ndir)/charmaps/%: charmaps/% $(+force)
329 $(make-target-directory)
330 rm -f $@
331 $(INSTALL_DATA) $< $@
332 else
333 # Install the charmap files in gzipped format.
334 $(inst_i18ndir)/charmaps/%.gz: charmaps/% $(+force)
335 $(make-target-directory)
336 rm -f $(@:.gz=) $@
337 $(INSTALL_DATA) $< $(@:.gz=)
338 gzip -9n $(@:.gz=)
339 endif
341 # Install the locale source files in the appropriate directory.
342 $(inst_i18ndir)/locales/%: locales/% $(+force); $(do-install)
344 ifeq ($(run-built-tests),yes)
345 generated-dirs += $(LOCALES)
347 $(addsuffix .out,$(addprefix $(objpfx),$(tests))): %: \
348 $(addprefix $(objpfx),$(CTYPE_FILES))
350 $(objpfx)sort-test.out: sort-test.sh $(objpfx)collate-test $(objpfx)xfrm-test \
351 $(test-input-data) $(addprefix $(objpfx),$(CTYPE_FILES))
352 $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
353 '$(run-program-env)' '$(test-program-prefix-after-env)' \
354 $(test-input) \
355 > $@; \
356 $(evaluate-test)
357 $(objpfx)tst-fmon.out: tst-fmon.sh $(objpfx)tst-fmon tst-fmon.data \
358 $(objpfx)sort-test.out \
359 $(addprefix $(objpfx),$(CTYPE_FILES))
360 $(SHELL) $< $(common-objpfx) '$(run-program-prefix-before-env)' \
361 '$(run-program-env)' '$(run-program-prefix-after-env)' \
362 '$(test-program-prefix)' tst-fmon.data \
363 > $@; \
364 $(evaluate-test)
365 $(objpfx)tst-numeric.out: tst-numeric.sh $(objpfx)tst-numeric tst-numeric.data \
366 $(objpfx)sort-test.out \
367 $(addprefix $(objpfx),$(CTYPE_FILES))
368 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' tst-numeric.data \
369 > $@; \
370 $(evaluate-test)
371 $(objpfx)tst-locale.out: tst-locale.sh $(common-objpfx)locale/localedef \
372 $(ld-test-srcs) $(addprefix $(objpfx),$(CTYPE_FILES))
373 $(SHELL) $< $(common-objpfx) '$(built-program-cmd-before-env)' \
374 '$(run-program-env)' '$(built-program-cmd-after-env)' > $@; \
375 $(evaluate-test)
376 $(objpfx)tst-rpmatch.out: tst-rpmatch.sh $(objpfx)tst-rpmatch \
377 $(objpfx)tst-fmon.out \
378 $(addprefix $(objpfx),$(CTYPE_FILES))
379 $(SHELL) $< $(common-objpfx) '$(test-program-cmd)' > $@; \
380 $(evaluate-test)
381 $(objpfx)tst-trans.out: tst-trans.sh $(objpfx)tst-trans \
382 $(addprefix $(objpfx),$(CTYPE_FILES))
383 $(SHELL) $< $(common-objpfx) '$(run-program-prefix-before-env)' \
384 '$(run-program-env)' '$(run-program-prefix-after-env)' \
385 '$(test-program-prefix-before-env)' \
386 '$(test-program-prefix-after-env)'; \
387 $(evaluate-test)
388 $(objpfx)tst-ctype.out: tst-ctype.sh $(objpfx)tst-ctype \
389 $(objpfx)sort-test.out \
390 $(addprefix $(objpfx),$(CTYPE_FILES))
391 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
392 '$(run-program-env)' '$(test-program-cmd-after-env)'; \
393 $(evaluate-test)
394 $(objpfx)tst-langinfo-newlocale.out: tst-langinfo.sh \
395 $(objpfx)tst-langinfo-newlocale \
396 $(objpfx)sort-test.out \
397 $(addprefix $(objpfx),$(CTYPE_FILES))
398 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
399 '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
400 $(evaluate-test)
401 $(objpfx)tst-langinfo-newlocale-static.out: tst-langinfo.sh \
402 $(objpfx)tst-langinfo-newlocale-static \
403 $(objpfx)sort-test.out \
404 $(addprefix $(objpfx),$(CTYPE_FILES))
405 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
406 '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
407 $(evaluate-test)
408 # Static use of newlocale is known not to work. See Bug 23164.
409 test-xfail-tst-langinfo-newlocale-static = yes
411 $(objpfx)tst-langinfo-setlocale.out: tst-langinfo.sh \
412 $(objpfx)tst-langinfo-setlocale \
413 $(objpfx)sort-test.out \
414 $(addprefix $(objpfx),$(CTYPE_FILES))
415 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
416 '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
417 $(evaluate-test)
418 $(objpfx)tst-langinfo-setlocale-static.out: tst-langinfo.sh \
419 $(objpfx)tst-langinfo-setlocale-static \
420 $(objpfx)sort-test.out \
421 $(addprefix $(objpfx),$(CTYPE_FILES))
422 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
423 '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
424 $(evaluate-test)
426 $(objpfx)tst-digits.out: $(objpfx)tst-locale.out
427 $(objpfx)tst-mbswcs6.out: $(addprefix $(objpfx),$(CTYPE_FILES))
428 endif
430 include SUPPORTED
432 INSTALL-SUPPORTED-LOCALE-ARCHIVE=$(addprefix install-archive-, $(SUPPORTED-LOCALES))
433 INSTALL-SUPPORTED-LOCALE-FILES=$(addprefix install-files-, $(SUPPORTED-LOCALES))
435 # Sometimes the whole collection of locale files should be installed.
436 LOCALEDEF=I18NPATH=. GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
437 $(rtld-prefix) $(common-objpfx)locale/localedef
438 install-locales: install-locale-archive
440 # Create and install the locale-archive file.
441 install-locale-archive: $(INSTALL-SUPPORTED-LOCALE-ARCHIVE)
442 # Create and install the locales individually (no archive).
443 install-locale-files: $(INSTALL-SUPPORTED-LOCALE-FILES)
445 install-locales-dir:
446 $(..)./scripts/mkinstalldirs $(inst_complocaledir)
448 # The SHIFT_JIS and SHIFT_JISX0213 character maps are not ASCII compatible,
449 # therefore we have to use --no-warnings=ascii to disable the ASCII check.
450 # See localedata/gen-locale.sh for the same logic.
451 define build-one-locale
452 locale=`echo $@ | sed -e 's/^install-[a-z]*-//'`; \
453 charset=`echo $$locale | sed -e 's,.*/,,'`; \
454 locale=`echo $$locale | sed -e 's,/[^/]*,,'`; \
455 if [ "$$charset" = 'SHIFT_JIS' ] \
456 || [ "$$charset" = 'SHIFT_JISX0213' ]; then \
457 flags="$$flags --no-warnings=ascii"; \
458 fi; \
459 echo -n `echo $$locale | sed 's/\([^.\@]*\).*/\1/'`; \
460 echo -n ".$$charset"; \
461 echo -n `echo $$locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \
462 echo -n '...'; \
463 input=`echo $$locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; \
464 $(LOCALEDEF) $$flags --alias-file=../intl/locale.alias \
465 -i locales/$$input -f charmaps/$$charset \
466 $(addprefix --prefix=,$(install_root)) $$locale \
467 && echo ' done';
468 endef
470 $(INSTALL-SUPPORTED-LOCALE-ARCHIVE): install-locales-dir
471 @flags="-c"; \
472 $(build-one-locale)
474 $(INSTALL-SUPPORTED-LOCALE-FILES): install-locales-dir
475 @flags="-c --no-archive --no-hard-links"; \
476 $(build-one-locale)
478 tst-setlocale-ENV = LC_ALL=ja_JP.EUC-JP
479 tst-wctype-ENV = LC_ALL=ja_JP.EUC-JP
481 tst-leaks-ENV = MALLOC_TRACE=$(objpfx)tst-leaks.mtrace \
482 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
483 $(objpfx)mtrace-tst-leaks.out: $(objpfx)tst-leaks.out
484 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@; \
485 $(evaluate-test)
487 bug-setlocale1-ENV-only = LOCPATH=$(objpfx) LC_CTYPE=de_DE.UTF-8
488 bug-setlocale1-static-ENV-only = $(bug-setlocale1-ENV-only)
490 $(objdir)/iconvdata/gconv-modules:
491 $(MAKE) -C ../iconvdata subdir=iconvdata $@