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