.
[glibc/history.git] / localedata / Makefile
blobd364001551d6fc04889724859558048f03919395
1 # Copyright (C) 1996-2003,2005,2007,2008,2009 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
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.
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.
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.
19 # Makefile for installing locale data source files.
21 subdir := localedata
23 all: # Make this the default target; it will be defined in Rules.
25 # List with all available character set descriptions.
26 charmaps := $(filter-out $(addprefix charmaps/, CVS RCS SCCS %~), \
27 $(wildcard charmaps/[A-I]*) \
28 $(wildcard charmaps/[J-Z]*))
30 # List with all available character set descriptions.
31 locales := $(filter-out $(addprefix locales/, CVS RCS SCCS %~), \
32 $(wildcard locales/*))
35 subdir-dirs = tests-mbwc
36 vpath %.c tests-mbwc
37 vpath %.h tests-mbwc
40 test-srcs := collate-test xfrm-test tst-fmon tst-rpmatch tst-trans \
41 tst-mbswcs1 tst-mbswcs2 tst-mbswcs3 tst-mbswcs4 tst-mbswcs5 \
42 tst-ctype tst-wctype tst-langinfo tst-numeric
43 test-input := de_DE.ISO-8859-1 en_US.ISO-8859-1 da_DK.ISO-8859-1 \
44 hr_HR.ISO-8859-2 sv_SE.ISO-8859-1 tr_TR.UTF-8 fr_FR.UTF-8 \
45 si_LK.UTF-8
46 test-input-data = $(addsuffix .in, $(basename $(test-input)))
47 test-output := $(foreach s, .out .xout, \
48 $(addsuffix $s, $(basename $(test-input))))
49 ld-test-names := test1 test2 test3 test4 test5 test6 test7
50 ld-test-srcs := $(addprefix tests/,$(addsuffix .cm,$(ld-test-names)) \
51 $(addsuffix .def,$(ld-test-names)) \
52 $(addsuffix .ds,test5 test6) \
53 test6.c trans.def)
55 fmon-tests = n01y12 n02n40 n10y31 n11y41 n12y11 n20n32 n30y20 n41n00 \
56 y01y10 y02n22 y22n42 y30y21 y32n31 y40y00 y42n21
58 generated := $(test-input) $(test-output) sort-test.out tst-locale.out \
59 tst-mbswcs.out tst-leaks.mtrace mtrace-tst-leaks
60 generated-dirs := $(ld-test-names) tt_TT de_DE.437 \
61 $(addprefix tstfmon_,$(fmon-tests)) \
63 distribute := CHECKSUMS README SUPPORTED ChangeLog \
64 $(charmaps) $(locales) \
65 tst-rpmatch.sh tst-locale.sh tst-fmon.sh sort-test.sh \
66 tst-fmon.data $(test-input-data) $(ld-test-srcs) \
67 th_TH.in cs_CZ.in tst-mbswcs.sh tst-trans.sh tst-ctype.sh \
68 tst-ctype-de_DE.ISO-8859-1.in \
69 tst-numeric.sh tst-numeric.data \
70 $(wildcard tests-mbwc/*.[ch]) \
71 $(addprefix tst-fmon-locales/tstfmon_,$(fmon-tests)) \
72 gen-locale.sh show-ucs-data.c tst-langinfo.sh \
73 tst-wctype.sh tst-wctype.input gen-unicode-ctype.c \
74 dump-ctype.c
76 # Get $(inst_i18ndir) defined.
77 include ../Makeconfig
79 ifeq (no,$(cross-compiling))
80 locale_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
95 tests = $(locale_test_suite) tst-digits tst-setlocale bug-iconv-trans \
96 tst-leaks tst-mbswcs6 tst-xlocale1 tst-xlocale2 bug-usesetlocale \
97 tst-strfmon1 tst-sscanf tst-strptime
98 ifeq (yes,$(build-shared))
99 ifneq (no,$(PERL))
100 tests: $(objpfx)mtrace-tst-leaks
101 endif
102 endif
103 endif
105 # Files to install.
106 install-others := $(addprefix $(inst_i18ndir)/, \
107 $(addsuffix .gz, $(charmaps)) \
108 $(locales))
110 include ../Rules
112 # Install the charmap files in gzipped format.
113 $(inst_i18ndir)/charmaps/%.gz: charmaps/% $(+force)
114 $(make-target-directory)
115 rm -f $(@:.gz=) $@
116 $(INSTALL_DATA) $< $(@:.gz=)
117 gzip -9n $(@:.gz=)
119 # Install the locale source files in the appropriate directory.
120 $(inst_i18ndir)/locales/%: locales/% $(+force); $(do-install)
122 # gcc does not know all the format specifiers we are using here.
123 CFLAGS-tst-mbswcs1.c = -Wno-format
124 CFLAGS-tst-mbswcs2.c = -Wno-format
125 CFLAGS-tst-mbswcs3.c = -Wno-format
126 CFLAGS-tst-mbswcs4.c = -Wno-format
127 CFLAGS-tst-mbswcs5.c = -Wno-format
128 CFLAGS-tst-trans.c = -Wno-format
131 ifeq (no,$(cross-compiling))
132 # We have to generate locales
133 LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ANSI_X3.4-1968 \
134 en_US.ISO-8859-1 ja_JP.EUC-JP da_DK.ISO-8859-1 \
135 hr_HR.ISO-8859-2 sv_SE.ISO-8859-1 ja_JP.SJIS fr_FR.ISO-8859-1 \
136 vi_VN.TCVN5712-1 nb_NO.ISO-8859-1 nn_NO.ISO-8859-1 \
137 tr_TR.UTF-8 cs_CZ.UTF-8 zh_TW.EUC-TW fa_IR.UTF-8 fr_FR.UTF-8 \
138 ja_JP.UTF-8 si_LK.UTF-8
139 LOCALE_SRCS := $(shell echo "$(LOCALES)"|sed 's/\([^ .]*\)[^ ]*/\1/g')
140 CHARMAPS := $(shell echo "$(LOCALES)" | \
141 sed -e 's/[^ .]*[.]\([^ ]*\)/\1/g' -e s/SJIS/SHIFT_JIS/g)
142 CTYPE_FILES = $(addsuffix /LC_CTYPE,$(LOCALES))
144 generated-dirs += $(LOCALES)
146 # Dependency for the locale files. We actually make it depend only on
147 # one of the files.
148 $(addprefix $(objpfx),$(CTYPE_FILES)): %: \
149 gen-locale.sh $(common-objpfx)locale/localedef Makefile \
150 $(addprefix charmaps/,$(CHARMAPS)) $(addprefix locales/,$(LOCALE_SRCS))
151 @$(SHELL) -e gen-locale.sh $(common-objpfx) '$(built-program-cmd)' $@
153 $(addsuffix .out,$(addprefix $(objpfx),$(tests))): %: \
154 $(addprefix $(objpfx),$(CTYPE_FILES))
156 tests: $(objpfx)sort-test.out $(objpfx)tst-fmon.out $(objpfx)tst-locale.out \
157 $(objpfx)tst-rpmatch.out $(objpfx)tst-trans.out \
158 $(objpfx)tst-mbswcs.out $(objpfx)tst-ctype.out $(objpfx)tst-wctype.out \
159 $(objpfx)tst-langinfo.out $(objpfx)tst-numeric.out
161 $(objpfx)sort-test.out: sort-test.sh $(objpfx)collate-test $(objpfx)xfrm-test \
162 $(test-input-data) $(addprefix $(objpfx),$(CTYPE_FILES))
163 $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' $(test-input) \
164 > $@
165 $(objpfx)tst-fmon.out: tst-fmon.sh $(objpfx)tst-fmon tst-fmon.data \
166 $(objpfx)sort-test.out \
167 $(addprefix $(objpfx),$(CTYPE_FILES))
168 $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' tst-fmon.data \
169 > $@
170 $(objpfx)tst-numeric.out: tst-numeric.sh $(objpfx)tst-numeric tst-numeric.data \
171 $(objpfx)sort-test.out \
172 $(addprefix $(objpfx),$(CTYPE_FILES))
173 $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' tst-numeric.data \
174 > $@
175 $(objpfx)tst-locale.out: tst-locale.sh $(common-objpfx)locale/localedef \
176 $(ld-test-srcs) $(addprefix $(objpfx),$(CTYPE_FILES))
177 $(SHELL) -e $< $(common-objpfx) '$(built-program-cmd)' > $@
178 $(objpfx)tst-rpmatch.out: tst-rpmatch.sh $(objpfx)tst-rpmatch \
179 $(objpfx)tst-fmon.out \
180 $(addprefix $(objpfx),$(CTYPE_FILES))
181 $(SHELL) -e $< $(common-objpfx) '$(built-program-cmd)' > $@
182 $(objpfx)tst-trans.out: tst-trans.sh $(objpfx)tst-trans \
183 $(addprefix $(objpfx),$(CTYPE_FILES))
184 $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)'
185 $(objpfx)tst-mbswcs.out: tst-mbswcs.sh $(objpfx)tst-mbswcs1 \
186 $(objpfx)tst-mbswcs2 $(objpfx)tst-mbswcs3 \
187 $(objpfx)tst-mbswcs4 $(objpfx)tst-mbswcs5 \
188 $(addprefix $(objpfx),$(CTYPE_FILES))
189 $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)'
190 $(objpfx)tst-ctype.out: tst-ctype.sh $(objpfx)tst-ctype \
191 $(objpfx)sort-test.out \
192 $(addprefix $(objpfx),$(CTYPE_FILES))
193 $(SHELL) -e $< $(common-objpfx) '$(built-program-cmd)'
194 $(objpfx)tst-wctype.out: tst-wctype.sh $(objpfx)tst-wctype \
195 $(objpfx)sort-test.out tst-wctype.input \
196 $(addprefix $(objpfx),$(CTYPE_FILES))
197 $(SHELL) -e $< $(common-objpfx) '$(built-program-cmd)'
198 $(objpfx)tst-langinfo.out: tst-langinfo.sh $(objpfx)tst-langinfo \
199 $(objpfx)sort-test.out \
200 $(addprefix $(objpfx),$(CTYPE_FILES))
201 $(SHELL) -e $< $(common-objpfx) '$(built-program-cmd)'
202 $(objpfx)tst-digits.out: $(objpfx)tst-locale.out
203 $(objpfx)tst-mbswcs6.out: $(addprefix $(objpfx),$(CTYPE_FILES))
204 endif
206 include SUPPORTED
208 INSTALL-SUPPORTED-LOCALES=$(addprefix install-, $(SUPPORTED-LOCALES))
210 # Sometimes the whole collection of locale files should be installed.
211 LOCALEDEF=I18NPATH=. GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
212 $(common-objpfx)elf/ld.so --library-path $(rpath-link) $(common-objpfx)locale/localedef
213 install-locales: $(INSTALL-SUPPORTED-LOCALES)
215 install-locales-dir:
216 $(..)./scripts/mkinstalldirs $(inst_localedir)
218 $(INSTALL-SUPPORTED-LOCALES): install-locales-dir
219 @locale=`echo $@ | sed -e 's/^install-//'`; \
220 charset=`echo $$locale | sed -e 's,.*/,,'`; \
221 locale=`echo $$locale | sed -e 's,/[^/]*,,'`; \
222 echo -n `echo $$locale | sed 's/\([^.\@]*\).*/\1/'`; \
223 echo -n ".$$charset"; \
224 echo -n `echo $$locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \
225 echo -n '...'; \
226 input=`echo $$locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; \
227 $(LOCALEDEF) --alias-file=../intl/locale.alias \
228 -i locales/$$input -c -f charmaps/$$charset \
229 $(addprefix --prefix=,$(install_root)) $$locale; \
230 echo ' done'; \
232 # The mbwc-tests need some environment setup to find the locale data files
233 TEST_MBWC_ENV:= LOCPATH=$(common-objpfx)localedata
234 tst_iswalnum-ENV = $(TEST_MBWC_ENV)
235 tst_iswalpha-ENV = $(TEST_MBWC_ENV)
236 tst_iswcntrl-ENV = $(TEST_MBWC_ENV)
237 tst_iswctype-ENV = $(TEST_MBWC_ENV)
238 tst_iswdigit-ENV = $(TEST_MBWC_ENV)
239 tst_iswgraph-ENV = $(TEST_MBWC_ENV)
240 tst_iswlower-ENV = $(TEST_MBWC_ENV)
241 tst_iswprint-ENV = $(TEST_MBWC_ENV)
242 tst_iswpunct-ENV = $(TEST_MBWC_ENV)
243 tst_iswspace-ENV = $(TEST_MBWC_ENV)
244 tst_iswupper-ENV = $(TEST_MBWC_ENV)
245 tst_iswxdigit-ENV = $(TEST_MBWC_ENV)
246 tst_mblen-ENV = $(TEST_MBWC_ENV)
247 tst_mbrlen-ENV = $(TEST_MBWC_ENV)
248 tst_mbrtowc-ENV = $(TEST_MBWC_ENV)
249 tst_mbsrtowcs-ENV = $(TEST_MBWC_ENV)
250 tst_mbstowcs-ENV = $(TEST_MBWC_ENV)
251 tst_mbtowc-ENV = $(TEST_MBWC_ENV)
252 tst_strcoll-ENV = $(TEST_MBWC_ENV)
253 tst_strfmon-ENV = $(TEST_MBWC_ENV)
254 tst_strxfrm-ENV = $(TEST_MBWC_ENV)
255 tst_swscanf-ENV = $(TEST_MBWC_ENV)
256 tst_towctrans-ENV = $(TEST_MBWC_ENV)
257 tst_towlower-ENV = $(TEST_MBWC_ENV)
258 tst_towupper-ENV = $(TEST_MBWC_ENV)
259 tst_wcrtomb-ENV = $(TEST_MBWC_ENV)
260 tst_wcscat-ENV = $(TEST_MBWC_ENV)
261 tst_wcschr-ENV = $(TEST_MBWC_ENV)
262 tst_wcscmp-ENV = $(TEST_MBWC_ENV)
263 tst_wcscoll-ENV = $(TEST_MBWC_ENV)
264 tst_wcscpy-ENV = $(TEST_MBWC_ENV)
265 tst_wcscspn-ENV = $(TEST_MBWC_ENV)
266 tst_wcslen-ENV = $(TEST_MBWC_ENV)
267 tst_wcsncat-ENV = $(TEST_MBWC_ENV)
268 tst_wcsncmp-ENV = $(TEST_MBWC_ENV)
269 tst_wcsncpy-ENV = $(TEST_MBWC_ENV)
270 tst_wcspbrk-ENV = $(TEST_MBWC_ENV)
271 tst_wcsrtombs-ENV = $(TEST_MBWC_ENV)
272 tst_wcsspn-ENV = $(TEST_MBWC_ENV)
273 tst_wcsstr-ENV = $(TEST_MBWC_ENV)
274 tst_wcstod-ENV = $(TEST_MBWC_ENV)
275 tst_wcstok-ENV = $(TEST_MBWC_ENV)
276 tst_wcstombs-ENV = $(TEST_MBWC_ENV)
277 tst_wcswidth-ENV = $(TEST_MBWC_ENV)
278 tst_wcsxfrm-ENV = $(TEST_MBWC_ENV)
279 tst_wctob-ENV = $(TEST_MBWC_ENV)
280 tst_wctomb-ENV = $(TEST_MBWC_ENV)
281 tst_wctrans-ENV = $(TEST_MBWC_ENV)
282 tst_wctype-ENV = $(TEST_MBWC_ENV)
283 tst_wcwidth-ENV = $(TEST_MBWC_ENV)
284 tst-digits-ENV = $(TEST_MBWC_ENV)
285 tst-mbswcs6-ENV = $(TEST_MBWC_ENV)
286 tst-xlocale1-ENV = $(TEST_MBWC_ENV)
287 tst-xlocale2-ENV = $(TEST_MBWC_ENV)
288 tst-strfmon1-ENV = $(TEST_MBWC_ENV)
289 tst-strptime-ENV = $(TEST_MBWC_ENV)
291 tst-setlocale-ENV = LOCPATH=$(common-objpfx)localedata LC_ALL=ja_JP.EUC-JP
293 bug-iconv-trans-ENV = LOCPATH=$(common-objpfx)localedata
295 tst-sscanf-ENV = LOCPATH=$(common-objpfx)localedata
297 tst-leaks-ENV = MALLOC_TRACE=$(objpfx)tst-leaks.mtrace \
298 LOCPATH=$(common-objpfx)localedata
299 $(objpfx)mtrace-tst-leaks: $(objpfx)tst-leaks.out
300 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@