]> git.ipfire.org Git - thirdparty/glibc.git/blob - localedata/Makefile
a2854e03f3a0a89e8777756bab46d7d48d318280
[thirdparty/glibc.git] / localedata / Makefile
1 # Copyright (C) 1996-2020 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 # <https://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-ctype tst-langinfo-newlocale tst-langinfo-setlocale \
38 tst-langinfo-newlocale-static tst-langinfo-setlocale-static \
39 tst-numeric
40 # List of test input files (list sorted alphabetically):
41 test-input := \
42 am_ET.UTF-8 \
43 az_AZ.UTF-8 \
44 be_BY.UTF-8 \
45 ber_DZ.UTF-8 \
46 ber_MA.UTF-8 \
47 bg_BG.UTF-8 \
48 br_FR.UTF-8 \
49 bs_BA.UTF-8 \
50 ckb_IQ.UTF-8 \
51 cmn_TW.UTF-8 \
52 crh_UA.UTF-8 \
53 cs_CZ.UTF-8 \
54 csb_PL.UTF-8 \
55 cv_RU.UTF-8 \
56 cy_GB.UTF-8 \
57 da_DK.ISO-8859-1 \
58 de_DE.ISO-8859-1 \
59 dsb_DE.UTF-8 \
60 dz_BT.UTF-8 \
61 en_US.ISO-8859-1 \
62 en_US.UTF-8 \
63 eo.UTF-8 \
64 es_ES.UTF-8 \
65 et_EE.UTF-8 \
66 fa_IR.UTF-8 \
67 fi_FI.UTF-8 \
68 fil_PH.UTF-8 \
69 fr_CA.UTF-8 \
70 fr_FR.UTF-8 \
71 fur_IT.UTF-8 \
72 gez_ER.UTF-8@abegede \
73 ha_NG.UTF-8 \
74 hr_HR.ISO-8859-2 \
75 hr_HR.UTF-8 \
76 hsb_DE.UTF-8 \
77 hu_HU.UTF-8 \
78 ig_NG.UTF-8 \
79 ik_CA.UTF-8 \
80 is_IS.UTF-8 \
81 kk_KZ.UTF-8 \
82 ku_TR.UTF-8 \
83 ky_KG.UTF-8 \
84 ln_CD.UTF-8 \
85 lt_LT.UTF-8 \
86 lv_LV.UTF-8 \
87 mi_NZ.UTF-8 \
88 ml_IN.UTF-8 \
89 mn_MN.UTF-8 \
90 mr_IN.UTF-8 \
91 mt_MT.UTF-8 \
92 nan_TW.UTF-8@latin \
93 nb_NO.UTF-8 \
94 om_KE.UTF-8 \
95 or_IN.UTF-8 \
96 os_RU.UTF-8 \
97 pl_PL.UTF-8 \
98 ps_AF.UTF-8 \
99 ro_RO.UTF-8 \
100 ru_RU.UTF-8 \
101 sah_RU.UTF-8 \
102 sc_IT.UTF-8 \
103 se_NO.UTF-8 \
104 si_LK.UTF-8 \
105 sq_AL.UTF-8 \
106 sr_RS.UTF-8 \
107 sv_SE.ISO-8859-1 \
108 sv_SE.UTF-8 \
109 szl_PL.UTF-8 \
110 tg_TJ.UTF-8 \
111 tk_TM.UTF-8 \
112 tr_TR.UTF-8 \
113 tt_RU.UTF-8 \
114 tt_RU.UTF-8@iqtelif \
115 ug_CN.UTF-8 \
116 uk_UA.UTF-8 \
117 uz_UZ.UTF-8 \
118 vi_VN.UTF-8 \
119 yi_US.UTF-8 \
120 yo_NG.UTF-8 \
121 zh_CN.UTF-8 \
122 $(NULL)
123
124 test-input-data = $(addsuffix .in, $(test-input))
125 test-output := $(foreach s, .out .xout, \
126 $(addsuffix $s, $(basename $(test-input))))
127 ld-test-names := test1 test2 test3 test4 test5 test6 test7
128 ld-test-srcs := $(addprefix tests/,$(addsuffix .cm,$(ld-test-names)) \
129 $(addsuffix .def,$(ld-test-names)) \
130 $(addsuffix .ds,test5 test6) \
131 test6.c trans.def)
132
133 fmon-tests = n01y12 n02n40 n10y31 n11y41 n12y11 n20n32 n30y20 n41n00 \
134 y01y10 y02n22 y22n42 y30y21 y32n31 y40y00 y42n21
135
136 generated += $(test-input) $(test-output) sort-test.out tst-locale.out \
137 tst-leaks.mtrace mtrace-tst-leaks.out
138 generated-dirs += $(ld-test-names) tt_TT de_DE.437 \
139 $(addprefix tstfmon_,$(fmon-tests)) \
140
141 ifeq ($(run-built-tests),yes)
142 locale_test_suite := tst_iswalnum tst_iswalpha tst_iswcntrl \
143 tst_iswctype tst_iswdigit tst_iswgraph \
144 tst_iswlower tst_iswprint tst_iswpunct \
145 tst_iswspace tst_iswupper tst_iswxdigit tst_mblen \
146 tst_mbrlen tst_mbrtowc tst_mbsrtowcs tst_mbstowcs \
147 tst_mbtowc tst_strcoll tst_strfmon tst_strxfrm \
148 tst_swscanf tst_towctrans tst_towlower \
149 tst_towupper tst_wcrtomb tst_wcscat tst_wcschr \
150 tst_wcscmp tst_wcscoll tst_wcscpy tst_wcscspn \
151 tst_wcslen tst_wcsncat tst_wcsncmp tst_wcsncpy \
152 tst_wcspbrk tst_wcsrtombs tst_wcsspn tst_wcsstr \
153 tst_wcstod tst_wcstok tst_wcstombs tst_wcswidth \
154 tst_wcsxfrm tst_wctob tst_wctomb tst_wctrans \
155 tst_wctype tst_wcwidth
156
157 tests = $(locale_test_suite) tst-digits tst-setlocale bug-iconv-trans \
158 tst-leaks tst-mbswcs1 tst-mbswcs2 tst-mbswcs3 tst-mbswcs4 tst-mbswcs5 \
159 tst-mbswcs6 tst-xlocale1 tst-xlocale2 bug-usesetlocale \
160 tst-strfmon1 tst-sscanf bug-setlocale1 tst-setlocale2 tst-setlocale3 \
161 tst-wctype tst-iconv-math-trans
162 tests-static = bug-setlocale1-static
163 tests += $(tests-static)
164 ifeq (yes,$(build-shared))
165 ifneq (no,$(PERL))
166 tests-special += $(objpfx)mtrace-tst-leaks.out
167 endif
168 endif
169 endif
170 tests-container = \
171 tst-localedef-hardlinks
172
173 # Files to install.
174 ifeq ($(INSTALL_UNCOMPRESSED),yes)
175 # This option is for testing inside the testroot container, as the
176 # container does not include a working gunzip program.
177 install-others := $(addprefix $(inst_i18ndir)/, \
178 $(charmaps) \
179 $(locales))
180 else
181 install-others := $(addprefix $(inst_i18ndir)/, \
182 $(addsuffix .gz, $(charmaps)) \
183 $(locales))
184 endif
185
186 tests: $(objdir)/iconvdata/gconv-modules
187
188 tests-static += tst-langinfo-newlocale-static tst-langinfo-setlocale-static
189
190 ifeq ($(run-built-tests),yes)
191 tests-special += $(objpfx)sort-test.out $(objpfx)tst-fmon.out \
192 $(objpfx)tst-locale.out $(objpfx)tst-rpmatch.out \
193 $(objpfx)tst-trans.out $(objpfx)tst-ctype.out \
194 $(objpfx)tst-langinfo-newlocale.out \
195 $(objpfx)tst-langinfo-setlocale.out \
196 $(objpfx)tst-langinfo-newlocale-static.out \
197 $(objpfx)tst-langinfo-setlocale-static.out \
198 $(objpfx)tst-numeric.out
199 # We have to generate locales (list sorted alphabetically)
200 LOCALES := \
201 am_ET.UTF-8 \
202 az_AZ.UTF-8 \
203 be_BY.UTF-8 \
204 ber_DZ.UTF-8 \
205 ber_MA.UTF-8 \
206 bg_BG.UTF-8 \
207 br_FR.UTF-8 \
208 bs_BA.UTF-8 \
209 ckb_IQ.UTF-8 \
210 cmn_TW.UTF-8 \
211 crh_UA.UTF-8 \
212 cs_CZ.UTF-8 \
213 csb_PL.UTF-8 \
214 cv_RU.UTF-8 \
215 cy_GB.UTF-8 \
216 da_DK.ISO-8859-1 \
217 de_DE.ISO-8859-1 \
218 de_DE.UTF-8 \
219 dsb_DE.UTF-8 \
220 dz_BT.UTF-8 \
221 en_GB.UTF-8 \
222 en_US.ANSI_X3.4-1968 \
223 en_US.ISO-8859-1\
224 en_US.UTF-8 \
225 eo.UTF-8 \
226 es_ES.UTF-8 \
227 et_EE.UTF-8 \
228 fa_IR.UTF-8 \
229 fi_FI.UTF-8 \
230 fil_PH.UTF-8 \
231 fr_CA.UTF-8 \
232 fr_FR.ISO-8859-1 \
233 fr_FR.UTF-8 \
234 fur_IT.UTF-8 \
235 gez_ER.UTF-8@abegede \
236 ha_NG.UTF-8 \
237 hr_HR.ISO-8859-2 \
238 hr_HR.UTF-8 \
239 hsb_DE.UTF-8 \
240 hu_HU.UTF-8 \
241 ig_NG.UTF-8 \
242 ik_CA.UTF-8 \
243 is_IS.UTF-8 \
244 ja_JP.EUC-JP \
245 ja_JP.SJIS \
246 ja_JP.UTF-8 \
247 kk_KZ.UTF-8 \
248 ku_TR.UTF-8 \
249 ky_KG.UTF-8 \
250 ln_CD.UTF-8 \
251 lt_LT.UTF-8 \
252 lv_LV.UTF-8 \
253 mi_NZ.UTF-8 \
254 ml_IN.UTF-8 \
255 mn_MN.UTF-8 \
256 mr_IN.UTF-8 \
257 mt_MT.UTF-8 \
258 nan_TW.UTF-8@latin \
259 nb_NO.ISO-8859-1 \
260 nb_NO.UTF-8 \
261 nl_NL.UTF-8 \
262 nn_NO.ISO-8859-1 \
263 om_KE.UTF-8 \
264 or_IN.UTF-8 \
265 os_RU.UTF-8 \
266 pl_PL.UTF-8 \
267 ps_AF.UTF-8 \
268 ro_RO.UTF-8 \
269 ru_RU.UTF-8 \
270 sah_RU.UTF-8 \
271 sc_IT.UTF-8 \
272 se_NO.UTF-8 \
273 si_LK.UTF-8 \
274 sq_AL.UTF-8 \
275 sr_RS.UTF-8 \
276 sv_SE.ISO-8859-1 \
277 sv_SE.UTF-8 \
278 szl_PL.UTF-8 \
279 tg_TJ.UTF-8 \
280 tk_TM.UTF-8 \
281 tr_TR.ISO-8859-9 \
282 tr_TR.UTF-8 \
283 tt_RU.UTF-8 \
284 tt_RU.UTF-8@iqtelif \
285 ug_CN.UTF-8 \
286 uk_UA.UTF-8 \
287 uz_UZ.UTF-8 \
288 vi_VN.UTF-8 \
289 yi_US.UTF-8 \
290 yo_NG.UTF-8 \
291 zh_CN.UTF-8 \
292 zh_TW.EUC-TW \
293 $(NULL)
294
295 include ../gen-locales.mk
296
297 $(objpfx)tst-iconv-math-trans.out: $(gen-locales)
298 endif
299
300 include ../Rules
301
302 ifeq ($(INSTALL_UNCOMPRESSED),yes)
303 # Install the charmap files as-is. This option is for testing inside
304 # the testroot container, as the container does not include a working
305 # gunzip program.
306 $(inst_i18ndir)/charmaps/%: charmaps/% $(+force)
307 $(make-target-directory)
308 rm -f $@
309 $(INSTALL_DATA) $< $@
310 else
311 # Install the charmap files in gzipped format.
312 $(inst_i18ndir)/charmaps/%.gz: charmaps/% $(+force)
313 $(make-target-directory)
314 rm -f $(@:.gz=) $@
315 $(INSTALL_DATA) $< $(@:.gz=)
316 gzip -9n $(@:.gz=)
317 endif
318
319 # Install the locale source files in the appropriate directory.
320 $(inst_i18ndir)/locales/%: locales/% $(+force); $(do-install)
321
322 ifeq ($(run-built-tests),yes)
323 generated-dirs += $(LOCALES)
324
325 $(addsuffix .out,$(addprefix $(objpfx),$(tests))): %: \
326 $(addprefix $(objpfx),$(CTYPE_FILES))
327
328 $(objpfx)sort-test.out: sort-test.sh $(objpfx)collate-test $(objpfx)xfrm-test \
329 $(test-input-data) $(addprefix $(objpfx),$(CTYPE_FILES))
330 $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
331 '$(run-program-env)' '$(test-program-prefix-after-env)' \
332 $(test-input) \
333 > $@; \
334 $(evaluate-test)
335 $(objpfx)tst-fmon.out: tst-fmon.sh $(objpfx)tst-fmon tst-fmon.data \
336 $(objpfx)sort-test.out \
337 $(addprefix $(objpfx),$(CTYPE_FILES))
338 $(SHELL) $< $(common-objpfx) '$(run-program-prefix-before-env)' \
339 '$(run-program-env)' '$(run-program-prefix-after-env)' \
340 '$(test-program-prefix)' tst-fmon.data \
341 > $@; \
342 $(evaluate-test)
343 $(objpfx)tst-numeric.out: tst-numeric.sh $(objpfx)tst-numeric tst-numeric.data \
344 $(objpfx)sort-test.out \
345 $(addprefix $(objpfx),$(CTYPE_FILES))
346 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' tst-numeric.data \
347 > $@; \
348 $(evaluate-test)
349 $(objpfx)tst-locale.out: tst-locale.sh $(common-objpfx)locale/localedef \
350 $(ld-test-srcs) $(addprefix $(objpfx),$(CTYPE_FILES))
351 $(SHELL) $< $(common-objpfx) '$(built-program-cmd-before-env)' \
352 '$(run-program-env)' '$(built-program-cmd-after-env)' > $@; \
353 $(evaluate-test)
354 $(objpfx)tst-rpmatch.out: tst-rpmatch.sh $(objpfx)tst-rpmatch \
355 $(objpfx)tst-fmon.out \
356 $(addprefix $(objpfx),$(CTYPE_FILES))
357 $(SHELL) $< $(common-objpfx) '$(test-program-cmd)' > $@; \
358 $(evaluate-test)
359 $(objpfx)tst-trans.out: tst-trans.sh $(objpfx)tst-trans \
360 $(addprefix $(objpfx),$(CTYPE_FILES))
361 $(SHELL) $< $(common-objpfx) '$(run-program-prefix-before-env)' \
362 '$(run-program-env)' '$(run-program-prefix-after-env)' \
363 '$(test-program-prefix-before-env)' \
364 '$(test-program-prefix-after-env)'; \
365 $(evaluate-test)
366 $(objpfx)tst-ctype.out: tst-ctype.sh $(objpfx)tst-ctype \
367 $(objpfx)sort-test.out \
368 $(addprefix $(objpfx),$(CTYPE_FILES))
369 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
370 '$(run-program-env)' '$(test-program-cmd-after-env)'; \
371 $(evaluate-test)
372 $(objpfx)tst-langinfo-newlocale.out: tst-langinfo.sh \
373 $(objpfx)tst-langinfo-newlocale \
374 $(objpfx)sort-test.out \
375 $(addprefix $(objpfx),$(CTYPE_FILES))
376 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
377 '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
378 $(evaluate-test)
379 $(objpfx)tst-langinfo-newlocale-static.out: tst-langinfo.sh \
380 $(objpfx)tst-langinfo-newlocale-static \
381 $(objpfx)sort-test.out \
382 $(addprefix $(objpfx),$(CTYPE_FILES))
383 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
384 '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
385 $(evaluate-test)
386 # Static use of newlocale is known not to work. See Bug 23164.
387 test-xfail-tst-langinfo-newlocale-static = yes
388
389 $(objpfx)tst-langinfo-setlocale.out: tst-langinfo.sh \
390 $(objpfx)tst-langinfo-setlocale \
391 $(objpfx)sort-test.out \
392 $(addprefix $(objpfx),$(CTYPE_FILES))
393 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
394 '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
395 $(evaluate-test)
396 $(objpfx)tst-langinfo-setlocale-static.out: tst-langinfo.sh \
397 $(objpfx)tst-langinfo-setlocale-static \
398 $(objpfx)sort-test.out \
399 $(addprefix $(objpfx),$(CTYPE_FILES))
400 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
401 '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
402 $(evaluate-test)
403
404 $(objpfx)tst-digits.out: $(objpfx)tst-locale.out
405 $(objpfx)tst-mbswcs6.out: $(addprefix $(objpfx),$(CTYPE_FILES))
406 endif
407
408 include SUPPORTED
409
410 INSTALL-SUPPORTED-LOCALE-ARCHIVE=$(addprefix install-archive-, $(SUPPORTED-LOCALES))
411 INSTALL-SUPPORTED-LOCALE-FILES=$(addprefix install-files-, $(SUPPORTED-LOCALES))
412
413 # Sometimes the whole collection of locale files should be installed.
414 LOCALEDEF=I18NPATH=. GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
415 $(rtld-prefix) $(common-objpfx)locale/localedef
416 install-locales: install-locale-archive
417
418 # Create and install the locale-archive file.
419 install-locale-archive: $(INSTALL-SUPPORTED-LOCALE-ARCHIVE)
420 # Create and install the locales individually (no archive).
421 install-locale-files: $(INSTALL-SUPPORTED-LOCALE-FILES)
422
423 install-locales-dir:
424 $(..)./scripts/mkinstalldirs $(inst_complocaledir)
425
426 # The SHIFT_JIS and SHIFT_JISX0213 character maps are not ASCII compatible,
427 # therefore we have to use --no-warnings=ascii to disable the ASCII check.
428 # See localedata/gen-locale.sh for the same logic.
429 define build-one-locale
430 locale=`echo $@ | sed -e 's/^install-[a-z]*-//'`; \
431 charset=`echo $$locale | sed -e 's,.*/,,'`; \
432 locale=`echo $$locale | sed -e 's,/[^/]*,,'`; \
433 if [ "$$charset" = 'SHIFT_JIS' ] \
434 || [ "$$charset" = 'SHIFT_JISX0213' ]; then \
435 flags="$$flags --no-warnings=ascii"; \
436 fi; \
437 echo -n `echo $$locale | sed 's/\([^.\@]*\).*/\1/'`; \
438 echo -n ".$$charset"; \
439 echo -n `echo $$locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \
440 echo -n '...'; \
441 input=`echo $$locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; \
442 $(LOCALEDEF) $$flags --alias-file=../intl/locale.alias \
443 -i locales/$$input -f charmaps/$$charset \
444 $(addprefix --prefix=,$(install_root)) $$locale \
445 && echo ' done';
446 endef
447
448 $(INSTALL-SUPPORTED-LOCALE-ARCHIVE): install-locales-dir
449 @flags="-c"; \
450 $(build-one-locale)
451
452 $(INSTALL-SUPPORTED-LOCALE-FILES): install-locales-dir
453 @flags="-c --no-archive --no-hard-links"; \
454 $(build-one-locale)
455
456 tst-setlocale-ENV = LC_ALL=ja_JP.EUC-JP
457 tst-wctype-ENV = LC_ALL=ja_JP.EUC-JP
458
459 tst-leaks-ENV = MALLOC_TRACE=$(objpfx)tst-leaks.mtrace
460 $(objpfx)mtrace-tst-leaks.out: $(objpfx)tst-leaks.out
461 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@; \
462 $(evaluate-test)
463
464 bug-setlocale1-ENV-only = LOCPATH=$(objpfx) LC_CTYPE=de_DE.UTF-8
465 bug-setlocale1-static-ENV-only = $(bug-setlocale1-ENV-only)
466
467 $(objdir)/iconvdata/gconv-modules:
468 $(MAKE) -C ../iconvdata subdir=iconvdata $@