]> git.ipfire.org Git - thirdparty/glibc.git/blame - localedata/Makefile
Optimize access to isXYZ and toXYZ tables
[thirdparty/glibc.git] / localedata / Makefile
CommitLineData
cc9e536d 1# Copyright (C) 1996-2003,2005,2007,2008,2009,2011 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
AJ
14# You should have received a copy of the GNU Lesser General Public
15# License along with the GNU C Library; if not, write to the Free
16# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17# 02111-1307 USA.
f5f52655
UD
18
19# Makefile for installing locale data source files.
20
21subdir := localedata
22
23all: # Make this the default target; it will be defined in Rules.
24
25# List with all available character set descriptions.
7db0da77 26charmaps := $(filter-out $(addprefix charmaps/, CVS RCS SCCS %~), \
85f72e9c
UD
27 $(wildcard charmaps/[A-I]*) \
28 $(wildcard charmaps/[J-Z]*))
f5f52655
UD
29
30# List with all available character set descriptions.
7db0da77 31locales := $(filter-out $(addprefix locales/, CVS RCS SCCS %~), \
f5f52655
UD
32 $(wildcard locales/*))
33
5b905722
AJ
34
35subdir-dirs = tests-mbwc
36vpath %.c tests-mbwc
37vpath %.h tests-mbwc
38
39
316518d6 40test-srcs := collate-test xfrm-test tst-fmon tst-rpmatch tst-trans \
465e7beb 41 tst-mbswcs1 tst-mbswcs2 tst-mbswcs3 tst-mbswcs4 tst-mbswcs5 \
76352f64 42 tst-ctype tst-wctype tst-langinfo tst-numeric
081e43f2 43test-input := de_DE.ISO-8859-1 en_US.ISO-8859-1 da_DK.ISO-8859-1 \
a5ff533e
UD
44 hr_HR.ISO-8859-2 sv_SE.ISO-8859-1 tr_TR.UTF-8 fr_FR.UTF-8 \
45 si_LK.UTF-8
d17a729b 46test-input-data = $(addsuffix .in, $(basename $(test-input)))
da2d1bc5
UD
47test-output := $(foreach s, .out .xout, \
48 $(addsuffix $s, $(basename $(test-input))))
69c69fe1 49ld-test-names := test1 test2 test3 test4 test5 test6 test7
0a614877 50ld-test-srcs := $(addprefix tests/,$(addsuffix .cm,$(ld-test-names)) \
afa0569f 51 $(addsuffix .def,$(ld-test-names)) \
cf2964e2
UD
52 $(addsuffix .ds,test5 test6) \
53 test6.c trans.def)
880f421f 54
8956ac9e
UD
55fmon-tests = n01y12 n02n40 n10y31 n11y41 n12y11 n20n32 n30y20 n41n00 \
56 y01y10 y02n22 y22n42 y30y21 y32n31 y40y00 y42n21
57
3d61cc09 58generated := $(test-input) $(test-output) sort-test.out tst-locale.out \
7bcad280 59 tst-mbswcs.out tst-leaks.mtrace mtrace-tst-leaks
40c4c9b5
UD
60generated-dirs := $(ld-test-names) tt_TT de_DE.437 \
61 $(addprefix tstfmon_,$(fmon-tests)) \
414fd335 62
d17a729b 63distribute := CHECKSUMS README SUPPORTED ChangeLog \
d77cd295 64 $(charmaps) $(locales) \
d17a729b 65 tst-rpmatch.sh tst-locale.sh tst-fmon.sh sort-test.sh \
4e9a34c4 66 tst-fmon.data $(test-input-data) $(ld-test-srcs) \
1a3eefef 67 th_TH.in cs_CZ.in tst-mbswcs.sh tst-trans.sh tst-ctype.sh \
3d61cc09 68 tst-ctype-de_DE.ISO-8859-1.in \
76352f64 69 tst-numeric.sh tst-numeric.data \
8a958cd2 70 $(wildcard tests-mbwc/*.[ch]) \
a2294e57 71 $(addprefix tst-fmon-locales/tstfmon_,$(fmon-tests)) \
f79d99cb 72 gen-locale.sh show-ucs-data.c tst-langinfo.sh \
0b95971d
UD
73 tst-wctype.sh tst-wctype.input gen-unicode-ctype.c \
74 dump-ctype.c
f5f52655
UD
75
76# Get $(inst_i18ndir) defined.
77include ../Makeconfig
78
0e16ecfa 79ifeq (no,$(cross-compiling))
5ca8accd
AJ
80locale_test_suite := tst_iswalnum tst_iswalpha tst_iswcntrl \
81 tst_iswctype tst_iswdigit tst_iswgraph \
82 tst_iswlower tst_iswprint tst_iswpunct \
83 tst_iswspace tst_iswupper tst_iswxdigit tst_mblen \
84 tst_mbrlen tst_mbrtowc tst_mbsrtowcs tst_mbstowcs \
85 tst_mbtowc tst_strcoll tst_strfmon tst_strxfrm \
86 tst_swscanf tst_towctrans tst_towlower \
87 tst_towupper tst_wcrtomb tst_wcscat tst_wcschr \
88 tst_wcscmp tst_wcscoll tst_wcscpy tst_wcscspn \
89 tst_wcslen tst_wcsncat tst_wcsncmp tst_wcsncpy \
90 tst_wcspbrk tst_wcsrtombs tst_wcsspn tst_wcsstr \
91 tst_wcstod tst_wcstok tst_wcstombs tst_wcswidth \
92 tst_wcsxfrm tst_wctob tst_wctomb tst_wctrans \
93 tst_wctype tst_wcwidth
2e23c3cc 94
7bcad280 95tests = $(locale_test_suite) tst-digits tst-setlocale bug-iconv-trans \
c61a9cfb 96 tst-leaks tst-mbswcs6 tst-xlocale1 tst-xlocale2 bug-usesetlocale \
fd5bdc09 97 tst-strfmon1 tst-sscanf tst-strptime bug-setlocale1 tst-setlocale2
7bcad280
UD
98ifeq (yes,$(build-shared))
99ifneq (no,$(PERL))
100tests: $(objpfx)mtrace-tst-leaks
101endif
102endif
0e16ecfa 103endif
0e16ecfa 104
f5f52655 105# Files to install.
d77cd295
UD
106install-others := $(addprefix $(inst_i18ndir)/, \
107 $(addsuffix .gz, $(charmaps)) \
108 $(locales))
f5f52655 109
23433315
PP
110tests: $(objdir)/iconvdata/gconv-modules
111
f5f52655
UD
112include ../Rules
113
d77cd295
UD
114# Install the charmap files in gzipped format.
115$(inst_i18ndir)/charmaps/%.gz: charmaps/% $(+force)
116 $(make-target-directory)
117 rm -f $(@:.gz=) $@
118 $(INSTALL_DATA) $< $(@:.gz=)
962edb7e 119 gzip -9n $(@:.gz=)
d77cd295
UD
120
121# Install the locale source files in the appropriate directory.
73237de3 122$(inst_i18ndir)/locales/%: locales/% $(+force); $(do-install)
f5f52655 123
d6204268
UD
124# gcc does not know all the format specifiers we are using here.
125CFLAGS-tst-mbswcs1.c = -Wno-format
126CFLAGS-tst-mbswcs2.c = -Wno-format
127CFLAGS-tst-mbswcs3.c = -Wno-format
128CFLAGS-tst-mbswcs4.c = -Wno-format
129CFLAGS-tst-mbswcs5.c = -Wno-format
130CFLAGS-tst-trans.c = -Wno-format
f5f52655 131
0e16ecfa 132
f5f52655 133ifeq (no,$(cross-compiling))
5e087c71
UD
134# We have to generate locales
135LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ANSI_X3.4-1968 \
d4459f83 136 en_US.ISO-8859-1 ja_JP.EUC-JP da_DK.ISO-8859-1 \
7ba7c829 137 hr_HR.ISO-8859-2 sv_SE.ISO-8859-1 ja_JP.SJIS fr_FR.ISO-8859-1 \
74e12fbc 138 vi_VN.TCVN5712-1 nb_NO.ISO-8859-1 nn_NO.ISO-8859-1 \
2ecc7d93 139 tr_TR.UTF-8 cs_CZ.UTF-8 zh_TW.EUC-TW fa_IR.UTF-8 fr_FR.UTF-8 \
fd5bdc09 140 ja_JP.UTF-8 si_LK.UTF-8 tr_TR.ISO-8859-9
5e087c71 141LOCALE_SRCS := $(shell echo "$(LOCALES)"|sed 's/\([^ .]*\)[^ ]*/\1/g')
3076f3d1
UD
142CHARMAPS := $(shell echo "$(LOCALES)" | \
143 sed -e 's/[^ .]*[.]\([^ ]*\)/\1/g' -e s/SJIS/SHIFT_JIS/g)
5e087c71
UD
144CTYPE_FILES = $(addsuffix /LC_CTYPE,$(LOCALES))
145
40c4c9b5
UD
146generated-dirs += $(LOCALES)
147
5e087c71
UD
148# Dependency for the locale files. We actually make it depend only on
149# one of the files.
150$(addprefix $(objpfx),$(CTYPE_FILES)): %: \
9f835f5f 151 gen-locale.sh $(common-objpfx)locale/localedef Makefile \
5e087c71 152 $(addprefix charmaps/,$(CHARMAPS)) $(addprefix locales/,$(LOCALE_SRCS))
9f835f5f 153 @$(SHELL) -e gen-locale.sh $(common-objpfx) '$(built-program-cmd)' $@
5e087c71 154
9f2bedd0 155$(addsuffix .out,$(addprefix $(objpfx),$(tests))): %: \
5e087c71
UD
156 $(addprefix $(objpfx),$(CTYPE_FILES))
157
ca41028b
UD
158tests: $(objpfx)sort-test.out $(objpfx)tst-fmon.out $(objpfx)tst-locale.out \
159 $(objpfx)tst-rpmatch.out $(objpfx)tst-trans.out \
f79d99cb 160 $(objpfx)tst-mbswcs.out $(objpfx)tst-ctype.out $(objpfx)tst-wctype.out \
76352f64 161 $(objpfx)tst-langinfo.out $(objpfx)tst-numeric.out
ca41028b
UD
162
163$(objpfx)sort-test.out: sort-test.sh $(objpfx)collate-test $(objpfx)xfrm-test \
164 $(test-input-data) $(addprefix $(objpfx),$(CTYPE_FILES))
165 $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' $(test-input) \
166 > $@
167$(objpfx)tst-fmon.out: tst-fmon.sh $(objpfx)tst-fmon tst-fmon.data \
168 $(objpfx)sort-test.out \
169 $(addprefix $(objpfx),$(CTYPE_FILES))
170 $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' tst-fmon.data \
171 > $@
76352f64
UD
172$(objpfx)tst-numeric.out: tst-numeric.sh $(objpfx)tst-numeric tst-numeric.data \
173 $(objpfx)sort-test.out \
174 $(addprefix $(objpfx),$(CTYPE_FILES))
175 $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' tst-numeric.data \
176 > $@
ca41028b
UD
177$(objpfx)tst-locale.out: tst-locale.sh $(common-objpfx)locale/localedef \
178 $(ld-test-srcs) $(addprefix $(objpfx),$(CTYPE_FILES))
179 $(SHELL) -e $< $(common-objpfx) '$(built-program-cmd)' > $@
180$(objpfx)tst-rpmatch.out: tst-rpmatch.sh $(objpfx)tst-rpmatch \
181 $(objpfx)tst-fmon.out \
182 $(addprefix $(objpfx),$(CTYPE_FILES))
183 $(SHELL) -e $< $(common-objpfx) '$(built-program-cmd)' > $@
184$(objpfx)tst-trans.out: tst-trans.sh $(objpfx)tst-trans \
185 $(addprefix $(objpfx),$(CTYPE_FILES))
9f835f5f 186 $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)'
ca41028b
UD
187$(objpfx)tst-mbswcs.out: tst-mbswcs.sh $(objpfx)tst-mbswcs1 \
188 $(objpfx)tst-mbswcs2 $(objpfx)tst-mbswcs3 \
189 $(objpfx)tst-mbswcs4 $(objpfx)tst-mbswcs5 \
190 $(addprefix $(objpfx),$(CTYPE_FILES))
9f835f5f 191 $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)'
ca41028b
UD
192$(objpfx)tst-ctype.out: tst-ctype.sh $(objpfx)tst-ctype \
193 $(objpfx)sort-test.out \
194 $(addprefix $(objpfx),$(CTYPE_FILES))
9f835f5f 195 $(SHELL) -e $< $(common-objpfx) '$(built-program-cmd)'
a64e8af1
UD
196$(objpfx)tst-wctype.out: tst-wctype.sh $(objpfx)tst-wctype \
197 $(objpfx)sort-test.out tst-wctype.input \
198 $(addprefix $(objpfx),$(CTYPE_FILES))
199 $(SHELL) -e $< $(common-objpfx) '$(built-program-cmd)'
f79d99cb
UD
200$(objpfx)tst-langinfo.out: tst-langinfo.sh $(objpfx)tst-langinfo \
201 $(objpfx)sort-test.out \
202 $(addprefix $(objpfx),$(CTYPE_FILES))
203 $(SHELL) -e $< $(common-objpfx) '$(built-program-cmd)'
69c69fe1 204$(objpfx)tst-digits.out: $(objpfx)tst-locale.out
db2d05f9 205$(objpfx)tst-mbswcs6.out: $(addprefix $(objpfx),$(CTYPE_FILES))
df455ccb 206endif
92610fbe 207
f7364247
UD
208include SUPPORTED
209
210INSTALL-SUPPORTED-LOCALES=$(addprefix install-, $(SUPPORTED-LOCALES))
211
92610fbe 212# Sometimes the whole collection of locale files should be installed.
246a9a19
UD
213LOCALEDEF=I18NPATH=. GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
214$(common-objpfx)elf/ld.so --library-path $(rpath-link) $(common-objpfx)locale/localedef
f7364247
UD
215install-locales: $(INSTALL-SUPPORTED-LOCALES)
216
217install-locales-dir:
f14854aa 218 $(..)./scripts/mkinstalldirs $(inst_localedir)
f7364247
UD
219
220$(INSTALL-SUPPORTED-LOCALES): install-locales-dir
221 @locale=`echo $@ | sed -e 's/^install-//'`; \
222 charset=`echo $$locale | sed -e 's,.*/,,'`; \
223 locale=`echo $$locale | sed -e 's,/[^/]*,,'`; \
224 echo -n `echo $$locale | sed 's/\([^.\@]*\).*/\1/'`; \
225 echo -n ".$$charset"; \
226 echo -n `echo $$locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \
227 echo -n '...'; \
228 input=`echo $$locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; \
aa97cce1
RM
229 $(LOCALEDEF) --alias-file=../intl/locale.alias \
230 -i locales/$$input -c -f charmaps/$$charset \
231 $(addprefix --prefix=,$(install_root)) $$locale; \
f7364247 232 echo ' done'; \
5b905722 233
2e23c3cc 234# The mbwc-tests need some environment setup to find the locale data files
777e222d 235TEST_MBWC_ENV:= LOCPATH=$(common-objpfx)localedata
eed58310
AJ
236tst_iswalnum-ENV = $(TEST_MBWC_ENV)
237tst_iswalpha-ENV = $(TEST_MBWC_ENV)
238tst_iswcntrl-ENV = $(TEST_MBWC_ENV)
239tst_iswctype-ENV = $(TEST_MBWC_ENV)
240tst_iswdigit-ENV = $(TEST_MBWC_ENV)
241tst_iswgraph-ENV = $(TEST_MBWC_ENV)
242tst_iswlower-ENV = $(TEST_MBWC_ENV)
243tst_iswprint-ENV = $(TEST_MBWC_ENV)
244tst_iswpunct-ENV = $(TEST_MBWC_ENV)
245tst_iswspace-ENV = $(TEST_MBWC_ENV)
246tst_iswupper-ENV = $(TEST_MBWC_ENV)
247tst_iswxdigit-ENV = $(TEST_MBWC_ENV)
2e23c3cc 248tst_mblen-ENV = $(TEST_MBWC_ENV)
16247e11 249tst_mbrlen-ENV = $(TEST_MBWC_ENV)
5ca8accd
AJ
250tst_mbrtowc-ENV = $(TEST_MBWC_ENV)
251tst_mbsrtowcs-ENV = $(TEST_MBWC_ENV)
252tst_mbstowcs-ENV = $(TEST_MBWC_ENV)
2e23c3cc
AJ
253tst_mbtowc-ENV = $(TEST_MBWC_ENV)
254tst_strcoll-ENV = $(TEST_MBWC_ENV)
5ca8accd 255tst_strfmon-ENV = $(TEST_MBWC_ENV)
2e23c3cc 256tst_strxfrm-ENV = $(TEST_MBWC_ENV)
eed58310
AJ
257tst_swscanf-ENV = $(TEST_MBWC_ENV)
258tst_towctrans-ENV = $(TEST_MBWC_ENV)
259tst_towlower-ENV = $(TEST_MBWC_ENV)
260tst_towupper-ENV = $(TEST_MBWC_ENV)
5ca8accd 261tst_wcrtomb-ENV = $(TEST_MBWC_ENV)
eed58310
AJ
262tst_wcscat-ENV = $(TEST_MBWC_ENV)
263tst_wcschr-ENV = $(TEST_MBWC_ENV)
264tst_wcscmp-ENV = $(TEST_MBWC_ENV)
265tst_wcscoll-ENV = $(TEST_MBWC_ENV)
266tst_wcscpy-ENV = $(TEST_MBWC_ENV)
267tst_wcscspn-ENV = $(TEST_MBWC_ENV)
268tst_wcslen-ENV = $(TEST_MBWC_ENV)
269tst_wcsncat-ENV = $(TEST_MBWC_ENV)
270tst_wcsncmp-ENV = $(TEST_MBWC_ENV)
271tst_wcsncpy-ENV = $(TEST_MBWC_ENV)
272tst_wcspbrk-ENV = $(TEST_MBWC_ENV)
5ca8accd 273tst_wcsrtombs-ENV = $(TEST_MBWC_ENV)
eed58310
AJ
274tst_wcsspn-ENV = $(TEST_MBWC_ENV)
275tst_wcsstr-ENV = $(TEST_MBWC_ENV)
5ca8accd
AJ
276tst_wcstod-ENV = $(TEST_MBWC_ENV)
277tst_wcstok-ENV = $(TEST_MBWC_ENV)
278tst_wcstombs-ENV = $(TEST_MBWC_ENV)
eed58310
AJ
279tst_wcswidth-ENV = $(TEST_MBWC_ENV)
280tst_wcsxfrm-ENV = $(TEST_MBWC_ENV)
281tst_wctob-ENV = $(TEST_MBWC_ENV)
2e23c3cc 282tst_wctomb-ENV = $(TEST_MBWC_ENV)
eed58310
AJ
283tst_wctrans-ENV = $(TEST_MBWC_ENV)
284tst_wctype-ENV = $(TEST_MBWC_ENV)
285tst_wcwidth-ENV = $(TEST_MBWC_ENV)
69c69fe1 286tst-digits-ENV = $(TEST_MBWC_ENV)
db2d05f9 287tst-mbswcs6-ENV = $(TEST_MBWC_ENV)
ecad39f0 288tst-xlocale1-ENV = $(TEST_MBWC_ENV)
89f29a07 289tst-xlocale2-ENV = $(TEST_MBWC_ENV)
c61a9cfb 290tst-strfmon1-ENV = $(TEST_MBWC_ENV)
f98c2d06 291tst-strptime-ENV = $(TEST_MBWC_ENV)
411adb10
UD
292
293tst-setlocale-ENV = LOCPATH=$(common-objpfx)localedata LC_ALL=ja_JP.EUC-JP
403cb8a1
UD
294
295bug-iconv-trans-ENV = LOCPATH=$(common-objpfx)localedata
7bcad280 296
02c90699
UD
297tst-sscanf-ENV = LOCPATH=$(common-objpfx)localedata
298
f0c7c524
UD
299tst-leaks-ENV = MALLOC_TRACE=$(objpfx)tst-leaks.mtrace \
300 LOCPATH=$(common-objpfx)localedata
7bcad280
UD
301$(objpfx)mtrace-tst-leaks: $(objpfx)tst-leaks.out
302 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@
23433315 303
cc9e536d
UD
304bug-setlocale1-ENV = LOCPATH=$(common-objpfx)localedata
305bug-setlocale1-ARGS = $(common-objpfx)
fd5bdc09 306tst-setlocale2-ENV = LOCPATH=$(common-objpfx)localedata
cc9e536d 307
23433315
PP
308$(objdir)/iconvdata/gconv-modules:
309 $(MAKE) -C ../iconvdata subdir=iconvdata $@