xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame^] | 1 | # Copyright (C) 1996-2016 Free Software Foundation, Inc. |
| 2 | # This file is part of the GNU C Library. |
| 3 | |
| 4 | # The GNU C Library is free software; you can redistribute it and/or |
| 5 | # modify it under the terms of the GNU Lesser General Public |
| 6 | # License as published by the Free Software Foundation; either |
| 7 | # version 2.1 of the License, or (at your option) any later version. |
| 8 | |
| 9 | # The GNU C Library is distributed in the hope that it will be useful, |
| 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | # Lesser General Public License for more details. |
| 13 | |
| 14 | # You should have received a copy of the GNU Lesser General Public |
| 15 | # License along with the GNU C Library; if not, see |
| 16 | # <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | # Makefile for installing locale data source files. |
| 19 | |
| 20 | subdir := localedata |
| 21 | |
| 22 | include ../Makeconfig |
| 23 | |
| 24 | # List with all available character set descriptions. |
| 25 | charmaps := $(wildcard charmaps/[A-I]*) $(wildcard charmaps/[J-Z]*) |
| 26 | |
| 27 | # List with all available character set descriptions. |
| 28 | locales := $(wildcard locales/*) |
| 29 | |
| 30 | |
| 31 | subdir-dirs = tests-mbwc |
| 32 | vpath %.c tests-mbwc |
| 33 | vpath %.h tests-mbwc |
| 34 | |
| 35 | |
| 36 | test-srcs := collate-test xfrm-test tst-fmon tst-rpmatch tst-trans \ |
| 37 | tst-ctype tst-langinfo tst-langinfo-static tst-numeric |
| 38 | test-input := de_DE.ISO-8859-1 en_US.ISO-8859-1 da_DK.ISO-8859-1 \ |
| 39 | hr_HR.ISO-8859-2 sv_SE.ISO-8859-1 tr_TR.UTF-8 fr_FR.UTF-8 \ |
| 40 | si_LK.UTF-8 uk_UA.UTF-8 |
| 41 | test-input-data = $(addsuffix .in, $(basename $(test-input))) |
| 42 | test-output := $(foreach s, .out .xout, \ |
| 43 | $(addsuffix $s, $(basename $(test-input)))) |
| 44 | ld-test-names := test1 test2 test3 test4 test5 test6 test7 |
| 45 | ld-test-srcs := $(addprefix tests/,$(addsuffix .cm,$(ld-test-names)) \ |
| 46 | $(addsuffix .def,$(ld-test-names)) \ |
| 47 | $(addsuffix .ds,test5 test6) \ |
| 48 | test6.c trans.def) |
| 49 | |
| 50 | fmon-tests = n01y12 n02n40 n10y31 n11y41 n12y11 n20n32 n30y20 n41n00 \ |
| 51 | y01y10 y02n22 y22n42 y30y21 y32n31 y40y00 y42n21 |
| 52 | |
| 53 | generated += $(test-input) $(test-output) sort-test.out tst-locale.out \ |
| 54 | tst-leaks.mtrace mtrace-tst-leaks.out |
| 55 | generated-dirs += $(ld-test-names) tt_TT de_DE.437 \ |
| 56 | $(addprefix tstfmon_,$(fmon-tests)) \ |
| 57 | |
| 58 | ifeq ($(run-built-tests),yes) |
| 59 | locale_test_suite := tst_iswalnum tst_iswalpha tst_iswcntrl \ |
| 60 | tst_iswctype tst_iswdigit tst_iswgraph \ |
| 61 | tst_iswlower tst_iswprint tst_iswpunct \ |
| 62 | tst_iswspace tst_iswupper tst_iswxdigit tst_mblen \ |
| 63 | tst_mbrlen tst_mbrtowc tst_mbsrtowcs tst_mbstowcs \ |
| 64 | tst_mbtowc tst_strcoll tst_strfmon tst_strxfrm \ |
| 65 | tst_swscanf tst_towctrans tst_towlower \ |
| 66 | tst_towupper tst_wcrtomb tst_wcscat tst_wcschr \ |
| 67 | tst_wcscmp tst_wcscoll tst_wcscpy tst_wcscspn \ |
| 68 | tst_wcslen tst_wcsncat tst_wcsncmp tst_wcsncpy \ |
| 69 | tst_wcspbrk tst_wcsrtombs tst_wcsspn tst_wcsstr \ |
| 70 | tst_wcstod tst_wcstok tst_wcstombs tst_wcswidth \ |
| 71 | tst_wcsxfrm tst_wctob tst_wctomb tst_wctrans \ |
| 72 | tst_wctype tst_wcwidth |
| 73 | |
| 74 | tests = $(locale_test_suite) tst-digits tst-setlocale bug-iconv-trans \ |
| 75 | tst-leaks tst-mbswcs1 tst-mbswcs2 tst-mbswcs3 tst-mbswcs4 tst-mbswcs5 \ |
| 76 | tst-mbswcs6 tst-xlocale1 tst-xlocale2 bug-usesetlocale \ |
| 77 | tst-strfmon1 tst-sscanf bug-setlocale1 tst-setlocale2 tst-setlocale3 \ |
| 78 | tst-wctype |
| 79 | tests-static = bug-setlocale1-static |
| 80 | tests += $(tests-static) |
| 81 | ifeq (yes,$(build-shared)) |
| 82 | ifneq (no,$(PERL)) |
| 83 | tests-special += $(objpfx)mtrace-tst-leaks.out |
| 84 | endif |
| 85 | endif |
| 86 | endif |
| 87 | |
| 88 | # Files to install. |
| 89 | install-others := $(addprefix $(inst_i18ndir)/, \ |
| 90 | $(addsuffix .gz, $(charmaps)) \ |
| 91 | $(locales)) |
| 92 | |
| 93 | tests: $(objdir)/iconvdata/gconv-modules |
| 94 | |
| 95 | tests-static += tst-langinfo-static |
| 96 | |
| 97 | ifeq ($(run-built-tests),yes) |
| 98 | tests-special += $(objpfx)sort-test.out $(objpfx)tst-fmon.out \ |
| 99 | $(objpfx)tst-locale.out $(objpfx)tst-rpmatch.out \ |
| 100 | $(objpfx)tst-trans.out $(objpfx)tst-ctype.out \ |
| 101 | $(objpfx)tst-langinfo.out $(objpfx)tst-langinfo-static.out \ |
| 102 | $(objpfx)tst-numeric.out |
| 103 | # We have to generate locales |
| 104 | LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ANSI_X3.4-1968 \ |
| 105 | en_US.ISO-8859-1 en_US.UTF-8 ja_JP.EUC-JP da_DK.ISO-8859-1 \ |
| 106 | hr_HR.ISO-8859-2 sv_SE.ISO-8859-1 ja_JP.SJIS fr_FR.ISO-8859-1 \ |
| 107 | nb_NO.ISO-8859-1 nn_NO.ISO-8859-1 tr_TR.UTF-8 cs_CZ.UTF-8 \ |
| 108 | zh_TW.EUC-TW fa_IR.UTF-8 fr_FR.UTF-8 ja_JP.UTF-8 si_LK.UTF-8 \ |
| 109 | tr_TR.ISO-8859-9 en_GB.UTF-8 uk_UA.UTF-8 |
| 110 | include ../gen-locales.mk |
| 111 | endif |
| 112 | |
| 113 | include ../Rules |
| 114 | |
| 115 | # Install the charmap files in gzipped format. |
| 116 | $(inst_i18ndir)/charmaps/%.gz: charmaps/% $(+force) |
| 117 | $(make-target-directory) |
| 118 | rm -f $(@:.gz=) $@ |
| 119 | $(INSTALL_DATA) $< $(@:.gz=) |
| 120 | gzip -9n $(@:.gz=) |
| 121 | |
| 122 | # Install the locale source files in the appropriate directory. |
| 123 | $(inst_i18ndir)/locales/%: locales/% $(+force); $(do-install) |
| 124 | |
| 125 | |
| 126 | ifeq ($(run-built-tests),yes) |
| 127 | generated-dirs += $(LOCALES) |
| 128 | |
| 129 | $(addsuffix .out,$(addprefix $(objpfx),$(tests))): %: \ |
| 130 | $(addprefix $(objpfx),$(CTYPE_FILES)) |
| 131 | |
| 132 | $(objpfx)sort-test.out: sort-test.sh $(objpfx)collate-test $(objpfx)xfrm-test \ |
| 133 | $(test-input-data) $(addprefix $(objpfx),$(CTYPE_FILES)) |
| 134 | $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \ |
| 135 | '$(run-program-env)' '$(test-program-prefix-after-env)' \ |
| 136 | $(test-input) \ |
| 137 | > $@; \ |
| 138 | $(evaluate-test) |
| 139 | $(objpfx)tst-fmon.out: tst-fmon.sh $(objpfx)tst-fmon tst-fmon.data \ |
| 140 | $(objpfx)sort-test.out \ |
| 141 | $(addprefix $(objpfx),$(CTYPE_FILES)) |
| 142 | $(SHELL) $< $(common-objpfx) '$(run-program-prefix-before-env)' \ |
| 143 | '$(run-program-env)' '$(run-program-prefix-after-env)' \ |
| 144 | '$(test-program-prefix)' tst-fmon.data \ |
| 145 | > $@; \ |
| 146 | $(evaluate-test) |
| 147 | $(objpfx)tst-numeric.out: tst-numeric.sh $(objpfx)tst-numeric tst-numeric.data \ |
| 148 | $(objpfx)sort-test.out \ |
| 149 | $(addprefix $(objpfx),$(CTYPE_FILES)) |
| 150 | $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' tst-numeric.data \ |
| 151 | > $@; \ |
| 152 | $(evaluate-test) |
| 153 | $(objpfx)tst-locale.out: tst-locale.sh $(common-objpfx)locale/localedef \ |
| 154 | $(ld-test-srcs) $(addprefix $(objpfx),$(CTYPE_FILES)) |
| 155 | $(SHELL) $< $(common-objpfx) '$(built-program-cmd-before-env)' \ |
| 156 | '$(run-program-env)' '$(built-program-cmd-after-env)' > $@; \ |
| 157 | $(evaluate-test) |
| 158 | $(objpfx)tst-rpmatch.out: tst-rpmatch.sh $(objpfx)tst-rpmatch \ |
| 159 | $(objpfx)tst-fmon.out \ |
| 160 | $(addprefix $(objpfx),$(CTYPE_FILES)) |
| 161 | $(SHELL) $< $(common-objpfx) '$(test-program-cmd)' > $@; \ |
| 162 | $(evaluate-test) |
| 163 | $(objpfx)tst-trans.out: tst-trans.sh $(objpfx)tst-trans \ |
| 164 | $(addprefix $(objpfx),$(CTYPE_FILES)) |
| 165 | $(SHELL) $< $(common-objpfx) '$(run-program-prefix-before-env)' \ |
| 166 | '$(run-program-env)' '$(run-program-prefix-after-env)' \ |
| 167 | '$(test-program-prefix-before-env)' \ |
| 168 | '$(test-program-prefix-after-env)'; \ |
| 169 | $(evaluate-test) |
| 170 | $(objpfx)tst-ctype.out: tst-ctype.sh $(objpfx)tst-ctype \ |
| 171 | $(objpfx)sort-test.out \ |
| 172 | $(addprefix $(objpfx),$(CTYPE_FILES)) |
| 173 | $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \ |
| 174 | '$(run-program-env)' '$(test-program-cmd-after-env)'; \ |
| 175 | $(evaluate-test) |
| 176 | $(objpfx)tst-langinfo.out: tst-langinfo.sh $(objpfx)tst-langinfo \ |
| 177 | $(objpfx)sort-test.out \ |
| 178 | $(addprefix $(objpfx),$(CTYPE_FILES)) |
| 179 | $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \ |
| 180 | '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \ |
| 181 | $(evaluate-test) |
| 182 | $(objpfx)tst-langinfo-static.out: tst-langinfo.sh $(objpfx)tst-langinfo-static \ |
| 183 | $(objpfx)sort-test.out \ |
| 184 | $(addprefix $(objpfx),$(CTYPE_FILES)) |
| 185 | $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \ |
| 186 | '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \ |
| 187 | $(evaluate-test) |
| 188 | $(objpfx)tst-digits.out: $(objpfx)tst-locale.out |
| 189 | $(objpfx)tst-mbswcs6.out: $(addprefix $(objpfx),$(CTYPE_FILES)) |
| 190 | endif |
| 191 | |
| 192 | include SUPPORTED |
| 193 | |
| 194 | INSTALL-SUPPORTED-LOCALES=$(addprefix install-, $(SUPPORTED-LOCALES)) |
| 195 | |
| 196 | # Sometimes the whole collection of locale files should be installed. |
| 197 | LOCALEDEF=I18NPATH=. GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \ |
| 198 | $(rtld-prefix) $(common-objpfx)locale/localedef |
| 199 | install-locales: $(INSTALL-SUPPORTED-LOCALES) |
| 200 | |
| 201 | install-locales-dir: |
| 202 | $(..)./scripts/mkinstalldirs $(inst_complocaledir) |
| 203 | |
| 204 | $(INSTALL-SUPPORTED-LOCALES): install-locales-dir |
| 205 | @locale=`echo $@ | sed -e 's/^install-//'`; \ |
| 206 | charset=`echo $$locale | sed -e 's,.*/,,'`; \ |
| 207 | locale=`echo $$locale | sed -e 's,/[^/]*,,'`; \ |
| 208 | echo -n `echo $$locale | sed 's/\([^.\@]*\).*/\1/'`; \ |
| 209 | echo -n ".$$charset"; \ |
| 210 | echo -n `echo $$locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \ |
| 211 | echo -n '...'; \ |
| 212 | input=`echo $$locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; \ |
| 213 | $(LOCALEDEF) --alias-file=../intl/locale.alias \ |
| 214 | -i locales/$$input -c -f charmaps/$$charset \ |
| 215 | $(addprefix --prefix=,$(install_root)) $$locale \ |
| 216 | && echo ' done'; \ |
| 217 | |
| 218 | tst-setlocale-ENV = LC_ALL=ja_JP.EUC-JP |
| 219 | tst-wctype-ENV = LC_ALL=ja_JP.EUC-JP |
| 220 | |
| 221 | tst-leaks-ENV = MALLOC_TRACE=$(objpfx)tst-leaks.mtrace |
| 222 | $(objpfx)mtrace-tst-leaks.out: $(objpfx)tst-leaks.out |
| 223 | $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@; \ |
| 224 | $(evaluate-test) |
| 225 | |
| 226 | bug-setlocale1-ENV-only = LOCPATH=$(objpfx) LC_CTYPE=de_DE.UTF-8 |
| 227 | bug-setlocale1-static-ENV-only = $(bug-setlocale1-ENV-only) |
| 228 | |
| 229 | $(objdir)/iconvdata/gconv-modules: |
| 230 | $(MAKE) -C ../iconvdata subdir=iconvdata $@ |