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.
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
39 tst-langinfo-newlocale \
40 tst-langinfo-newlocale-static \
41 tst-langinfo-setlocale \
42 tst-langinfo-setlocale-static \
48 # List of test input files (list sorted alphabetically):
81 gez_ER.UTF-8@abegede \
126 tt_RU.UTF-8@iqtelif \
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
) \
166 mtrace-tst-leaks.out \
172 $(addprefix tstfmon_
,$(fmon-tests
)) \
178 ifeq ($(run-built-tests
),yes
)
179 locale_test_suite
:= \
233 $(locale_test_suite
) \
237 tst-c-utf8-consistency \
239 tst-iconv-emojis-trans \
240 tst-iconv-math-trans \
258 tests-static
= bug-setlocale1-static
259 tests
+= $(tests-static
)
260 ifeq (yes
,$(build-shared
))
262 tests-special
+= $(objpfx
)mtrace-tst-leaks.out
267 tst-localedef-hardlinks \
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
)/, \
278 install-others
:= $(addprefix $(inst_i18ndir
)/, \
279 $(addsuffix .gz
, $(charmaps
)) \
283 tests
: $(objdir
)/iconvdata
/gconv-modules
286 tst-langinfo-newlocale-static \
287 tst-langinfo-setlocale-static \
290 ifeq ($(run-built-tests
),yes
)
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 \
304 # We have to generate locales (list sorted alphabetically)
328 en_US.ANSI_X3.4
-1968 \
341 gez_ER.UTF-8@abegede \
393 tt_RU.UTF-8@iqtelif \
404 include ..
/gen-locales.mk
406 $(objpfx
)tst-iconv-emojis-trans.out
: $(gen-locales
)
408 $(objpfx
)tst-iconv-math-trans.out
: $(gen-locales
)
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
417 $(inst_i18ndir
)/charmaps
/%: charmaps
/% $(+force)
418 $(make-target-directory
)
420 $(INSTALL_DATA
) $< $@
422 # Install the charmap files in gzipped format.
423 $(inst_i18ndir
)/charmaps
/%.gz
: charmaps
/% $(+force)
424 $(make-target-directory
)
426 $(INSTALL_DATA
) $< $(@
:.gz
=)
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)' \
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 \
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 \
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)' > $@
; \
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)' > $@
; \
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)'; \
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)'; \
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)' > $@
; \
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)' > $@
; \
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)' > $@
; \
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)' > $@
; \
515 $(objpfx
)tst-digits.out
: $(objpfx
)tst-locale.out
516 $(objpfx
)tst-mbswcs6.out
: $(addprefix $(objpfx
),$(CTYPE_FILES
))
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
)
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"; \
548 echo
-n
`echo $$locale | sed 's/\([^.\@]*\).*/\1/'`; \
549 echo
-n
".$$charset"; \
550 echo
-n
`echo $$locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \
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 \
559 $(INSTALL-SUPPORTED-LOCALE-ARCHIVE
): install-locales-dir
563 $(INSTALL-SUPPORTED-LOCALE-FILES
): install-locales-dir
564 @flags
="--no-archive --no-hard-links"; \
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
> $@
; \
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
$@