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 \
127 tt_RU.UTF-8@iqtelif \
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
) \
167 mtrace-tst-leaks.out \
173 $(addprefix tstfmon_
,$(fmon-tests
)) \
179 ifeq ($(run-built-tests
),yes
)
180 locale_test_suite
:= \
234 $(locale_test_suite
) \
238 tst-c-utf8-consistency \
240 tst-iconv-emojis-trans \
241 tst-iconv-math-trans \
243 tst-locale-loadlocale \
260 tests-static
= bug-setlocale1-static
261 tests
+= $(tests-static
)
262 ifeq (yes
,$(build-shared
))
264 tests-special
+= $(objpfx
)mtrace-tst-leaks.out
269 tst-localedef-hardlinks \
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
)/, \
280 install-others
:= $(addprefix $(inst_i18ndir
)/, \
281 $(addsuffix .gz
, $(charmaps
)) \
285 tests
: $(objdir
)/iconvdata
/gconv-modules
288 tst-langinfo-newlocale-static \
289 tst-langinfo-setlocale-static \
292 ifeq ($(run-built-tests
),yes
)
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 \
306 # We have to generate locales (list sorted alphabetically)
331 en_US.ANSI_X3.4
-1968 \
344 gez_ER.UTF-8@abegede \
397 tt_RU.UTF-8@iqtelif \
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
)
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
423 $(inst_i18ndir
)/charmaps
/%: charmaps
/% $(+force)
424 $(make-target-directory
)
426 $(INSTALL_DATA
) $< $@
428 # Install the charmap files in gzipped format.
429 $(inst_i18ndir
)/charmaps
/%.gz
: charmaps
/% $(+force)
430 $(make-target-directory
)
432 $(INSTALL_DATA
) $< $(@
:.gz
=)
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)' \
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 \
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 \
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)' > $@
; \
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)' > $@
; \
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)'; \
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)'; \
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)' > $@
; \
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)' > $@
; \
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)' > $@
; \
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)' > $@
; \
521 $(objpfx
)tst-digits.out
: $(objpfx
)tst-locale.out
522 $(objpfx
)tst-mbswcs6.out
: $(addprefix $(objpfx
),$(CTYPE_FILES
))
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
)
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"; \
554 echo
-n
`echo $$locale | sed 's/\([^.\@]*\).*/\1/'`; \
555 echo
-n
".$$charset"; \
556 echo
-n
`echo $$locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \
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 \
565 $(INSTALL-SUPPORTED-LOCALE-ARCHIVE
): install-locales-dir
569 $(INSTALL-SUPPORTED-LOCALE-FILES
): install-locales-dir
570 @flags
="--no-archive --no-hard-links"; \
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
> $@
; \
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
$@