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