1 # Copyright (C) 1991,1992,1995-2003,2005,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
20 # Makefile for locales.
22 include ../option-groups.mak
26 headers = locale.h bits/locale.h langinfo.h xlocale.h
27 distribute = localeinfo.h categories.def iso-639.def iso-3166.def \
28 iso-4217.def weight.h weightwc.h strlen-hash.h elem-hash.h \
29 indigits.h indigitswc.h outdigits.h outdigitswc.h \
30 coll-lookup.h C-translit.h.in C-translit.h gen-translit.pl \
31 locarchive.h hashval.h dummy-setlocale.c \
32 $(addprefix programs/, \
33 locale.c localedef.c \
34 $(localedef-modules:=.c) $(locale-modules:=.c) \
35 $(lib-modules:=.c) config.h simple-hash.h \
36 charmap-kw.gperf charmap-kw.h locfile-token.h \
37 locfile-kw.gperf locfile-kw.h linereader.h \
38 locfile.h charmap.h repertoire.h localedef.h \
39 3level.h charmap-dir.h locarchive.c)
40 # catnames is needed by OPTION_EGLIBC_LOCALE_CODE and by the 'intl' code.
41 # If we put the latter in an option group, too, we can omit catnames
42 # when both option groups are disabled. libstdc++-v3 needs mb_cur_max.
43 routines-y := catnames mb_cur_max
44 routines-$(OPTION_EGLIBC_LOCALE_CODE) \
45 += setlocale findlocale loadlocale loadarchive \
46 localeconv nl_langinfo nl_langinfo_l \
47 newlocale duplocale freelocale uselocale
48 ifneq (y,$(OPTION_EGLIBC_LOCALE_CODE))
49 routines-y += dummy-setlocale
51 tests-$(OPTION_EGLIBC_LOCALE_CODE) += tst-C-locale tst-locname tst-duplocale
52 categories = ctype messages monetary numeric time paper name \
53 address telephone measurement identification collate
54 # C-messages belongs in an intl option group.
55 aux-y := C-ctype C-time \
56 SYS_libc C_name xlocale global-locale coll-lookup
57 aux-$(OPTION_EGLIBC_LOCALE_CODE) \
58 += $(filter-out $(aux-y), \
59 $(categories:%=lc-%) $(categories:%=C-%)) \
61 others-$(OPTION_EGLIBC_LOCALE_CODE) = localedef locale
62 #others-static = localedef locale
63 install-bin = $(others-y)
64 extra-objs-$(OPTION_EGLIBC_LOCALE_CODE) \
65 = $(localedef-modules:=.o) $(localedef-aux:=.o) \
66 $(locale-modules:=.o) $(lib-modules:=.o)
68 extra-libs-$(OPTION_EGLIBC_LOCALE_CODE) = libBrokenLocale
69 extra-libs-others = $(extra-libs-y)
71 libBrokenLocale-routines = broken_cur_max
73 subdir-dirs = programs
74 vpath %.c programs ../crypt
76 vpath %.gperf programs
78 localedef-modules := $(categories:%=ld-%) charmap linereader locfile \
81 locale-modules := locale-spec
82 lib-modules := charmap-dir simple-hash xmalloc xstrdup
86 GPERFFLAGS = -acCgopt -k1,2,5,9,$$ -L ANSI-C
90 programs/%-kw.h: programs/%-kw.gperf
92 && $(GPERF) $(GPERFFLAGS) -N $(@F:-kw.h=_hash) $(<F) > $(@F).new
95 $(objpfx)localedef: $(localedef-modules:%=$(objpfx)%.o)
96 $(objpfx)localedef: $(localedef-aux:%=$(objpfx)%.o)
97 $(objpfx)locale: $(locale-modules:%=$(objpfx)%.o)
98 $(objpfx)localedef $(objpfx)locale: $(lib-modules:%=$(objpfx)%.o)
100 C-translit.h: C-translit.h.in gen-translit.pl
101 $(PERL) gen-translit.pl < $< > $@.tmp
103 ifeq ($(with-cvs),yes)
104 test ! -d CVS || cvs $(CVSOPTS) commit -mRegenerated $@
107 localepath = "$(localedir):$(i18ndir)"
109 locale-CPPFLAGS := -DLOCALE_PATH='$(localepath)' \
110 -DLOCALEDIR='"$(localedir)"' \
111 -DLOCALE_ALIAS_PATH='"$(msgcatdir)"' \
112 -DCHARMAP_PATH='"$(i18ndir)/charmaps"' \
113 -DREPERTOIREMAP_PATH='"$(i18ndir)/repertoiremaps"' \
114 -DLOCSRCDIR='"$(i18ndir)/locales"' -DHAVE_CONFIG_H \
117 CFLAGS-charmap.c = -Wno-write-strings -Wno-char-subscripts
118 CFLAGS-locfile.c = -Wno-write-strings -Wno-char-subscripts
119 CFLAGS-charmap-dir.c = -Wno-write-strings
120 ifneq (y,$(OPTION_EGLIBC_SPAWN))
121 CFLAGS-charmap-dir.c += -DNO_UNCOMPRESS
124 # This makes sure -DNOT_IN_libc is passed for all these modules.
125 cpp-srcs-left := $(addsuffix .c,$(localedef-modules) $(localedef-aux) \
126 $(locale-modules) $(lib-modules))
128 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
130 # Depend on libc.so so a DT_NEEDED is generated in the shared objects.
131 # This ensures they will load libc.so for needed symbols if loaded by
132 # a statically-linked program that hasn't already loaded it.
133 $(objpfx)libBrokenLocale.so: $(common-objpfx)libc.so \
134 $(common-objpfx)libc_nonshared.a