localedata: Sort Makefile variables.
[glibc.git] / localedata / Makefile
blob713e7aebad7a6c5ff9bb674b54ef21e9d35ad743
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-mbswcs1 \
243 tst-mbswcs2 \
244 tst-mbswcs3 \
245 tst-mbswcs4 \
246 tst-mbswcs5 \
247 tst-mbswcs6 \
248 tst-setlocale \
249 tst-setlocale2 \
250 tst-setlocale3 \
251 tst-sscanf \
252 tst-strfmon1 \
253 tst-wctype \
254 tst-xlocale1 \
255 tst-xlocale2 \
256 # tests
258 tests-static = bug-setlocale1-static
259 tests += $(tests-static)
260 ifeq (yes,$(build-shared))
261 ifneq (no,$(PERL))
262 tests-special += $(objpfx)mtrace-tst-leaks.out
263 endif
264 endif
265 endif
266 tests-container = \
267 tst-localedef-hardlinks \
268 # tests-container
270 # Files to install.
271 ifeq ($(INSTALL_UNCOMPRESSED),yes)
272 # This option is for testing inside the testroot container, as the
273 # container does not include a working gunzip program.
274 install-others := $(addprefix $(inst_i18ndir)/, \
275 $(charmaps) \
276 $(locales))
277 else
278 install-others := $(addprefix $(inst_i18ndir)/, \
279 $(addsuffix .gz, $(charmaps)) \
280 $(locales))
281 endif
283 tests: $(objdir)/iconvdata/gconv-modules
285 tests-static += \
286 tst-langinfo-newlocale-static \
287 tst-langinfo-setlocale-static \
288 # tests-static
290 ifeq ($(run-built-tests),yes)
291 tests-special += \
292 $(objpfx)sort-test.out \
293 $(objpfx)tst-ctype.out \
294 $(objpfx)tst-fmon.out \
295 $(objpfx)tst-langinfo-newlocale-static.out \
296 $(objpfx)tst-langinfo-newlocale.out \
297 $(objpfx)tst-langinfo-setlocale-static.out \
298 $(objpfx)tst-langinfo-setlocale.out \
299 $(objpfx)tst-locale.out \
300 $(objpfx)tst-numeric.out \
301 $(objpfx)tst-rpmatch.out \
302 $(objpfx)tst-trans.out \
303 # tests-special
304 # We have to generate locales (list sorted alphabetically)
305 LOCALES := \
306 C.UTF-8 \
307 am_ET.UTF-8 \
308 az_AZ.UTF-8 \
309 be_BY.UTF-8 \
310 ber_DZ.UTF-8 \
311 ber_MA.UTF-8 \
312 bg_BG.UTF-8 \
313 br_FR.UTF-8 \
314 bs_BA.UTF-8 \
315 ckb_IQ.UTF-8 \
316 cmn_TW.UTF-8 \
317 crh_UA.UTF-8 \
318 cs_CZ.UTF-8 \
319 csb_PL.UTF-8 \
320 cv_RU.UTF-8 \
321 cy_GB.UTF-8 \
322 da_DK.ISO-8859-1 \
323 de_DE.ISO-8859-1 \
324 de_DE.UTF-8 \
325 dsb_DE.UTF-8 \
326 dz_BT.UTF-8 \
327 en_GB.UTF-8 \
328 en_US.ANSI_X3.4-1968 \
329 en_US.ISO-8859-1\
330 en_US.UTF-8 \
331 eo.UTF-8 \
332 es_ES.UTF-8 \
333 et_EE.UTF-8 \
334 fa_IR.UTF-8 \
335 fi_FI.UTF-8 \
336 fil_PH.UTF-8 \
337 fr_CA.UTF-8 \
338 fr_FR.ISO-8859-1 \
339 fr_FR.UTF-8 \
340 fur_IT.UTF-8 \
341 gez_ER.UTF-8@abegede \
342 ha_NG.UTF-8 \
343 hr_HR.ISO-8859-2 \
344 hr_HR.UTF-8 \
345 hsb_DE.UTF-8 \
346 hu_HU.UTF-8 \
347 ig_NG.UTF-8 \
348 ik_CA.UTF-8 \
349 is_IS.UTF-8 \
350 ja_JP.EUC-JP \
351 ja_JP.SJIS \
352 ja_JP.UTF-8 \
353 kk_KZ.UTF-8 \
354 ku_TR.UTF-8 \
355 ky_KG.UTF-8 \
356 ln_CD.UTF-8 \
357 lt_LT.UTF-8 \
358 lv_LV.UTF-8 \
359 mi_NZ.UTF-8 \
360 ml_IN.UTF-8 \
361 mn_MN.UTF-8 \
362 mr_IN.UTF-8 \
363 mt_MT.UTF-8 \
364 nan_TW.UTF-8@latin \
365 nb_NO.ISO-8859-1 \
366 nb_NO.UTF-8 \
367 nl_NL.UTF-8 \
368 nn_NO.ISO-8859-1 \
369 om_KE.UTF-8 \
370 or_IN.UTF-8 \
371 os_RU.UTF-8 \
372 pl_PL.UTF-8 \
373 ps_AF.UTF-8 \
374 rif_MA.UTF-8 \
375 ro_RO.UTF-8 \
376 ru_RU.UTF-8 \
377 sah_RU.UTF-8 \
378 sc_IT.UTF-8 \
379 se_NO.UTF-8 \
380 si_LK.UTF-8 \
381 sq_AL.UTF-8 \
382 sr_RS.UTF-8 \
383 sv_SE.ISO-8859-1 \
384 sv_SE.UTF-8 \
385 syr.UTF-8 \
386 szl_PL.UTF-8 \
387 tg_TJ.UTF-8 \
388 th_TH.UTF-8 \
389 tk_TM.UTF-8 \
390 tr_TR.ISO-8859-9 \
391 tr_TR.UTF-8 \
392 tt_RU.UTF-8 \
393 tt_RU.UTF-8@iqtelif \
394 ug_CN.UTF-8 \
395 uk_UA.UTF-8 \
396 uz_UZ.UTF-8 \
397 vi_VN.UTF-8 \
398 yi_US.UTF-8 \
399 yo_NG.UTF-8 \
400 zh_CN.UTF-8 \
401 zh_TW.EUC-TW \
402 # LOCALES
404 include ../gen-locales.mk
406 $(objpfx)tst-iconv-emojis-trans.out: $(gen-locales)
408 $(objpfx)tst-iconv-math-trans.out: $(gen-locales)
409 endif
411 include ../Rules
413 ifeq ($(INSTALL_UNCOMPRESSED),yes)
414 # Install the charmap files as-is. This option is for testing inside
415 # the testroot container, as the container does not include a working
416 # gunzip program.
417 $(inst_i18ndir)/charmaps/%: charmaps/% $(+force)
418 $(make-target-directory)
419 rm -f $@
420 $(INSTALL_DATA) $< $@
421 else
422 # Install the charmap files in gzipped format.
423 $(inst_i18ndir)/charmaps/%.gz: charmaps/% $(+force)
424 $(make-target-directory)
425 rm -f $(@:.gz=) $@
426 $(INSTALL_DATA) $< $(@:.gz=)
427 gzip -9n $(@:.gz=)
428 endif
430 # Install the locale source files in the appropriate directory.
431 $(inst_i18ndir)/locales/%: locales/% $(+force); $(do-install)
433 ifeq ($(run-built-tests),yes)
434 generated-dirs += $(LOCALES)
436 $(addsuffix .out,$(addprefix $(objpfx),$(tests))): %: \
437 $(addprefix $(objpfx),$(CTYPE_FILES))
439 $(objpfx)sort-test.out: sort-test.sh $(objpfx)collate-test $(objpfx)xfrm-test \
440 $(test-input-data) $(addprefix $(objpfx),$(CTYPE_FILES))
441 $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
442 '$(run-program-env)' '$(test-program-prefix-after-env)' \
443 $(test-input) \
444 > $@; \
445 $(evaluate-test)
446 $(objpfx)tst-fmon.out: tst-fmon.sh $(objpfx)tst-fmon tst-fmon.data \
447 $(objpfx)sort-test.out \
448 $(addprefix $(objpfx),$(CTYPE_FILES))
449 $(SHELL) $< $(common-objpfx) '$(run-program-prefix-before-env)' \
450 '$(run-program-env)' '$(run-program-prefix-after-env)' \
451 '$(test-program-prefix)' tst-fmon.data \
452 > $@; \
453 $(evaluate-test)
454 $(objpfx)tst-numeric.out: tst-numeric.sh $(objpfx)tst-numeric tst-numeric.data \
455 $(objpfx)sort-test.out \
456 $(addprefix $(objpfx),$(CTYPE_FILES))
457 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' tst-numeric.data \
458 > $@; \
459 $(evaluate-test)
460 $(objpfx)tst-locale.out: tst-locale.sh $(common-objpfx)locale/localedef \
461 $(ld-test-srcs) $(addprefix $(objpfx),$(CTYPE_FILES))
462 $(SHELL) $< $(common-objpfx) '$(built-program-cmd-before-env)' \
463 '$(run-program-env)' '$(built-program-cmd-after-env)' > $@; \
464 $(evaluate-test)
465 $(objpfx)tst-rpmatch.out: tst-rpmatch.sh $(objpfx)tst-rpmatch \
466 $(objpfx)tst-fmon.out \
467 $(addprefix $(objpfx),$(CTYPE_FILES))
468 $(SHELL) $< $(common-objpfx) '$(test-program-cmd)' > $@; \
469 $(evaluate-test)
470 $(objpfx)tst-trans.out: tst-trans.sh $(objpfx)tst-trans \
471 $(addprefix $(objpfx),$(CTYPE_FILES))
472 $(SHELL) $< $(common-objpfx) '$(run-program-prefix-before-env)' \
473 '$(run-program-env)' '$(run-program-prefix-after-env)' \
474 '$(test-program-prefix-before-env)' \
475 '$(test-program-prefix-after-env)'; \
476 $(evaluate-test)
477 $(objpfx)tst-ctype.out: tst-ctype.sh $(objpfx)tst-ctype \
478 $(objpfx)sort-test.out \
479 $(addprefix $(objpfx),$(CTYPE_FILES))
480 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
481 '$(run-program-env)' '$(test-program-cmd-after-env)'; \
482 $(evaluate-test)
483 $(objpfx)tst-langinfo-newlocale.out: tst-langinfo.sh \
484 $(objpfx)tst-langinfo-newlocale \
485 $(objpfx)sort-test.out \
486 $(addprefix $(objpfx),$(CTYPE_FILES))
487 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
488 '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
489 $(evaluate-test)
490 $(objpfx)tst-langinfo-newlocale-static.out: tst-langinfo.sh \
491 $(objpfx)tst-langinfo-newlocale-static \
492 $(objpfx)sort-test.out \
493 $(addprefix $(objpfx),$(CTYPE_FILES))
494 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
495 '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
496 $(evaluate-test)
497 # Static use of newlocale is known not to work. See Bug 23164.
498 test-xfail-tst-langinfo-newlocale-static = yes
500 $(objpfx)tst-langinfo-setlocale.out: tst-langinfo.sh \
501 $(objpfx)tst-langinfo-setlocale \
502 $(objpfx)sort-test.out \
503 $(addprefix $(objpfx),$(CTYPE_FILES))
504 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
505 '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
506 $(evaluate-test)
507 $(objpfx)tst-langinfo-setlocale-static.out: tst-langinfo.sh \
508 $(objpfx)tst-langinfo-setlocale-static \
509 $(objpfx)sort-test.out \
510 $(addprefix $(objpfx),$(CTYPE_FILES))
511 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
512 '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
513 $(evaluate-test)
515 $(objpfx)tst-digits.out: $(objpfx)tst-locale.out
516 $(objpfx)tst-mbswcs6.out: $(addprefix $(objpfx),$(CTYPE_FILES))
517 endif
519 include SUPPORTED
521 INSTALL-SUPPORTED-LOCALE-ARCHIVE=$(addprefix install-archive-, $(SUPPORTED-LOCALES))
522 INSTALL-SUPPORTED-LOCALE-FILES=$(addprefix install-files-, $(SUPPORTED-LOCALES))
524 # Sometimes the whole collection of locale files should be installed.
525 LOCALEDEF=I18NPATH=. GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
526 $(rtld-prefix) $(common-objpfx)locale/localedef
527 install-locales: install-locale-archive
529 # Create and install the locale-archive file.
530 install-locale-archive: $(INSTALL-SUPPORTED-LOCALE-ARCHIVE)
531 # Create and install the locales individually (no archive).
532 install-locale-files: $(INSTALL-SUPPORTED-LOCALE-FILES)
534 install-locales-dir:
535 $(..)./scripts/mkinstalldirs $(inst_complocaledir)
537 # The SHIFT_JIS and SHIFT_JISX0213 character maps are not ASCII compatible,
538 # therefore we have to use --no-warnings=ascii to disable the ASCII check.
539 # See localedata/gen-locale.sh for the same logic.
540 define build-one-locale
541 locale=`echo $@ | sed -e 's/^install-[a-z]*-//'`; \
542 charset=`echo $$locale | sed -e 's,.*/,,'`; \
543 locale=`echo $$locale | sed -e 's,/[^/]*,,'`; \
544 if [ "$$charset" = 'SHIFT_JIS' ] \
545 || [ "$$charset" = 'SHIFT_JISX0213' ]; then \
546 flags="$$flags --no-warnings=ascii"; \
547 fi; \
548 echo -n `echo $$locale | sed 's/\([^.\@]*\).*/\1/'`; \
549 echo -n ".$$charset"; \
550 echo -n `echo $$locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \
551 echo -n '...'; \
552 input=`echo $$locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; \
553 $(LOCALEDEF) $$flags --alias-file=../intl/locale.alias \
554 -i locales/$$input -f charmaps/$$charset \
555 $(addprefix --prefix=,$(install_root)) $$locale \
556 && echo ' done';
557 endef
559 $(INSTALL-SUPPORTED-LOCALE-ARCHIVE): install-locales-dir
560 @flags=""; \
561 $(build-one-locale)
563 $(INSTALL-SUPPORTED-LOCALE-FILES): install-locales-dir
564 @flags="--no-archive --no-hard-links"; \
565 $(build-one-locale)
567 tst-setlocale-ENV = LC_ALL=ja_JP.EUC-JP
568 tst-wctype-ENV = LC_ALL=ja_JP.EUC-JP
570 tst-leaks-ENV = MALLOC_TRACE=$(objpfx)tst-leaks.mtrace \
571 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
572 $(objpfx)mtrace-tst-leaks.out: $(objpfx)tst-leaks.out
573 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@; \
574 $(evaluate-test)
576 bug-setlocale1-ENV-only = LOCPATH=$(objpfx) LC_CTYPE=de_DE.UTF-8
577 bug-setlocale1-static-ENV-only = $(bug-setlocale1-ENV-only)
579 $(objdir)/iconvdata/gconv-modules:
580 $(MAKE) -C ../iconvdata subdir=iconvdata $@