x86: In ld.so, diagnose missing APX support in APX-only builds
[glibc.git] / localedata / Makefile
blob6d0bac225b223942499d14ee435212eff939c981
1 # Copyright (C) 1996-2024 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/*)
31 subdir-dirs = tests-mbwc
32 vpath %.c tests-mbwc
33 vpath %.h tests-mbwc
35 test-srcs := \
36 collate-test \
37 tst-ctype \
38 tst-fmon \
39 tst-langinfo-newlocale \
40 tst-langinfo-newlocale-static \
41 tst-langinfo-setlocale \
42 tst-langinfo-setlocale-static \
43 tst-numeric \
44 tst-rpmatch \
45 tst-trans \
46 xfrm-test \
47 # test-srcs
48 # List of test input files (list sorted alphabetically):
49 test-input := \
50 C.UTF-8 \
51 am_ET.UTF-8 \
52 az_AZ.UTF-8 \
53 be_BY.UTF-8 \
54 ber_DZ.UTF-8 \
55 ber_MA.UTF-8 \
56 bg_BG.UTF-8 \
57 br_FR.UTF-8 \
58 bs_BA.UTF-8 \
59 ckb_IQ.UTF-8 \
60 cmn_TW.UTF-8 \
61 crh_UA.UTF-8 \
62 cs_CZ.UTF-8 \
63 csb_PL.UTF-8 \
64 cv_RU.UTF-8 \
65 cy_GB.UTF-8 \
66 da_DK.ISO-8859-1 \
67 de_DE.ISO-8859-1 \
68 dsb_DE.UTF-8 \
69 dz_BT.UTF-8 \
70 en_US.ISO-8859-1 \
71 en_US.UTF-8 \
72 eo.UTF-8 \
73 es_ES.UTF-8 \
74 et_EE.UTF-8 \
75 fa_IR.UTF-8 \
76 fi_FI.UTF-8 \
77 fil_PH.UTF-8 \
78 fr_CA.UTF-8 \
79 fr_FR.UTF-8 \
80 fur_IT.UTF-8 \
81 gez_ER.UTF-8@abegede \
82 ha_NG.UTF-8 \
83 hr_HR.ISO-8859-2 \
84 hr_HR.UTF-8 \
85 hsb_DE.UTF-8 \
86 hu_HU.UTF-8 \
87 ig_NG.UTF-8 \
88 ik_CA.UTF-8 \
89 is_IS.UTF-8 \
90 kk_KZ.UTF-8 \
91 ku_TR.UTF-8 \
92 ky_KG.UTF-8 \
93 ln_CD.UTF-8 \
94 lt_LT.UTF-8 \
95 lv_LV.UTF-8 \
96 mi_NZ.UTF-8 \
97 ml_IN.UTF-8 \
98 mn_MN.UTF-8 \
99 mr_IN.UTF-8 \
100 mt_MT.UTF-8 \
101 nan_TW.UTF-8@latin \
102 nb_NO.UTF-8 \
103 om_KE.UTF-8 \
104 or_IN.UTF-8 \
105 os_RU.UTF-8 \
106 pl_PL.UTF-8 \
107 ps_AF.UTF-8 \
108 rif_MA.UTF-8 \
109 ro_RO.UTF-8 \
110 ru_RU.UTF-8 \
111 sah_RU.UTF-8 \
112 sc_IT.UTF-8 \
113 se_NO.UTF-8 \
114 si_LK.UTF-8 \
115 sq_AL.UTF-8 \
116 sr_RS.UTF-8 \
117 sv_SE.ISO-8859-1 \
118 sv_SE.UTF-8 \
119 syr.UTF-8 \
120 szl_PL.UTF-8 \
121 tg_TJ.UTF-8 \
122 th_TH.UTF-8 \
123 tk_TM.UTF-8 \
124 tr_TR.UTF-8 \
125 tt_RU.UTF-8 \
126 tt_RU.UTF-8@iqtelif \
127 ug_CN.UTF-8 \
128 uk_UA.UTF-8 \
129 uz_UZ.UTF-8 \
130 vi_VN.UTF-8 \
131 yi_US.UTF-8 \
132 yo_NG.UTF-8 \
133 zh_CN.UTF-8 \
134 # test-input
136 test-input-data = $(addsuffix .in, $(test-input))
137 test-output := $(foreach s, .out .xout, \
138 $(addsuffix $s, $(basename $(test-input))))
139 ld-test-names := test1 test2 test3 test4 test5 test6 test7
140 ld-test-srcs := $(addprefix tests/,$(addsuffix .cm,$(ld-test-names)) \
141 $(addsuffix .def,$(ld-test-names)) \
142 $(addsuffix .ds,test5 test6) \
143 test6.c trans.def)
145 fmon-tests = \
146 n01y12 \
147 n02n40 \
148 n10y31 \
149 n11y41 \
150 n12y11 \
151 n20n32 \
152 n30y20 \
153 n41n00 \
154 y01y10 \
155 y02n22 \
156 y22n42 \
157 y30y21 \
158 y32n31 \
159 y40y00 \
160 y42n21 \
161 # fmon-tests
163 generated += \
164 $(test-input) \
165 $(test-output) \
166 mtrace-tst-leaks.out \
167 sort-test.out \
168 tst-leaks.mtrace \
169 tst-locale.out \
170 # generated
171 generated-dirs += \
172 $(addprefix tstfmon_,$(fmon-tests)) \
173 $(ld-test-names) \
174 de_DE.437 \
175 tt_TT \
176 # generated-dirs
178 ifeq ($(run-built-tests),yes)
179 locale_test_suite := \
180 tst_iswalnum \
181 tst_iswalpha \
182 tst_iswcntrl \
183 tst_iswctype \
184 tst_iswdigit \
185 tst_iswgraph \
186 tst_iswlower \
187 tst_iswprint \
188 tst_iswpunct \
189 tst_iswspace \
190 tst_iswupper \
191 tst_iswxdigit \
192 tst_mblen \
193 tst_mbrlen \
194 tst_mbrtowc \
195 tst_mbsrtowcs \
196 tst_mbstowcs \
197 tst_mbtowc \
198 tst_strcoll \
199 tst_strfmon \
200 tst_strxfrm \
201 tst_swscanf \
202 tst_towctrans \
203 tst_towlower \
204 tst_towupper \
205 tst_wcrtomb \
206 tst_wcscat \
207 tst_wcschr \
208 tst_wcscmp \
209 tst_wcscoll \
210 tst_wcscpy \
211 tst_wcscspn \
212 tst_wcslen \
213 tst_wcsncat \
214 tst_wcsncmp \
215 tst_wcsncpy \
216 tst_wcspbrk \
217 tst_wcsrtombs \
218 tst_wcsspn \
219 tst_wcsstr \
220 tst_wcstod \
221 tst_wcstok \
222 tst_wcstombs \
223 tst_wcswidth \
224 tst_wcsxfrm \
225 tst_wctob \
226 tst_wctomb \
227 tst_wctrans \
228 tst_wctype \
229 tst_wcwidth \
230 # locale_test_suite
232 tests = \
233 $(locale_test_suite) \
234 bug-iconv-trans \
235 bug-setlocale1 \
236 bug-usesetlocale \
237 tst-c-utf8-consistency \
238 tst-digits \
239 tst-iconv-emojis-trans \
240 tst-iconv-math-trans \
241 tst-leaks \
242 tst-locale-loadlocale \
243 tst-mbswcs1 \
244 tst-mbswcs2 \
245 tst-mbswcs3 \
246 tst-mbswcs4 \
247 tst-mbswcs5 \
248 tst-mbswcs6 \
249 tst-setlocale \
250 tst-setlocale2 \
251 tst-setlocale3 \
252 tst-sscanf \
253 tst-strfmon1 \
254 tst-wctype \
255 tst-xlocale1 \
256 tst-xlocale2 \
257 # tests
259 tests-static = bug-setlocale1-static
260 tests += $(tests-static)
261 ifeq (yes,$(build-shared))
262 ifneq (no,$(PERL))
263 tests-special += $(objpfx)mtrace-tst-leaks.out
264 endif
265 endif
266 endif
267 tests-container = \
268 tst-localedef-hardlinks \
269 # tests-container
271 # Files to install.
272 ifeq ($(INSTALL_UNCOMPRESSED),yes)
273 # This option is for testing inside the testroot container, as the
274 # container does not include a working gunzip program.
275 install-others := $(addprefix $(inst_i18ndir)/, \
276 $(charmaps) \
277 $(locales))
278 else
279 install-others := $(addprefix $(inst_i18ndir)/, \
280 $(addsuffix .gz, $(charmaps)) \
281 $(locales))
282 endif
284 tests: $(objdir)/iconvdata/gconv-modules
286 tests-static += \
287 tst-langinfo-newlocale-static \
288 tst-langinfo-setlocale-static \
289 # tests-static
291 ifeq ($(run-built-tests),yes)
292 tests-special += \
293 $(objpfx)sort-test.out \
294 $(objpfx)tst-ctype.out \
295 $(objpfx)tst-fmon.out \
296 $(objpfx)tst-langinfo-newlocale-static.out \
297 $(objpfx)tst-langinfo-newlocale.out \
298 $(objpfx)tst-langinfo-setlocale-static.out \
299 $(objpfx)tst-langinfo-setlocale.out \
300 $(objpfx)tst-locale.out \
301 $(objpfx)tst-numeric.out \
302 $(objpfx)tst-rpmatch.out \
303 $(objpfx)tst-trans.out \
304 # tests-special
305 # We have to generate locales (list sorted alphabetically)
306 LOCALES := \
307 C.UTF-8 \
308 am_ET.UTF-8 \
309 az_AZ.UTF-8 \
310 be_BY.UTF-8 \
311 ber_DZ.UTF-8 \
312 ber_MA.UTF-8 \
313 bg_BG.UTF-8 \
314 br_FR.UTF-8 \
315 bs_BA.UTF-8 \
316 ckb_IQ.UTF-8 \
317 cmn_TW.UTF-8 \
318 crh_UA.UTF-8 \
319 cs_CZ.UTF-8 \
320 csb_PL.UTF-8 \
321 cv_RU.UTF-8 \
322 cy_GB.UTF-8 \
323 da_DK.ISO-8859-1 \
324 de_DE.ISO-8859-1 \
325 de_DE.UTF-8 \
326 dsb_DE.UTF-8 \
327 dz_BT.UTF-8 \
328 en_GB.UTF-8 \
329 en_US \
330 en_US.ANSI_X3.4-1968 \
331 en_US.ISO-8859-1\
332 en_US.UTF-8 \
333 eo.UTF-8 \
334 es_ES.UTF-8 \
335 et_EE.UTF-8 \
336 fa_IR.UTF-8 \
337 fi_FI.UTF-8 \
338 fil_PH.UTF-8 \
339 fr_CA.UTF-8 \
340 fr_FR.ISO-8859-1 \
341 fr_FR.UTF-8 \
342 fur_IT.UTF-8 \
343 gez_ER.UTF-8@abegede \
344 ha_NG.UTF-8 \
345 hr_HR.ISO-8859-2 \
346 hr_HR.UTF-8 \
347 hsb_DE.UTF-8 \
348 hu_HU.UTF-8 \
349 ig_NG.UTF-8 \
350 ik_CA.UTF-8 \
351 is_IS.UTF-8 \
352 ja_JP.EUC-JP \
353 ja_JP.SJIS \
354 ja_JP.UTF-8 \
355 kk_KZ.UTF-8 \
356 ku_TR.UTF-8 \
357 ky_KG.UTF-8 \
358 ln_CD.UTF-8 \
359 lt_LT.UTF-8 \
360 lv_LV.UTF-8 \
361 mi_NZ.UTF-8 \
362 ml_IN.UTF-8 \
363 mn_MN.UTF-8 \
364 mr_IN.UTF-8 \
365 mt_MT.UTF-8 \
366 nan_TW.UTF-8@latin \
367 nb_NO.ISO-8859-1 \
368 nb_NO.UTF-8 \
369 nl_NL.UTF-8 \
370 nn_NO.ISO-8859-1 \
371 om_KE.UTF-8 \
372 or_IN.UTF-8 \
373 os_RU.UTF-8 \
374 pl_PL.UTF-8 \
375 ps_AF.UTF-8 \
376 rif_MA.UTF-8 \
377 ro_RO.UTF-8 \
378 ru_RU.UTF-8 \
379 sah_RU.UTF-8 \
380 sc_IT.UTF-8 \
381 se_NO.UTF-8 \
382 si_LK.UTF-8 \
383 sq_AL.UTF-8 \
384 sr_RS.UTF-8 \
385 sv_SE.ISO-8859-1 \
386 sv_SE.UTF-8 \
387 syr.UTF-8 \
388 szl_PL.UTF-8 \
389 tg_TJ.UTF-8 \
390 th_TH.UTF-8 \
391 tk_TM.UTF-8 \
392 tr_TR.ISO-8859-9 \
393 tr_TR.UTF-8 \
394 tt_RU.UTF-8 \
395 tt_RU.UTF-8@iqtelif \
396 ug_CN.UTF-8 \
397 uk_UA.UTF-8 \
398 uz_UZ.UTF-8 \
399 vi_VN.UTF-8 \
400 yi_US.UTF-8 \
401 yo_NG.UTF-8 \
402 zh_CN.UTF-8 \
403 zh_TW.EUC-TW \
404 # LOCALES
406 include ../gen-locales.mk
408 $(objpfx)tst-iconv-emojis-trans.out: $(gen-locales)
410 $(objpfx)tst-iconv-math-trans.out: $(gen-locales)
411 # tst-locale-loadlocale: Needs an en_US-named locale for the test.
412 $(objpfx)tst-locale-loadlocale.out: $(gen-locales)
413 endif
415 include ../Rules
417 ifeq ($(INSTALL_UNCOMPRESSED),yes)
418 # Install the charmap files as-is. This option is for testing inside
419 # the testroot container, as the container does not include a working
420 # gunzip program.
421 $(inst_i18ndir)/charmaps/%: charmaps/% $(+force)
422 $(make-target-directory)
423 rm -f $@
424 $(INSTALL_DATA) $< $@
425 else
426 # Install the charmap files in gzipped format.
427 $(inst_i18ndir)/charmaps/%.gz: charmaps/% $(+force)
428 $(make-target-directory)
429 rm -f $(@:.gz=) $@
430 $(INSTALL_DATA) $< $(@:.gz=)
431 gzip -9n $(@:.gz=)
432 endif
434 # Install the locale source files in the appropriate directory.
435 $(inst_i18ndir)/locales/%: locales/% $(+force); $(do-install)
437 ifeq ($(run-built-tests),yes)
438 generated-dirs += $(LOCALES)
440 $(addsuffix .out,$(addprefix $(objpfx),$(tests))): %: \
441 $(addprefix $(objpfx),$(CTYPE_FILES))
443 $(objpfx)sort-test.out: sort-test.sh $(objpfx)collate-test $(objpfx)xfrm-test \
444 $(test-input-data) $(addprefix $(objpfx),$(CTYPE_FILES))
445 $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
446 '$(run-program-env)' '$(test-program-prefix-after-env)' \
447 $(test-input) \
448 > $@; \
449 $(evaluate-test)
450 $(objpfx)tst-fmon.out: tst-fmon.sh $(objpfx)tst-fmon tst-fmon.data \
451 $(objpfx)sort-test.out \
452 $(addprefix $(objpfx),$(CTYPE_FILES))
453 $(SHELL) $< $(common-objpfx) '$(run-program-prefix-before-env)' \
454 '$(run-program-env)' '$(run-program-prefix-after-env)' \
455 '$(test-program-prefix)' tst-fmon.data \
456 > $@; \
457 $(evaluate-test)
458 $(objpfx)tst-numeric.out: tst-numeric.sh $(objpfx)tst-numeric tst-numeric.data \
459 $(objpfx)sort-test.out \
460 $(addprefix $(objpfx),$(CTYPE_FILES))
461 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' tst-numeric.data \
462 > $@; \
463 $(evaluate-test)
464 $(objpfx)tst-locale.out: tst-locale.sh $(common-objpfx)locale/localedef \
465 $(ld-test-srcs) $(addprefix $(objpfx),$(CTYPE_FILES))
466 $(SHELL) $< $(common-objpfx) '$(built-program-cmd-before-env)' \
467 '$(run-program-env)' '$(built-program-cmd-after-env)' > $@; \
468 $(evaluate-test)
469 $(objpfx)tst-rpmatch.out: tst-rpmatch.sh $(objpfx)tst-rpmatch \
470 $(objpfx)tst-fmon.out \
471 $(addprefix $(objpfx),$(CTYPE_FILES))
472 $(SHELL) $< $(common-objpfx) '$(test-program-cmd)' > $@; \
473 $(evaluate-test)
474 $(objpfx)tst-trans.out: tst-trans.sh $(objpfx)tst-trans \
475 $(addprefix $(objpfx),$(CTYPE_FILES))
476 $(SHELL) $< $(common-objpfx) '$(run-program-prefix-before-env)' \
477 '$(run-program-env)' '$(run-program-prefix-after-env)' \
478 '$(test-program-prefix-before-env)' \
479 '$(test-program-prefix-after-env)'; \
480 $(evaluate-test)
481 $(objpfx)tst-ctype.out: tst-ctype.sh $(objpfx)tst-ctype \
482 $(objpfx)sort-test.out \
483 $(addprefix $(objpfx),$(CTYPE_FILES))
484 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
485 '$(run-program-env)' '$(test-program-cmd-after-env)'; \
486 $(evaluate-test)
487 $(objpfx)tst-langinfo-newlocale.out: tst-langinfo.sh \
488 $(objpfx)tst-langinfo-newlocale \
489 $(objpfx)sort-test.out \
490 $(addprefix $(objpfx),$(CTYPE_FILES))
491 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
492 '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
493 $(evaluate-test)
494 $(objpfx)tst-langinfo-newlocale-static.out: tst-langinfo.sh \
495 $(objpfx)tst-langinfo-newlocale-static \
496 $(objpfx)sort-test.out \
497 $(addprefix $(objpfx),$(CTYPE_FILES))
498 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
499 '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
500 $(evaluate-test)
501 # Static use of newlocale is known not to work. See Bug 23164.
502 test-xfail-tst-langinfo-newlocale-static = yes
504 $(objpfx)tst-langinfo-setlocale.out: tst-langinfo.sh \
505 $(objpfx)tst-langinfo-setlocale \
506 $(objpfx)sort-test.out \
507 $(addprefix $(objpfx),$(CTYPE_FILES))
508 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
509 '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
510 $(evaluate-test)
511 $(objpfx)tst-langinfo-setlocale-static.out: tst-langinfo.sh \
512 $(objpfx)tst-langinfo-setlocale-static \
513 $(objpfx)sort-test.out \
514 $(addprefix $(objpfx),$(CTYPE_FILES))
515 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
516 '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
517 $(evaluate-test)
519 $(objpfx)tst-digits.out: $(objpfx)tst-locale.out
520 $(objpfx)tst-mbswcs6.out: $(addprefix $(objpfx),$(CTYPE_FILES))
521 endif
523 include SUPPORTED
525 INSTALL-SUPPORTED-LOCALE-ARCHIVE=$(addprefix install-archive-, $(SUPPORTED-LOCALES))
526 INSTALL-SUPPORTED-LOCALE-FILES=$(addprefix install-files-, $(SUPPORTED-LOCALES))
528 # Sometimes the whole collection of locale files should be installed.
529 LOCALEDEF=I18NPATH=. GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
530 $(rtld-prefix) $(common-objpfx)locale/localedef
531 install-locales: install-locale-archive
533 # Create and install the locale-archive file.
534 install-locale-archive: $(INSTALL-SUPPORTED-LOCALE-ARCHIVE)
535 # Create and install the locales individually (no archive).
536 install-locale-files: $(INSTALL-SUPPORTED-LOCALE-FILES)
538 install-locales-dir:
539 $(..)./scripts/mkinstalldirs $(inst_complocaledir)
541 # The SHIFT_JIS and SHIFT_JISX0213 character maps are not ASCII compatible,
542 # therefore we have to use --no-warnings=ascii to disable the ASCII check.
543 # See localedata/gen-locale.sh for the same logic.
544 define build-one-locale
545 locale=`echo $@ | sed -e 's/^install-[a-z]*-//'`; \
546 charset=`echo $$locale | sed -e 's,.*/,,'`; \
547 locale=`echo $$locale | sed -e 's,/[^/]*,,'`; \
548 if [ "$$charset" = 'SHIFT_JIS' ] \
549 || [ "$$charset" = 'SHIFT_JISX0213' ]; then \
550 flags="$$flags --no-warnings=ascii"; \
551 fi; \
552 echo -n `echo $$locale | sed 's/\([^.\@]*\).*/\1/'`; \
553 echo -n ".$$charset"; \
554 echo -n `echo $$locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \
555 echo -n '...'; \
556 input=`echo $$locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; \
557 $(LOCALEDEF) $$flags --alias-file=../intl/locale.alias \
558 -i locales/$$input -f charmaps/$$charset \
559 $(addprefix --prefix=,$(install_root)) $$locale \
560 && echo ' done';
561 endef
563 $(INSTALL-SUPPORTED-LOCALE-ARCHIVE): install-locales-dir
564 @flags=""; \
565 $(build-one-locale)
567 $(INSTALL-SUPPORTED-LOCALE-FILES): install-locales-dir
568 @flags="--no-archive --no-hard-links"; \
569 $(build-one-locale)
571 tst-setlocale-ENV = LC_ALL=ja_JP.EUC-JP
572 tst-wctype-ENV = LC_ALL=ja_JP.EUC-JP
574 tst-leaks-ENV = MALLOC_TRACE=$(objpfx)tst-leaks.mtrace \
575 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
576 $(objpfx)mtrace-tst-leaks.out: $(objpfx)tst-leaks.out
577 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@; \
578 $(evaluate-test)
580 bug-setlocale1-ENV-only = LOCPATH=$(objpfx) LC_CTYPE=de_DE.UTF-8
581 bug-setlocale1-static-ENV-only = $(bug-setlocale1-ENV-only)
583 $(objdir)/iconvdata/gconv-modules:
584 $(MAKE) -C ../iconvdata subdir=iconvdata $@