]> git.ipfire.org Git - thirdparty/glibc.git/blame - localedata/Makefile
Improve gen-locales.mk and gen-locale.sh to make test files with @ options work
[thirdparty/glibc.git] / localedata / Makefile
CommitLineData
688903eb 1# Copyright (C) 1996-2018 Free Software Foundation, Inc.
f5f52655
UD
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
41bdb6e2
AJ
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.
f5f52655
UD
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
41bdb6e2 12# Lesser General Public License for more details.
f5f52655 13
41bdb6e2 14# You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
15# License along with the GNU C Library; if not, see
16# <http://www.gnu.org/licenses/>.
f5f52655
UD
17
18# Makefile for installing locale data source files.
19
20subdir := localedata
21
a5f891ac 22include ../Makeconfig
f5f52655
UD
23
24# List with all available character set descriptions.
9d65ea3a 25charmaps := $(wildcard charmaps/[A-I]*) $(wildcard charmaps/[J-Z]*)
f5f52655
UD
26
27# List with all available character set descriptions.
9d65ea3a 28locales := $(wildcard locales/*)
f5f52655 29
5b905722
AJ
30
31subdir-dirs = tests-mbwc
32vpath %.c tests-mbwc
33vpath %.h tests-mbwc
34
35
316518d6 36test-srcs := collate-test xfrm-test tst-fmon tst-rpmatch tst-trans \
2976feab 37 tst-ctype tst-langinfo tst-langinfo-static tst-numeric
081e43f2 38test-input := de_DE.ISO-8859-1 en_US.ISO-8859-1 da_DK.ISO-8859-1 \
a5ff533e 39 hr_HR.ISO-8859-2 sv_SE.ISO-8859-1 tr_TR.UTF-8 fr_FR.UTF-8 \
3ffc4cc1 40 si_LK.UTF-8 uk_UA.UTF-8 hu_HU.UTF-8 lv_LV.UTF-8 \
fbb5fd03 41 pl_PL.UTF-8 cs_CZ.UTF-8 fr_CA.UTF-8 hr_HR.UTF-8 \
62ea2193 42 bs_BA.UTF-8 sr_RS.UTF-8 is_IS.UTF-8 et_EE.UTF-8 \
d89756eb 43 hsb_DE.UTF-8 lt_LT.UTF-8
56fa555a 44test-input-data = $(addsuffix .in, $(test-input))
da2d1bc5
UD
45test-output := $(foreach s, .out .xout, \
46 $(addsuffix $s, $(basename $(test-input))))
69c69fe1 47ld-test-names := test1 test2 test3 test4 test5 test6 test7
0a614877 48ld-test-srcs := $(addprefix tests/,$(addsuffix .cm,$(ld-test-names)) \
afa0569f 49 $(addsuffix .def,$(ld-test-names)) \
cf2964e2
UD
50 $(addsuffix .ds,test5 test6) \
51 test6.c trans.def)
880f421f 52
8956ac9e
UD
53fmon-tests = n01y12 n02n40 n10y31 n11y41 n12y11 n20n32 n30y20 n41n00 \
54 y01y10 y02n22 y22n42 y30y21 y32n31 y40y00 y42n21
55
f08e9a26 56generated += $(test-input) $(test-output) sort-test.out tst-locale.out \
2976feab 57 tst-leaks.mtrace mtrace-tst-leaks.out
f08e9a26 58generated-dirs += $(ld-test-names) tt_TT de_DE.437 \
40c4c9b5 59 $(addprefix tstfmon_,$(fmon-tests)) \
414fd335 60
03ac099f 61ifeq ($(run-built-tests),yes)
5ca8accd
AJ
62locale_test_suite := tst_iswalnum tst_iswalpha tst_iswcntrl \
63 tst_iswctype tst_iswdigit tst_iswgraph \
64 tst_iswlower tst_iswprint tst_iswpunct \
65 tst_iswspace tst_iswupper tst_iswxdigit tst_mblen \
66 tst_mbrlen tst_mbrtowc tst_mbsrtowcs tst_mbstowcs \
67 tst_mbtowc tst_strcoll tst_strfmon tst_strxfrm \
68 tst_swscanf tst_towctrans tst_towlower \
69 tst_towupper tst_wcrtomb tst_wcscat tst_wcschr \
70 tst_wcscmp tst_wcscoll tst_wcscpy tst_wcscspn \
71 tst_wcslen tst_wcsncat tst_wcsncmp tst_wcsncpy \
72 tst_wcspbrk tst_wcsrtombs tst_wcsspn tst_wcsstr \
73 tst_wcstod tst_wcstok tst_wcstombs tst_wcswidth \
74 tst_wcsxfrm tst_wctob tst_wctomb tst_wctrans \
75 tst_wctype tst_wcwidth
2e23c3cc 76
7bcad280 77tests = $(locale_test_suite) tst-digits tst-setlocale bug-iconv-trans \
2976feab
JM
78 tst-leaks tst-mbswcs1 tst-mbswcs2 tst-mbswcs3 tst-mbswcs4 tst-mbswcs5 \
79 tst-mbswcs6 tst-xlocale1 tst-xlocale2 bug-usesetlocale \
4e8f95a0
FW
80 tst-strfmon1 tst-sscanf bug-setlocale1 tst-setlocale2 tst-setlocale3 \
81 tst-wctype
c34521ce
L
82tests-static = bug-setlocale1-static
83tests += $(tests-static)
7bcad280
UD
84ifeq (yes,$(build-shared))
85ifneq (no,$(PERL))
0b20a9e8 86tests-special += $(objpfx)mtrace-tst-leaks.out
7bcad280
UD
87endif
88endif
0e16ecfa 89endif
0e16ecfa 90
f5f52655 91# Files to install.
d77cd295
UD
92install-others := $(addprefix $(inst_i18ndir)/, \
93 $(addsuffix .gz, $(charmaps)) \
94 $(locales))
f5f52655 95
23433315
PP
96tests: $(objdir)/iconvdata/gconv-modules
97
85bb81c9
WN
98tests-static += tst-langinfo-static
99
100ifeq ($(run-built-tests),yes)
f214606a
JM
101tests-special += $(objpfx)sort-test.out $(objpfx)tst-fmon.out \
102 $(objpfx)tst-locale.out $(objpfx)tst-rpmatch.out \
2976feab 103 $(objpfx)tst-trans.out $(objpfx)tst-ctype.out \
ae75a883
AJ
104 $(objpfx)tst-langinfo.out $(objpfx)tst-langinfo-static.out \
105 $(objpfx)tst-numeric.out
6f99f280
JM
106# We have to generate locales
107LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ANSI_X3.4-1968 \
108 en_US.ISO-8859-1 en_US.UTF-8 ja_JP.EUC-JP da_DK.ISO-8859-1 \
109 hr_HR.ISO-8859-2 sv_SE.ISO-8859-1 ja_JP.SJIS fr_FR.ISO-8859-1 \
110 nb_NO.ISO-8859-1 nn_NO.ISO-8859-1 tr_TR.UTF-8 cs_CZ.UTF-8 \
111 zh_TW.EUC-TW fa_IR.UTF-8 fr_FR.UTF-8 ja_JP.UTF-8 si_LK.UTF-8 \
3ffc4cc1 112 tr_TR.ISO-8859-9 en_GB.UTF-8 uk_UA.UTF-8 hu_HU.UTF-8 lv_LV.UTF-8 \
d985adae 113 pl_PL.UTF-8 fr_CA.UTF-8 hr_HR.UTF-8 bs_BA.UTF-8 sr_RS.UTF-8 \
d89756eb 114 is_IS.UTF-8 et_EE.UTF-8 hsb_DE.UTF-8 lt_LT.UTF-8
9f53d7ad 115include ../gen-locales.mk
6f99f280
JM
116endif
117
f5f52655
UD
118include ../Rules
119
d77cd295
UD
120# Install the charmap files in gzipped format.
121$(inst_i18ndir)/charmaps/%.gz: charmaps/% $(+force)
122 $(make-target-directory)
123 rm -f $(@:.gz=) $@
124 $(INSTALL_DATA) $< $(@:.gz=)
962edb7e 125 gzip -9n $(@:.gz=)
d77cd295
UD
126
127# Install the locale source files in the appropriate directory.
73237de3 128$(inst_i18ndir)/locales/%: locales/% $(+force); $(do-install)
f5f52655 129
03ac099f 130ifeq ($(run-built-tests),yes)
40c4c9b5
UD
131generated-dirs += $(LOCALES)
132
9f2bedd0 133$(addsuffix .out,$(addprefix $(objpfx),$(tests))): %: \
5e087c71
UD
134 $(addprefix $(objpfx),$(CTYPE_FILES))
135
ca41028b
UD
136$(objpfx)sort-test.out: sort-test.sh $(objpfx)collate-test $(objpfx)xfrm-test \
137 $(test-input-data) $(addprefix $(objpfx),$(CTYPE_FILES))
8540f6d2
JM
138 $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
139 '$(run-program-env)' '$(test-program-prefix-after-env)' \
140 $(test-input) \
f0881698
JM
141 > $@; \
142 $(evaluate-test)
ca41028b
UD
143$(objpfx)tst-fmon.out: tst-fmon.sh $(objpfx)tst-fmon tst-fmon.data \
144 $(objpfx)sort-test.out \
145 $(addprefix $(objpfx),$(CTYPE_FILES))
8540f6d2
JM
146 $(SHELL) $< $(common-objpfx) '$(run-program-prefix-before-env)' \
147 '$(run-program-env)' '$(run-program-prefix-after-env)' \
148 '$(test-program-prefix)' tst-fmon.data \
f0881698
JM
149 > $@; \
150 $(evaluate-test)
76352f64
UD
151$(objpfx)tst-numeric.out: tst-numeric.sh $(objpfx)tst-numeric tst-numeric.data \
152 $(objpfx)sort-test.out \
153 $(addprefix $(objpfx),$(CTYPE_FILES))
740b3dbe 154 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' tst-numeric.data \
f0881698
JM
155 > $@; \
156 $(evaluate-test)
ca41028b
UD
157$(objpfx)tst-locale.out: tst-locale.sh $(common-objpfx)locale/localedef \
158 $(ld-test-srcs) $(addprefix $(objpfx),$(CTYPE_FILES))
8540f6d2
JM
159 $(SHELL) $< $(common-objpfx) '$(built-program-cmd-before-env)' \
160 '$(run-program-env)' '$(built-program-cmd-after-env)' > $@; \
f0881698 161 $(evaluate-test)
ca41028b
UD
162$(objpfx)tst-rpmatch.out: tst-rpmatch.sh $(objpfx)tst-rpmatch \
163 $(objpfx)tst-fmon.out \
164 $(addprefix $(objpfx),$(CTYPE_FILES))
f0881698
JM
165 $(SHELL) $< $(common-objpfx) '$(test-program-cmd)' > $@; \
166 $(evaluate-test)
ca41028b
UD
167$(objpfx)tst-trans.out: tst-trans.sh $(objpfx)tst-trans \
168 $(addprefix $(objpfx),$(CTYPE_FILES))
8540f6d2
JM
169 $(SHELL) $< $(common-objpfx) '$(run-program-prefix-before-env)' \
170 '$(run-program-env)' '$(run-program-prefix-after-env)' \
171 '$(test-program-prefix-before-env)' \
d5afb385 172 '$(test-program-prefix-after-env)' > $@; \
f0881698 173 $(evaluate-test)
ca41028b
UD
174$(objpfx)tst-ctype.out: tst-ctype.sh $(objpfx)tst-ctype \
175 $(objpfx)sort-test.out \
176 $(addprefix $(objpfx),$(CTYPE_FILES))
8540f6d2 177 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
d5afb385 178 '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
f0881698 179 $(evaluate-test)
f79d99cb
UD
180$(objpfx)tst-langinfo.out: tst-langinfo.sh $(objpfx)tst-langinfo \
181 $(objpfx)sort-test.out \
182 $(addprefix $(objpfx),$(CTYPE_FILES))
8540f6d2
JM
183 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
184 '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
ae75a883
AJ
185 $(evaluate-test)
186$(objpfx)tst-langinfo-static.out: tst-langinfo.sh $(objpfx)tst-langinfo-static \
187 $(objpfx)sort-test.out \
188 $(addprefix $(objpfx),$(CTYPE_FILES))
8540f6d2
JM
189 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
190 '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
f0881698 191 $(evaluate-test)
69c69fe1 192$(objpfx)tst-digits.out: $(objpfx)tst-locale.out
db2d05f9 193$(objpfx)tst-mbswcs6.out: $(addprefix $(objpfx),$(CTYPE_FILES))
df455ccb 194endif
92610fbe 195
f7364247
UD
196include SUPPORTED
197
198INSTALL-SUPPORTED-LOCALES=$(addprefix install-, $(SUPPORTED-LOCALES))
199
92610fbe 200# Sometimes the whole collection of locale files should be installed.
246a9a19 201LOCALEDEF=I18NPATH=. GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
85d89278 202$(rtld-prefix) $(common-objpfx)locale/localedef
f7364247
UD
203install-locales: $(INSTALL-SUPPORTED-LOCALES)
204
205install-locales-dir:
90fe682d 206 $(..)./scripts/mkinstalldirs $(inst_complocaledir)
f7364247 207
02eec681
CD
208# The SHIFT_JIS and SHIFT_JISX0213 character maps are not ASCII compatible,
209# therefore we have to use --no-warnings=ascii to disable the ASCII check.
210# See localedata/gen-locale.sh for the same logic.
f7364247
UD
211$(INSTALL-SUPPORTED-LOCALES): install-locales-dir
212 @locale=`echo $@ | sed -e 's/^install-//'`; \
213 charset=`echo $$locale | sed -e 's,.*/,,'`; \
214 locale=`echo $$locale | sed -e 's,/[^/]*,,'`; \
81be4b5e 215 flags="-c"; \
02eec681
CD
216 if [ "$$charset" = 'SHIFT_JIS' ] \
217 || [ "$$charset" = 'SHIFT_JISX0213' ]; then \
218 flags="$$flags --no-warnings=ascii"; \
219 fi; \
f7364247
UD
220 echo -n `echo $$locale | sed 's/\([^.\@]*\).*/\1/'`; \
221 echo -n ".$$charset"; \
222 echo -n `echo $$locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \
223 echo -n '...'; \
224 input=`echo $$locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; \
02eec681
CD
225 $(LOCALEDEF) $$flags --alias-file=../intl/locale.alias \
226 -i locales/$$input -f charmaps/$$charset \
6c307927
CD
227 $(addprefix --prefix=,$(install_root)) $$locale \
228 && echo ' done'; \
5b905722 229
2bf18041 230tst-setlocale-ENV = LC_ALL=ja_JP.EUC-JP
2976feab 231tst-wctype-ENV = LC_ALL=ja_JP.EUC-JP
2bf18041
JM
232
233tst-leaks-ENV = MALLOC_TRACE=$(objpfx)tst-leaks.mtrace
0b20a9e8 234$(objpfx)mtrace-tst-leaks.out: $(objpfx)tst-leaks.out
f0881698
JM
235 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@; \
236 $(evaluate-test)
23433315 237
9162c01d
RM
238bug-setlocale1-ENV-only = LOCPATH=$(objpfx) LC_CTYPE=de_DE.UTF-8
239bug-setlocale1-static-ENV-only = $(bug-setlocale1-ENV-only)
cc9e536d 240
23433315
PP
241$(objdir)/iconvdata/gconv-modules:
242 $(MAKE) -C ../iconvdata subdir=iconvdata $@