1 # Copyright (C) 1991,1992,1995-2003,2005,2009,2011
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, write to the Free
17 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 # Makefile for locales.
25 headers = locale.h bits/locale.h langinfo.h xlocale.h
26 distribute = localeinfo.h categories.def iso-639.def iso-3166.def \
27 iso-4217.def weight.h weightwc.h strlen-hash.h elem-hash.h \
28 indigits.h indigitswc.h outdigits.h outdigitswc.h \
29 coll-lookup.h C-translit.h.in C-translit.h gen-translit.pl \
30 locarchive.h hashval.h \
31 $(addprefix programs/, \
32 locale.c localedef.c \
33 $(localedef-modules:=.c) $(locale-modules:=.c) \
34 $(lib-modules:=.c) config.h simple-hash.h \
35 charmap-kw.gperf charmap-kw.h locfile-token.h \
36 locfile-kw.gperf locfile-kw.h linereader.h \
37 locfile.h charmap.h repertoire.h localedef.h \
38 3level.h charmap-dir.h locarchive.c)
39 routines = setlocale findlocale loadlocale loadarchive \
40 localeconv nl_langinfo nl_langinfo_l mb_cur_max \
41 newlocale duplocale freelocale uselocale
42 tests = tst-C-locale tst-locname tst-duplocale
43 categories = ctype messages monetary numeric time paper name \
44 address telephone measurement identification collate
45 aux = $(categories:%=lc-%) $(categories:%=C-%) SYS_libc C_name \
46 xlocale localename global-locale coll-lookup
47 others = localedef locale
48 #others-static = localedef locale
49 install-bin = localedef locale
50 extra-objs = $(localedef-modules:=.o) $(localedef-aux:=.o) \
51 $(locale-modules:=.o) $(lib-modules:=.o)
53 extra-libs = libBrokenLocale
54 extra-libs-others = $(extra-libs)
56 libBrokenLocale-routines = broken_cur_max
58 subdir-dirs = programs
59 vpath %.c programs ../crypt
61 vpath %.gperf programs
63 localedef-modules := localedef $(categories:%=ld-%) \
64 charmap linereader locfile \
67 locale-modules := locale locale-spec
68 lib-modules := charmap-dir simple-hash xmalloc xstrdup
72 GPERFFLAGS = -acCgopt -k1,2,5,9,$$ -L ANSI-C
76 programs/%-kw.h: programs/%-kw.gperf
78 && $(GPERF) $(GPERFFLAGS) -N $(@F:-kw.h=_hash) $(<F) > $(@F).new
81 $(objpfx)localedef: $(localedef-modules:%=$(objpfx)%.o)
82 $(objpfx)localedef: $(localedef-aux:%=$(objpfx)%.o)
83 $(objpfx)locale: $(locale-modules:%=$(objpfx)%.o)
84 $(objpfx)localedef $(objpfx)locale: $(lib-modules:%=$(objpfx)%.o)
86 C-translit.h: C-translit.h.in gen-translit.pl
87 $(PERL) gen-translit.pl < $< > $@.tmp
89 ifeq ($(with-cvs),yes)
90 test ! -d CVS || cvs $(CVSOPTS) commit -mRegenerated $@
93 localepath = "$(localedir):$(i18ndir)"
95 # -Iprograms doesn't really belong here, but this gets it at the head
96 # of the list instead of the tail, where CPPFLAGS-$(lib) gets added.
97 # We need it before the standard -I's to see programs/config.h first.
98 locale-CPPFLAGS = -DLOCALEDIR='"$(localedir)"' \
99 -DLOCALE_ALIAS_PATH='"$(msgcatdir)"' \
102 CPPFLAGS-locale-programs = -DLOCALE_PATH='$(localepath)' \
103 -DCHARMAP_PATH='"$(i18ndir)/charmaps"' \
104 -DREPERTOIREMAP_PATH='"$(i18ndir)/repertoiremaps"' \
105 -DLOCSRCDIR='"$(i18ndir)/locales"' \
106 -DHAVE_CONFIG_H -DNOT_IN_libc
108 CFLAGS-charmap.c = -Wno-write-strings -Wno-char-subscripts
109 CFLAGS-locfile.c = -Wno-write-strings -Wno-char-subscripts
110 CFLAGS-charmap-dir.c = -Wno-write-strings
112 # This makes sure -DNOT_IN_libc et al are passed for all these modules.
113 cpp-srcs-left := $(addsuffix .c,$(localedef-modules) $(localedef-aux) \
114 $(locale-modules) $(lib-modules))
115 lib := locale-programs
116 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
118 # Depend on libc.so so a DT_NEEDED is generated in the shared objects.
119 # This ensures they will load libc.so for needed symbols if loaded by
120 # a statically-linked program that hasn't already loaded it.
121 $(objpfx)libBrokenLocale.so: $(common-objpfx)libc.so \
122 $(common-objpfx)libc_nonshared.a