1 # Copyright (C) 1996-2003,2005,2007-2009,2011,2012
2 # Free Software Foundation, Inc.
3 # This file is part of the GNU C Library.
5 # The GNU C Library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License, or (at your option) any later version.
10 # The GNU C Library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with the GNU C Library; if not, see
17 # <http://www.gnu.org/licenses/>.
19 # Makefile for installing locale data source files.
23 all: # Make this the default target; it will be defined in Rules.
25 # List with all available character set descriptions.
26 charmaps
:= $(wildcard charmaps
/[A-I
]*) $(wildcard charmaps
/[J-Z
]*)
28 # List with all available character set descriptions.
29 locales
:= $(wildcard locales
/*)
32 subdir-dirs
= tests-mbwc
37 test-srcs
:= collate-test xfrm-test tst-fmon tst-rpmatch tst-trans \
38 tst-mbswcs1 tst-mbswcs2 tst-mbswcs3 tst-mbswcs4 tst-mbswcs5 \
39 tst-ctype tst-wctype tst-langinfo tst-numeric
40 test-input
:= de_DE.ISO-8859-1 en_US.ISO-8859-1 da_DK.ISO-8859-1 \
41 hr_HR.ISO-8859-2 sv_SE.ISO-8859-1 tr_TR.UTF-8 fr_FR.UTF-8 \
43 test-input-data
= $(addsuffix .in
, $(basename $(test-input
)))
44 test-output
:= $(foreach s
, .out .xout
, \
45 $(addsuffix $s, $(basename $(test-input
))))
46 ld-test-names
:= test1 test2 test3 test4 test5 test6 test7
47 ld-test-srcs
:= $(addprefix tests
/,$(addsuffix .cm
,$(ld-test-names
)) \
48 $(addsuffix .def
,$(ld-test-names
)) \
49 $(addsuffix .ds
,test5 test6
) \
52 fmon-tests
= n01y12 n02n40 n10y31 n11y41 n12y11 n20n32 n30y20 n41n00 \
53 y01y10 y02n22 y22n42 y30y21 y32n31 y40y00 y42n21
55 generated
:= $(test-input
) $(test-output
) sort-test.out tst-locale.out \
56 tst-mbswcs.out tst-leaks.mtrace mtrace-tst-leaks
57 generated-dirs
:= $(ld-test-names
) tt_TT de_DE
.437 \
58 $(addprefix tstfmon_
,$(fmon-tests
)) \
60 # Get $(inst_i18ndir) defined.
63 ifeq (no
,$(cross-compiling
))
64 locale_test_suite
:= tst_iswalnum tst_iswalpha tst_iswcntrl \
65 tst_iswctype tst_iswdigit tst_iswgraph \
66 tst_iswlower tst_iswprint tst_iswpunct \
67 tst_iswspace tst_iswupper tst_iswxdigit tst_mblen \
68 tst_mbrlen tst_mbrtowc tst_mbsrtowcs tst_mbstowcs \
69 tst_mbtowc tst_strcoll tst_strfmon tst_strxfrm \
70 tst_swscanf tst_towctrans tst_towlower \
71 tst_towupper tst_wcrtomb tst_wcscat tst_wcschr \
72 tst_wcscmp tst_wcscoll tst_wcscpy tst_wcscspn \
73 tst_wcslen tst_wcsncat tst_wcsncmp tst_wcsncpy \
74 tst_wcspbrk tst_wcsrtombs tst_wcsspn tst_wcsstr \
75 tst_wcstod tst_wcstok tst_wcstombs tst_wcswidth \
76 tst_wcsxfrm tst_wctob tst_wctomb tst_wctrans \
77 tst_wctype tst_wcwidth
79 tests
= $(locale_test_suite
) tst-digits tst-setlocale bug-iconv-trans \
80 tst-leaks tst-mbswcs6 tst-xlocale1 tst-xlocale2 bug-usesetlocale \
81 tst-strfmon1 tst-sscanf tst-strptime bug-setlocale1 tst-setlocale2
82 ifeq (yes
,$(build-shared
))
84 tests
: $(objpfx
)mtrace-tst-leaks
90 install-others
:= $(addprefix $(inst_i18ndir
)/, \
91 $(addsuffix .gz
, $(charmaps
)) \
94 tests
: $(objdir
)/iconvdata
/gconv-modules
98 # Install the charmap files in gzipped format.
99 $(inst_i18ndir
)/charmaps
/%.gz
: charmaps
/% $(+force)
100 $(make-target-directory
)
102 $(INSTALL_DATA
) $< $(@
:.gz
=)
105 # Install the locale source files in the appropriate directory.
106 $(inst_i18ndir
)/locales
/%: locales
/% $(+force); $(do-install
)
108 # gcc does not know all the format specifiers we are using here.
109 CFLAGS-tst-mbswcs1.c
= -Wno-format
110 CFLAGS-tst-mbswcs2.c
= -Wno-format
111 CFLAGS-tst-mbswcs3.c
= -Wno-format
112 CFLAGS-tst-mbswcs4.c
= -Wno-format
113 CFLAGS-tst-mbswcs5.c
= -Wno-format
114 CFLAGS-tst-trans.c
= -Wno-format
117 ifeq (no
,$(cross-compiling
))
118 # We have to generate locales
119 LOCALES
:= de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ANSI_X3.4
-1968 \
120 en_US.ISO-8859-1 ja_JP.EUC-JP da_DK.ISO-8859-1 \
121 hr_HR.ISO-8859-2 sv_SE.ISO-8859-1 ja_JP.SJIS fr_FR.ISO-8859-1 \
122 vi_VN.TCVN5712-1 nb_NO.ISO-8859-1 nn_NO.ISO-8859-1 \
123 tr_TR.UTF-8 cs_CZ.UTF-8 zh_TW.EUC-TW fa_IR.UTF-8 fr_FR.UTF-8 \
124 ja_JP.UTF-8 si_LK.UTF-8 tr_TR.ISO-8859-9
125 LOCALE_SRCS
:= $(shell echo
"$(LOCALES)"|sed
's/\([^ .]*\)[^ ]*/\1/g')
126 CHARMAPS
:= $(shell echo
"$(LOCALES)" | \
127 sed
-e
's/[^ .]*[.]\([^ ]*\)/\1/g' -e s
/SJIS
/SHIFT_JIS
/g
)
128 CTYPE_FILES
= $(addsuffix /LC_CTYPE
,$(LOCALES
))
130 generated-dirs
+= $(LOCALES
)
132 # Dependency for the locale files. We actually make it depend only on
134 $(addprefix $(objpfx
),$(CTYPE_FILES
)): %: \
135 gen-locale.sh
$(common-objpfx
)locale
/localedef Makefile \
136 $(addprefix charmaps
/,$(CHARMAPS
)) $(addprefix locales
/,$(LOCALE_SRCS
))
137 @
$(SHELL
) -e gen-locale.sh
$(common-objpfx
) '$(built-program-cmd)' $@
139 $(addsuffix .out
,$(addprefix $(objpfx
),$(tests
))): %: \
140 $(addprefix $(objpfx
),$(CTYPE_FILES
))
142 tests
: $(objpfx
)sort-test.out
$(objpfx
)tst-fmon.out
$(objpfx
)tst-locale.out \
143 $(objpfx
)tst-rpmatch.out
$(objpfx
)tst-trans.out \
144 $(objpfx
)tst-mbswcs.out
$(objpfx
)tst-ctype.out
$(objpfx
)tst-wctype.out \
145 $(objpfx
)tst-langinfo.out
$(objpfx
)tst-numeric.out
147 $(objpfx
)sort-test.out
: sort-test.sh
$(objpfx
)collate-test
$(objpfx
)xfrm-test \
148 $(test-input-data
) $(addprefix $(objpfx
),$(CTYPE_FILES
))
149 $(SHELL
) -e
$< $(common-objpfx
) '$(run-program-prefix)' $(test-input
) \
151 $(objpfx
)tst-fmon.out
: tst-fmon.sh
$(objpfx
)tst-fmon tst-fmon.data \
152 $(objpfx
)sort-test.out \
153 $(addprefix $(objpfx
),$(CTYPE_FILES
))
154 $(SHELL
) -e
$< $(common-objpfx
) '$(run-program-prefix)' tst-fmon.data \
156 $(objpfx
)tst-numeric.out
: tst-numeric.sh
$(objpfx
)tst-numeric tst-numeric.data \
157 $(objpfx
)sort-test.out \
158 $(addprefix $(objpfx
),$(CTYPE_FILES
))
159 $(SHELL
) -e
$< $(common-objpfx
) '$(run-program-prefix)' tst-numeric.data \
161 $(objpfx
)tst-locale.out
: tst-locale.sh
$(common-objpfx
)locale
/localedef \
162 $(ld-test-srcs
) $(addprefix $(objpfx
),$(CTYPE_FILES
))
163 $(SHELL
) -e
$< $(common-objpfx
) '$(built-program-cmd)' > $@
164 $(objpfx
)tst-rpmatch.out
: tst-rpmatch.sh
$(objpfx
)tst-rpmatch \
165 $(objpfx
)tst-fmon.out \
166 $(addprefix $(objpfx
),$(CTYPE_FILES
))
167 $(SHELL
) -e
$< $(common-objpfx
) '$(built-program-cmd)' > $@
168 $(objpfx
)tst-trans.out
: tst-trans.sh
$(objpfx
)tst-trans \
169 $(addprefix $(objpfx
),$(CTYPE_FILES
))
170 $(SHELL
) -e
$< $(common-objpfx
) '$(run-program-prefix)'
171 $(objpfx
)tst-mbswcs.out
: tst-mbswcs.sh
$(objpfx
)tst-mbswcs1 \
172 $(objpfx
)tst-mbswcs2
$(objpfx
)tst-mbswcs3 \
173 $(objpfx
)tst-mbswcs4
$(objpfx
)tst-mbswcs5 \
174 $(addprefix $(objpfx
),$(CTYPE_FILES
))
175 $(SHELL
) -e
$< $(common-objpfx
) '$(run-program-prefix)'
176 $(objpfx
)tst-ctype.out
: tst-ctype.sh
$(objpfx
)tst-ctype \
177 $(objpfx
)sort-test.out \
178 $(addprefix $(objpfx
),$(CTYPE_FILES
))
179 $(SHELL
) -e
$< $(common-objpfx
) '$(built-program-cmd)'
180 $(objpfx
)tst-wctype.out
: tst-wctype.sh
$(objpfx
)tst-wctype \
181 $(objpfx
)sort-test.out tst-wctype.input \
182 $(addprefix $(objpfx
),$(CTYPE_FILES
))
183 $(SHELL
) -e
$< $(common-objpfx
) '$(built-program-cmd)'
184 $(objpfx
)tst-langinfo.out
: tst-langinfo.sh
$(objpfx
)tst-langinfo \
185 $(objpfx
)sort-test.out \
186 $(addprefix $(objpfx
),$(CTYPE_FILES
))
187 $(SHELL
) -e
$< $(common-objpfx
) '$(built-program-cmd)'
188 $(objpfx
)tst-digits.out
: $(objpfx
)tst-locale.out
189 $(objpfx
)tst-mbswcs6.out
: $(addprefix $(objpfx
),$(CTYPE_FILES
))
194 INSTALL-SUPPORTED-LOCALES
=$(addprefix install-
, $(SUPPORTED-LOCALES
))
196 # Sometimes the whole collection of locale files should be installed.
197 LOCALEDEF
=I18NPATH
=. GCONV_PATH
=$(common-objpfx
)iconvdata LC_ALL
=C \
198 $(common-objpfx
)elf
/ld.so
--library-path
$(rpath-link
) $(common-objpfx
)locale
/localedef
199 install-locales
: $(INSTALL-SUPPORTED-LOCALES
)
202 $(..
).
/scripts
/mkinstalldirs
$(inst_localedir
)
204 $(INSTALL-SUPPORTED-LOCALES
): install-locales-dir
205 @locale
=`echo $@ | sed -e 's/^install-//'`; \
206 charset
=`echo $$locale | sed -e 's,.*/,,'`; \
207 locale
=`echo $$locale | sed -e 's,/[^/]*,,'`; \
208 echo
-n
`echo $$locale | sed 's/\([^.\@]*\).*/\1/'`; \
209 echo
-n
".$$charset"; \
210 echo
-n
`echo $$locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \
212 input
=`echo $$locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; \
213 $(LOCALEDEF
) --alias-file
=..
/intl
/locale.alias \
214 -i locales
/$$input -c
-f charmaps
/$$charset \
215 $(addprefix --prefix=,$(install_root
)) $$locale; \
218 # The mbwc-tests need some environment setup to find the locale data files
219 TEST_MBWC_ENV
:= LOCPATH
=$(common-objpfx
)localedata
220 tst_iswalnum-ENV
= $(TEST_MBWC_ENV
)
221 tst_iswalpha-ENV
= $(TEST_MBWC_ENV
)
222 tst_iswcntrl-ENV
= $(TEST_MBWC_ENV
)
223 tst_iswctype-ENV
= $(TEST_MBWC_ENV
)
224 tst_iswdigit-ENV
= $(TEST_MBWC_ENV
)
225 tst_iswgraph-ENV
= $(TEST_MBWC_ENV
)
226 tst_iswlower-ENV
= $(TEST_MBWC_ENV
)
227 tst_iswprint-ENV
= $(TEST_MBWC_ENV
)
228 tst_iswpunct-ENV
= $(TEST_MBWC_ENV
)
229 tst_iswspace-ENV
= $(TEST_MBWC_ENV
)
230 tst_iswupper-ENV
= $(TEST_MBWC_ENV
)
231 tst_iswxdigit-ENV
= $(TEST_MBWC_ENV
)
232 tst_mblen-ENV
= $(TEST_MBWC_ENV
)
233 tst_mbrlen-ENV
= $(TEST_MBWC_ENV
)
234 tst_mbrtowc-ENV
= $(TEST_MBWC_ENV
)
235 tst_mbsrtowcs-ENV
= $(TEST_MBWC_ENV
)
236 tst_mbstowcs-ENV
= $(TEST_MBWC_ENV
)
237 tst_mbtowc-ENV
= $(TEST_MBWC_ENV
)
238 tst_strcoll-ENV
= $(TEST_MBWC_ENV
)
239 tst_strfmon-ENV
= $(TEST_MBWC_ENV
)
240 tst_strxfrm-ENV
= $(TEST_MBWC_ENV
)
241 tst_swscanf-ENV
= $(TEST_MBWC_ENV
)
242 tst_towctrans-ENV
= $(TEST_MBWC_ENV
)
243 tst_towlower-ENV
= $(TEST_MBWC_ENV
)
244 tst_towupper-ENV
= $(TEST_MBWC_ENV
)
245 tst_wcrtomb-ENV
= $(TEST_MBWC_ENV
)
246 tst_wcscat-ENV
= $(TEST_MBWC_ENV
)
247 tst_wcschr-ENV
= $(TEST_MBWC_ENV
)
248 tst_wcscmp-ENV
= $(TEST_MBWC_ENV
)
249 tst_wcscoll-ENV
= $(TEST_MBWC_ENV
)
250 tst_wcscpy-ENV
= $(TEST_MBWC_ENV
)
251 tst_wcscspn-ENV
= $(TEST_MBWC_ENV
)
252 tst_wcslen-ENV
= $(TEST_MBWC_ENV
)
253 tst_wcsncat-ENV
= $(TEST_MBWC_ENV
)
254 tst_wcsncmp-ENV
= $(TEST_MBWC_ENV
)
255 tst_wcsncpy-ENV
= $(TEST_MBWC_ENV
)
256 tst_wcspbrk-ENV
= $(TEST_MBWC_ENV
)
257 tst_wcsrtombs-ENV
= $(TEST_MBWC_ENV
)
258 tst_wcsspn-ENV
= $(TEST_MBWC_ENV
)
259 tst_wcsstr-ENV
= $(TEST_MBWC_ENV
)
260 tst_wcstod-ENV
= $(TEST_MBWC_ENV
)
261 tst_wcstok-ENV
= $(TEST_MBWC_ENV
)
262 tst_wcstombs-ENV
= $(TEST_MBWC_ENV
)
263 tst_wcswidth-ENV
= $(TEST_MBWC_ENV
)
264 tst_wcsxfrm-ENV
= $(TEST_MBWC_ENV
)
265 tst_wctob-ENV
= $(TEST_MBWC_ENV
)
266 tst_wctomb-ENV
= $(TEST_MBWC_ENV
)
267 tst_wctrans-ENV
= $(TEST_MBWC_ENV
)
268 tst_wctype-ENV
= $(TEST_MBWC_ENV
)
269 tst_wcwidth-ENV
= $(TEST_MBWC_ENV
)
270 tst-digits-ENV
= $(TEST_MBWC_ENV
)
271 tst-mbswcs6-ENV
= $(TEST_MBWC_ENV
)
272 tst-xlocale1-ENV
= $(TEST_MBWC_ENV
)
273 tst-xlocale2-ENV
= $(TEST_MBWC_ENV
)
274 tst-strfmon1-ENV
= $(TEST_MBWC_ENV
)
275 tst-strptime-ENV
= $(TEST_MBWC_ENV
)
277 tst-setlocale-ENV
= LOCPATH
=$(common-objpfx
)localedata LC_ALL
=ja_JP.EUC-JP
279 bug-iconv-trans-ENV
= LOCPATH
=$(common-objpfx
)localedata
281 tst-sscanf-ENV
= LOCPATH
=$(common-objpfx
)localedata
283 tst-leaks-ENV
= MALLOC_TRACE
=$(objpfx
)tst-leaks.mtrace \
284 LOCPATH
=$(common-objpfx
)localedata
285 $(objpfx
)mtrace-tst-leaks
: $(objpfx
)tst-leaks.out
286 $(common-objpfx
)malloc
/mtrace
$(objpfx
)tst-leaks.mtrace
> $@
288 bug-setlocale1-ENV
= LOCPATH
=$(common-objpfx
)localedata
289 bug-setlocale1-ARGS
= $(common-objpfx
)
290 tst-setlocale2-ENV
= LOCPATH
=$(common-objpfx
)localedata
292 $(objdir
)/iconvdata
/gconv-modules
:
293 $(MAKE
) -C ..
/iconvdata subdir
=iconvdata
$@