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