]> git.ipfire.org Git - thirdparty/glibc.git/blob - localedata/Makefile
Don't require test wrappers to preserve environment variables, use more consistent...
[thirdparty/glibc.git] / localedata / Makefile
1 # Copyright (C) 1996-2014 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-mbswcs1 tst-mbswcs2 tst-mbswcs3 tst-mbswcs4 tst-mbswcs5 \
38 tst-ctype tst-wctype tst-langinfo tst-langinfo-static tst-numeric
39 test-input := de_DE.ISO-8859-1 en_US.ISO-8859-1 da_DK.ISO-8859-1 \
40 hr_HR.ISO-8859-2 sv_SE.ISO-8859-1 tr_TR.UTF-8 fr_FR.UTF-8 \
41 si_LK.UTF-8
42 test-input-data = $(addsuffix .in, $(basename $(test-input)))
43 test-output := $(foreach s, .out .xout, \
44 $(addsuffix $s, $(basename $(test-input))))
45 ld-test-names := test1 test2 test3 test4 test5 test6 test7
46 ld-test-srcs := $(addprefix tests/,$(addsuffix .cm,$(ld-test-names)) \
47 $(addsuffix .def,$(ld-test-names)) \
48 $(addsuffix .ds,test5 test6) \
49 test6.c trans.def)
50
51 fmon-tests = n01y12 n02n40 n10y31 n11y41 n12y11 n20n32 n30y20 n41n00 \
52 y01y10 y02n22 y22n42 y30y21 y32n31 y40y00 y42n21
53
54 generated += $(test-input) $(test-output) sort-test.out tst-locale.out \
55 tst-mbswcs.out tst-leaks.mtrace mtrace-tst-leaks.out
56 generated-dirs += $(ld-test-names) tt_TT de_DE.437 \
57 $(addprefix tstfmon_,$(fmon-tests)) \
58
59 ifeq ($(run-built-tests),yes)
60 locale_test_suite := tst_iswalnum tst_iswalpha tst_iswcntrl \
61 tst_iswctype tst_iswdigit tst_iswgraph \
62 tst_iswlower tst_iswprint tst_iswpunct \
63 tst_iswspace tst_iswupper tst_iswxdigit tst_mblen \
64 tst_mbrlen tst_mbrtowc tst_mbsrtowcs tst_mbstowcs \
65 tst_mbtowc tst_strcoll tst_strfmon tst_strxfrm \
66 tst_swscanf tst_towctrans tst_towlower \
67 tst_towupper tst_wcrtomb tst_wcscat tst_wcschr \
68 tst_wcscmp tst_wcscoll tst_wcscpy tst_wcscspn \
69 tst_wcslen tst_wcsncat tst_wcsncmp tst_wcsncpy \
70 tst_wcspbrk tst_wcsrtombs tst_wcsspn tst_wcsstr \
71 tst_wcstod tst_wcstok tst_wcstombs tst_wcswidth \
72 tst_wcsxfrm tst_wctob tst_wctomb tst_wctrans \
73 tst_wctype tst_wcwidth
74
75 tests = $(locale_test_suite) tst-digits tst-setlocale bug-iconv-trans \
76 tst-leaks tst-mbswcs6 tst-xlocale1 tst-xlocale2 bug-usesetlocale \
77 tst-strfmon1 tst-sscanf bug-setlocale1 tst-setlocale2
78 tests-static = bug-setlocale1-static
79 tests += $(tests-static)
80 ifeq (yes,$(build-shared))
81 ifneq (no,$(PERL))
82 tests-special += $(objpfx)mtrace-tst-leaks.out
83 endif
84 endif
85 endif
86
87 # Files to install.
88 install-others := $(addprefix $(inst_i18ndir)/, \
89 $(addsuffix .gz, $(charmaps)) \
90 $(locales))
91
92 tests: $(objdir)/iconvdata/gconv-modules
93
94 tests-special += $(objpfx)sort-test.out $(objpfx)tst-fmon.out \
95 $(objpfx)tst-locale.out $(objpfx)tst-rpmatch.out \
96 $(objpfx)tst-trans.out $(objpfx)tst-mbswcs.out \
97 $(objpfx)tst-ctype.out $(objpfx)tst-wctype.out \
98 $(objpfx)tst-langinfo.out $(objpfx)tst-langinfo-static.out \
99 $(objpfx)tst-numeric.out
100 tests-static += tst-langinfo-static
101
102 ifeq ($(run-built-tests),yes)
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
110 LOCALE_SRCS := $(shell echo "$(LOCALES)"|sed 's/\([^ .]*\)[^ ]*/\1/g')
111 CHARMAPS := $(shell echo "$(LOCALES)" | \
112 sed -e 's/[^ .]*[.]\([^ ]*\)/\1/g' -e s/SJIS/SHIFT_JIS/g)
113 CTYPE_FILES = $(addsuffix /LC_CTYPE,$(LOCALES))
114 tests-special += $(addprefix $(objpfx),$(CTYPE_FILES))
115 endif
116
117 include ../Rules
118
119 # Install the charmap files in gzipped format.
120 $(inst_i18ndir)/charmaps/%.gz: charmaps/% $(+force)
121 $(make-target-directory)
122 rm -f $(@:.gz=) $@
123 $(INSTALL_DATA) $< $(@:.gz=)
124 gzip -9n $(@:.gz=)
125
126 # Install the locale source files in the appropriate directory.
127 $(inst_i18ndir)/locales/%: locales/% $(+force); $(do-install)
128
129 # gcc does not know all the format specifiers we are using here.
130 CFLAGS-tst-mbswcs1.c = -Wno-format
131 CFLAGS-tst-mbswcs2.c = -Wno-format
132 CFLAGS-tst-mbswcs3.c = -Wno-format
133 CFLAGS-tst-mbswcs4.c = -Wno-format
134 CFLAGS-tst-mbswcs5.c = -Wno-format
135 CFLAGS-tst-trans.c = -Wno-format
136
137
138 ifeq ($(run-built-tests),yes)
139 generated-dirs += $(LOCALES)
140
141 # Dependency for the locale files. We actually make it depend only on
142 # one of the files.
143 $(addprefix $(objpfx),$(CTYPE_FILES)): %: \
144 gen-locale.sh $(common-objpfx)locale/localedef Makefile \
145 $(addprefix charmaps/,$(CHARMAPS)) $(addprefix locales/,$(LOCALE_SRCS))
146 @$(SHELL) gen-locale.sh $(common-objpfx) \
147 '$(built-program-cmd-before-env)' '$(run-program-env)' \
148 '$(built-program-cmd-after-env)' $@; \
149 $(evaluate-test)
150
151 $(addsuffix .out,$(addprefix $(objpfx),$(tests))): %: \
152 $(addprefix $(objpfx),$(CTYPE_FILES))
153
154 $(objpfx)sort-test.out: sort-test.sh $(objpfx)collate-test $(objpfx)xfrm-test \
155 $(test-input-data) $(addprefix $(objpfx),$(CTYPE_FILES))
156 $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
157 '$(run-program-env)' '$(test-program-prefix-after-env)' \
158 $(test-input) \
159 > $@; \
160 $(evaluate-test)
161 $(objpfx)tst-fmon.out: tst-fmon.sh $(objpfx)tst-fmon tst-fmon.data \
162 $(objpfx)sort-test.out \
163 $(addprefix $(objpfx),$(CTYPE_FILES))
164 $(SHELL) $< $(common-objpfx) '$(run-program-prefix-before-env)' \
165 '$(run-program-env)' '$(run-program-prefix-after-env)' \
166 '$(test-program-prefix)' tst-fmon.data \
167 > $@; \
168 $(evaluate-test)
169 $(objpfx)tst-numeric.out: tst-numeric.sh $(objpfx)tst-numeric tst-numeric.data \
170 $(objpfx)sort-test.out \
171 $(addprefix $(objpfx),$(CTYPE_FILES))
172 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' tst-numeric.data \
173 > $@; \
174 $(evaluate-test)
175 $(objpfx)tst-locale.out: tst-locale.sh $(common-objpfx)locale/localedef \
176 $(ld-test-srcs) $(addprefix $(objpfx),$(CTYPE_FILES))
177 $(SHELL) $< $(common-objpfx) '$(built-program-cmd-before-env)' \
178 '$(run-program-env)' '$(built-program-cmd-after-env)' > $@; \
179 $(evaluate-test)
180 $(objpfx)tst-rpmatch.out: tst-rpmatch.sh $(objpfx)tst-rpmatch \
181 $(objpfx)tst-fmon.out \
182 $(addprefix $(objpfx),$(CTYPE_FILES))
183 $(SHELL) $< $(common-objpfx) '$(test-program-cmd)' > $@; \
184 $(evaluate-test)
185 $(objpfx)tst-trans.out: tst-trans.sh $(objpfx)tst-trans \
186 $(addprefix $(objpfx),$(CTYPE_FILES))
187 $(SHELL) $< $(common-objpfx) '$(run-program-prefix-before-env)' \
188 '$(run-program-env)' '$(run-program-prefix-after-env)' \
189 '$(test-program-prefix-before-env)' \
190 '$(test-program-prefix-after-env)'; \
191 $(evaluate-test)
192 $(objpfx)tst-mbswcs.out: tst-mbswcs.sh $(objpfx)tst-mbswcs1 \
193 $(objpfx)tst-mbswcs2 $(objpfx)tst-mbswcs3 \
194 $(objpfx)tst-mbswcs4 $(objpfx)tst-mbswcs5 \
195 $(addprefix $(objpfx),$(CTYPE_FILES))
196 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'; \
197 $(evaluate-test)
198 $(objpfx)tst-ctype.out: tst-ctype.sh $(objpfx)tst-ctype \
199 $(objpfx)sort-test.out \
200 $(addprefix $(objpfx),$(CTYPE_FILES))
201 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
202 '$(run-program-env)' '$(test-program-cmd-after-env)'; \
203 $(evaluate-test)
204 $(objpfx)tst-wctype.out: tst-wctype.sh $(objpfx)tst-wctype \
205 $(objpfx)sort-test.out tst-wctype.input \
206 $(addprefix $(objpfx),$(CTYPE_FILES))
207 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
208 '$(run-program-env)' '$(test-program-cmd-after-env)'; \
209 $(evaluate-test)
210 $(objpfx)tst-langinfo.out: tst-langinfo.sh $(objpfx)tst-langinfo \
211 $(objpfx)sort-test.out \
212 $(addprefix $(objpfx),$(CTYPE_FILES))
213 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
214 '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
215 $(evaluate-test)
216 $(objpfx)tst-langinfo-static.out: tst-langinfo.sh $(objpfx)tst-langinfo-static \
217 $(objpfx)sort-test.out \
218 $(addprefix $(objpfx),$(CTYPE_FILES))
219 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
220 '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
221 $(evaluate-test)
222 $(objpfx)tst-digits.out: $(objpfx)tst-locale.out
223 $(objpfx)tst-mbswcs6.out: $(addprefix $(objpfx),$(CTYPE_FILES))
224 endif
225
226 include SUPPORTED
227
228 INSTALL-SUPPORTED-LOCALES=$(addprefix install-, $(SUPPORTED-LOCALES))
229
230 # Sometimes the whole collection of locale files should be installed.
231 LOCALEDEF=I18NPATH=. GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
232 $(elf-objpfx)ld.so --library-path $(rpath-link) $(common-objpfx)locale/localedef
233 install-locales: $(INSTALL-SUPPORTED-LOCALES)
234
235 install-locales-dir:
236 $(..)./scripts/mkinstalldirs $(inst_localedir)
237
238 $(INSTALL-SUPPORTED-LOCALES): install-locales-dir
239 @locale=`echo $@ | sed -e 's/^install-//'`; \
240 charset=`echo $$locale | sed -e 's,.*/,,'`; \
241 locale=`echo $$locale | sed -e 's,/[^/]*,,'`; \
242 echo -n `echo $$locale | sed 's/\([^.\@]*\).*/\1/'`; \
243 echo -n ".$$charset"; \
244 echo -n `echo $$locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \
245 echo -n '...'; \
246 input=`echo $$locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; \
247 $(LOCALEDEF) --alias-file=../intl/locale.alias \
248 -i locales/$$input -c -f charmaps/$$charset \
249 $(addprefix --prefix=,$(install_root)) $$locale; \
250 echo ' done'; \
251
252 tst-setlocale-ENV = LC_ALL=ja_JP.EUC-JP
253
254 tst-leaks-ENV = MALLOC_TRACE=$(objpfx)tst-leaks.mtrace
255 $(objpfx)mtrace-tst-leaks.out: $(objpfx)tst-leaks.out
256 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@; \
257 $(evaluate-test)
258
259 bug-setlocale1-ARGS = -- $(host-test-program-cmd)
260 bug-setlocale1-static-ARGS = $(bug-setlocale1-ARGS)
261
262 $(objdir)/iconvdata/gconv-modules:
263 $(MAKE) -C ../iconvdata subdir=iconvdata $@