]> git.ipfire.org Git - thirdparty/glibc.git/blame - localedata/Makefile
Consistently use $(elf-objpfx).
[thirdparty/glibc.git] / localedata / Makefile
CommitLineData
d4697bc9 1# Copyright (C) 1996-2014 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 \
465e7beb 37 tst-mbswcs1 tst-mbswcs2 tst-mbswcs3 tst-mbswcs4 tst-mbswcs5 \
ae75a883 38 tst-ctype tst-wctype tst-langinfo tst-langinfo-static tst-numeric
081e43f2 39test-input := de_DE.ISO-8859-1 en_US.ISO-8859-1 da_DK.ISO-8859-1 \
a5ff533e
UD
40 hr_HR.ISO-8859-2 sv_SE.ISO-8859-1 tr_TR.UTF-8 fr_FR.UTF-8 \
41 si_LK.UTF-8
d17a729b 42test-input-data = $(addsuffix .in, $(basename $(test-input)))
da2d1bc5
UD
43test-output := $(foreach s, .out .xout, \
44 $(addsuffix $s, $(basename $(test-input))))
69c69fe1 45ld-test-names := test1 test2 test3 test4 test5 test6 test7
0a614877 46ld-test-srcs := $(addprefix tests/,$(addsuffix .cm,$(ld-test-names)) \
afa0569f 47 $(addsuffix .def,$(ld-test-names)) \
cf2964e2
UD
48 $(addsuffix .ds,test5 test6) \
49 test6.c trans.def)
880f421f 50
8956ac9e
UD
51fmon-tests = n01y12 n02n40 n10y31 n11y41 n12y11 n20n32 n30y20 n41n00 \
52 y01y10 y02n22 y22n42 y30y21 y32n31 y40y00 y42n21
53
f08e9a26 54generated += $(test-input) $(test-output) sort-test.out tst-locale.out \
0b20a9e8 55 tst-mbswcs.out tst-leaks.mtrace mtrace-tst-leaks.out
f08e9a26 56generated-dirs += $(ld-test-names) tt_TT de_DE.437 \
40c4c9b5 57 $(addprefix tstfmon_,$(fmon-tests)) \
414fd335 58
03ac099f 59ifeq ($(run-built-tests),yes)
5ca8accd
AJ
60locale_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
2e23c3cc 74
7bcad280 75tests = $(locale_test_suite) tst-digits tst-setlocale bug-iconv-trans \
c61a9cfb 76 tst-leaks tst-mbswcs6 tst-xlocale1 tst-xlocale2 bug-usesetlocale \
5fefb436 77 tst-strfmon1 tst-sscanf bug-setlocale1 tst-setlocale2
c34521ce
L
78tests-static = bug-setlocale1-static
79tests += $(tests-static)
7bcad280
UD
80ifeq (yes,$(build-shared))
81ifneq (no,$(PERL))
0b20a9e8 82tests-special += $(objpfx)mtrace-tst-leaks.out
7bcad280
UD
83endif
84endif
0e16ecfa 85endif
0e16ecfa 86
f5f52655 87# Files to install.
d77cd295
UD
88install-others := $(addprefix $(inst_i18ndir)/, \
89 $(addsuffix .gz, $(charmaps)) \
90 $(locales))
f5f52655 91
23433315
PP
92tests: $(objdir)/iconvdata/gconv-modules
93
f214606a
JM
94tests-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 \
ae75a883
AJ
98 $(objpfx)tst-langinfo.out $(objpfx)tst-langinfo-static.out \
99 $(objpfx)tst-numeric.out
100tests-static += tst-langinfo-static
f214606a 101
6f99f280
JM
102ifeq ($(run-built-tests),yes)
103# We have to generate locales
104LOCALES := 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
110LOCALE_SRCS := $(shell echo "$(LOCALES)"|sed 's/\([^ .]*\)[^ ]*/\1/g')
111CHARMAPS := $(shell echo "$(LOCALES)" | \
112 sed -e 's/[^ .]*[.]\([^ ]*\)/\1/g' -e s/SJIS/SHIFT_JIS/g)
113CTYPE_FILES = $(addsuffix /LC_CTYPE,$(LOCALES))
114tests-special += $(addprefix $(objpfx),$(CTYPE_FILES))
115endif
116
f5f52655
UD
117include ../Rules
118
d77cd295
UD
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=)
962edb7e 124 gzip -9n $(@:.gz=)
d77cd295
UD
125
126# Install the locale source files in the appropriate directory.
73237de3 127$(inst_i18ndir)/locales/%: locales/% $(+force); $(do-install)
f5f52655 128
d6204268
UD
129# gcc does not know all the format specifiers we are using here.
130CFLAGS-tst-mbswcs1.c = -Wno-format
131CFLAGS-tst-mbswcs2.c = -Wno-format
132CFLAGS-tst-mbswcs3.c = -Wno-format
133CFLAGS-tst-mbswcs4.c = -Wno-format
134CFLAGS-tst-mbswcs5.c = -Wno-format
135CFLAGS-tst-trans.c = -Wno-format
f5f52655 136
0e16ecfa 137
03ac099f 138ifeq ($(run-built-tests),yes)
40c4c9b5
UD
139generated-dirs += $(LOCALES)
140
5e087c71
UD
141# Dependency for the locale files. We actually make it depend only on
142# one of the files.
143$(addprefix $(objpfx),$(CTYPE_FILES)): %: \
9f835f5f 144 gen-locale.sh $(common-objpfx)locale/localedef Makefile \
5e087c71 145 $(addprefix charmaps/,$(CHARMAPS)) $(addprefix locales/,$(LOCALE_SRCS))
6f99f280
JM
146 @$(SHELL) gen-locale.sh $(common-objpfx) '$(built-program-cmd)' $@; \
147 $(evaluate-test)
5e087c71 148
9f2bedd0 149$(addsuffix .out,$(addprefix $(objpfx),$(tests))): %: \
5e087c71
UD
150 $(addprefix $(objpfx),$(CTYPE_FILES))
151
ca41028b
UD
152$(objpfx)sort-test.out: sort-test.sh $(objpfx)collate-test $(objpfx)xfrm-test \
153 $(test-input-data) $(addprefix $(objpfx),$(CTYPE_FILES))
740b3dbe 154 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' $(test-input) \
f0881698
JM
155 > $@; \
156 $(evaluate-test)
ca41028b
UD
157$(objpfx)tst-fmon.out: tst-fmon.sh $(objpfx)tst-fmon tst-fmon.data \
158 $(objpfx)sort-test.out \
159 $(addprefix $(objpfx),$(CTYPE_FILES))
740b3dbe
L
160 $(SHELL) $< $(common-objpfx) '$(run-program-prefix)' \
161 '$(test-program-prefix)' tst-fmon.data \
f0881698
JM
162 > $@; \
163 $(evaluate-test)
76352f64
UD
164$(objpfx)tst-numeric.out: tst-numeric.sh $(objpfx)tst-numeric tst-numeric.data \
165 $(objpfx)sort-test.out \
166 $(addprefix $(objpfx),$(CTYPE_FILES))
740b3dbe 167 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' tst-numeric.data \
f0881698
JM
168 > $@; \
169 $(evaluate-test)
ca41028b
UD
170$(objpfx)tst-locale.out: tst-locale.sh $(common-objpfx)locale/localedef \
171 $(ld-test-srcs) $(addprefix $(objpfx),$(CTYPE_FILES))
f0881698
JM
172 $(SHELL) $< $(common-objpfx) '$(built-program-cmd)' > $@; \
173 $(evaluate-test)
ca41028b
UD
174$(objpfx)tst-rpmatch.out: tst-rpmatch.sh $(objpfx)tst-rpmatch \
175 $(objpfx)tst-fmon.out \
176 $(addprefix $(objpfx),$(CTYPE_FILES))
f0881698
JM
177 $(SHELL) $< $(common-objpfx) '$(test-program-cmd)' > $@; \
178 $(evaluate-test)
ca41028b
UD
179$(objpfx)tst-trans.out: tst-trans.sh $(objpfx)tst-trans \
180 $(addprefix $(objpfx),$(CTYPE_FILES))
f0881698
JM
181 $(SHELL) $< $(common-objpfx) '$(run-program-prefix)' '$(test-program-prefix)'; \
182 $(evaluate-test)
ca41028b
UD
183$(objpfx)tst-mbswcs.out: tst-mbswcs.sh $(objpfx)tst-mbswcs1 \
184 $(objpfx)tst-mbswcs2 $(objpfx)tst-mbswcs3 \
185 $(objpfx)tst-mbswcs4 $(objpfx)tst-mbswcs5 \
186 $(addprefix $(objpfx),$(CTYPE_FILES))
f0881698
JM
187 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'; \
188 $(evaluate-test)
ca41028b
UD
189$(objpfx)tst-ctype.out: tst-ctype.sh $(objpfx)tst-ctype \
190 $(objpfx)sort-test.out \
191 $(addprefix $(objpfx),$(CTYPE_FILES))
f0881698
JM
192 $(SHELL) $< $(common-objpfx) '$(test-program-cmd)'; \
193 $(evaluate-test)
a64e8af1
UD
194$(objpfx)tst-wctype.out: tst-wctype.sh $(objpfx)tst-wctype \
195 $(objpfx)sort-test.out tst-wctype.input \
196 $(addprefix $(objpfx),$(CTYPE_FILES))
f0881698
JM
197 $(SHELL) $< $(common-objpfx) '$(test-program-cmd)'; \
198 $(evaluate-test)
f79d99cb
UD
199$(objpfx)tst-langinfo.out: tst-langinfo.sh $(objpfx)tst-langinfo \
200 $(objpfx)sort-test.out \
201 $(addprefix $(objpfx),$(CTYPE_FILES))
ae75a883
AJ
202 $(SHELL) $< $(common-objpfx) '$(test-program-cmd)' > $@; \
203 $(evaluate-test)
204$(objpfx)tst-langinfo-static.out: tst-langinfo.sh $(objpfx)tst-langinfo-static \
205 $(objpfx)sort-test.out \
206 $(addprefix $(objpfx),$(CTYPE_FILES))
207 $(SHELL) $< $(common-objpfx) '$(test-program-cmd)' > $@; \
f0881698 208 $(evaluate-test)
69c69fe1 209$(objpfx)tst-digits.out: $(objpfx)tst-locale.out
db2d05f9 210$(objpfx)tst-mbswcs6.out: $(addprefix $(objpfx),$(CTYPE_FILES))
df455ccb 211endif
92610fbe 212
f7364247
UD
213include SUPPORTED
214
215INSTALL-SUPPORTED-LOCALES=$(addprefix install-, $(SUPPORTED-LOCALES))
216
92610fbe 217# Sometimes the whole collection of locale files should be installed.
246a9a19 218LOCALEDEF=I18NPATH=. GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
4134b50d 219$(elf-objpfx)ld.so --library-path $(rpath-link) $(common-objpfx)locale/localedef
f7364247
UD
220install-locales: $(INSTALL-SUPPORTED-LOCALES)
221
222install-locales-dir:
f14854aa 223 $(..)./scripts/mkinstalldirs $(inst_localedir)
f7364247
UD
224
225$(INSTALL-SUPPORTED-LOCALES): install-locales-dir
226 @locale=`echo $@ | sed -e 's/^install-//'`; \
227 charset=`echo $$locale | sed -e 's,.*/,,'`; \
228 locale=`echo $$locale | sed -e 's,/[^/]*,,'`; \
229 echo -n `echo $$locale | sed 's/\([^.\@]*\).*/\1/'`; \
230 echo -n ".$$charset"; \
231 echo -n `echo $$locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \
232 echo -n '...'; \
233 input=`echo $$locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; \
aa97cce1
RM
234 $(LOCALEDEF) --alias-file=../intl/locale.alias \
235 -i locales/$$input -c -f charmaps/$$charset \
236 $(addprefix --prefix=,$(install_root)) $$locale; \
f7364247 237 echo ' done'; \
5b905722 238
2e23c3cc 239# The mbwc-tests need some environment setup to find the locale data files
777e222d 240TEST_MBWC_ENV:= LOCPATH=$(common-objpfx)localedata
eed58310
AJ
241tst_iswalnum-ENV = $(TEST_MBWC_ENV)
242tst_iswalpha-ENV = $(TEST_MBWC_ENV)
243tst_iswcntrl-ENV = $(TEST_MBWC_ENV)
244tst_iswctype-ENV = $(TEST_MBWC_ENV)
245tst_iswdigit-ENV = $(TEST_MBWC_ENV)
246tst_iswgraph-ENV = $(TEST_MBWC_ENV)
247tst_iswlower-ENV = $(TEST_MBWC_ENV)
248tst_iswprint-ENV = $(TEST_MBWC_ENV)
249tst_iswpunct-ENV = $(TEST_MBWC_ENV)
250tst_iswspace-ENV = $(TEST_MBWC_ENV)
251tst_iswupper-ENV = $(TEST_MBWC_ENV)
252tst_iswxdigit-ENV = $(TEST_MBWC_ENV)
2e23c3cc 253tst_mblen-ENV = $(TEST_MBWC_ENV)
16247e11 254tst_mbrlen-ENV = $(TEST_MBWC_ENV)
5ca8accd
AJ
255tst_mbrtowc-ENV = $(TEST_MBWC_ENV)
256tst_mbsrtowcs-ENV = $(TEST_MBWC_ENV)
257tst_mbstowcs-ENV = $(TEST_MBWC_ENV)
2e23c3cc
AJ
258tst_mbtowc-ENV = $(TEST_MBWC_ENV)
259tst_strcoll-ENV = $(TEST_MBWC_ENV)
5ca8accd 260tst_strfmon-ENV = $(TEST_MBWC_ENV)
2e23c3cc 261tst_strxfrm-ENV = $(TEST_MBWC_ENV)
eed58310
AJ
262tst_swscanf-ENV = $(TEST_MBWC_ENV)
263tst_towctrans-ENV = $(TEST_MBWC_ENV)
264tst_towlower-ENV = $(TEST_MBWC_ENV)
265tst_towupper-ENV = $(TEST_MBWC_ENV)
5ca8accd 266tst_wcrtomb-ENV = $(TEST_MBWC_ENV)
eed58310
AJ
267tst_wcscat-ENV = $(TEST_MBWC_ENV)
268tst_wcschr-ENV = $(TEST_MBWC_ENV)
269tst_wcscmp-ENV = $(TEST_MBWC_ENV)
270tst_wcscoll-ENV = $(TEST_MBWC_ENV)
271tst_wcscpy-ENV = $(TEST_MBWC_ENV)
272tst_wcscspn-ENV = $(TEST_MBWC_ENV)
273tst_wcslen-ENV = $(TEST_MBWC_ENV)
274tst_wcsncat-ENV = $(TEST_MBWC_ENV)
275tst_wcsncmp-ENV = $(TEST_MBWC_ENV)
276tst_wcsncpy-ENV = $(TEST_MBWC_ENV)
277tst_wcspbrk-ENV = $(TEST_MBWC_ENV)
5ca8accd 278tst_wcsrtombs-ENV = $(TEST_MBWC_ENV)
eed58310
AJ
279tst_wcsspn-ENV = $(TEST_MBWC_ENV)
280tst_wcsstr-ENV = $(TEST_MBWC_ENV)
5ca8accd
AJ
281tst_wcstod-ENV = $(TEST_MBWC_ENV)
282tst_wcstok-ENV = $(TEST_MBWC_ENV)
283tst_wcstombs-ENV = $(TEST_MBWC_ENV)
eed58310
AJ
284tst_wcswidth-ENV = $(TEST_MBWC_ENV)
285tst_wcsxfrm-ENV = $(TEST_MBWC_ENV)
286tst_wctob-ENV = $(TEST_MBWC_ENV)
2e23c3cc 287tst_wctomb-ENV = $(TEST_MBWC_ENV)
eed58310
AJ
288tst_wctrans-ENV = $(TEST_MBWC_ENV)
289tst_wctype-ENV = $(TEST_MBWC_ENV)
290tst_wcwidth-ENV = $(TEST_MBWC_ENV)
69c69fe1 291tst-digits-ENV = $(TEST_MBWC_ENV)
db2d05f9 292tst-mbswcs6-ENV = $(TEST_MBWC_ENV)
ecad39f0 293tst-xlocale1-ENV = $(TEST_MBWC_ENV)
89f29a07 294tst-xlocale2-ENV = $(TEST_MBWC_ENV)
c61a9cfb 295tst-strfmon1-ENV = $(TEST_MBWC_ENV)
f98c2d06 296tst-strptime-ENV = $(TEST_MBWC_ENV)
411adb10
UD
297
298tst-setlocale-ENV = LOCPATH=$(common-objpfx)localedata LC_ALL=ja_JP.EUC-JP
403cb8a1
UD
299
300bug-iconv-trans-ENV = LOCPATH=$(common-objpfx)localedata
7bcad280 301
02c90699
UD
302tst-sscanf-ENV = LOCPATH=$(common-objpfx)localedata
303
f0c7c524
UD
304tst-leaks-ENV = MALLOC_TRACE=$(objpfx)tst-leaks.mtrace \
305 LOCPATH=$(common-objpfx)localedata
0b20a9e8 306$(objpfx)mtrace-tst-leaks.out: $(objpfx)tst-leaks.out
f0881698
JM
307 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@; \
308 $(evaluate-test)
23433315 309
cc9e536d 310bug-setlocale1-ENV = LOCPATH=$(common-objpfx)localedata
93f5c4e2 311bug-setlocale1-ARGS = -- $(host-test-program-cmd)
c34521ce
L
312bug-setlocale1-static-ENV = $(bug-setlocale1-ENV)
313bug-setlocale1-static-ARGS = $(bug-setlocale1-ARGS)
fd5bdc09 314tst-setlocale2-ENV = LOCPATH=$(common-objpfx)localedata
cc9e536d 315
23433315
PP
316$(objdir)/iconvdata/gconv-modules:
317 $(MAKE) -C ../iconvdata subdir=iconvdata $@