Update copyright notices with scripts/update-copyrights
[jlayton/glibc.git] / locale / Makefile
1 # Copyright (C) 1991-2014 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 # <http://www.gnu.org/licenses/>.
17
18 #
19 #       Makefile for locales.
20 #
21 subdir  := locale
22
23 headers         = locale.h bits/locale.h langinfo.h xlocale.h
24 routines        = setlocale findlocale loadlocale loadarchive \
25                   localeconv nl_langinfo nl_langinfo_l mb_cur_max \
26                   newlocale duplocale freelocale uselocale
27 tests           = tst-C-locale tst-locname tst-duplocale
28 categories      = ctype messages monetary numeric time paper name \
29                   address telephone measurement identification collate
30 aux             = $(categories:%=lc-%) $(categories:%=C-%) SYS_libc C_name \
31                   xlocale localename global-locale coll-lookup
32 others          = localedef locale
33 #others-static  = localedef locale
34 install-bin     = localedef locale
35 extra-objs      = $(localedef-modules:=.o) $(localedef-aux:=.o) \
36                   $(locale-modules:=.o) $(lib-modules:=.o)
37
38 extra-libs      = libBrokenLocale
39 extra-libs-others = $(extra-libs)
40
41 libBrokenLocale-routines = broken_cur_max
42
43 subdir-dirs     = programs
44 vpath %.c programs ../crypt
45 vpath %.h programs
46 vpath %.gperf programs
47
48 localedef-modules       := localedef $(categories:%=ld-%) \
49                            charmap linereader locfile \
50                            repertoire locarchive
51 localedef-aux           := md5
52 locale-modules          := locale locale-spec
53 lib-modules             := charmap-dir simple-hash xmalloc xstrdup
54
55
56 GPERF = gperf
57 GPERFFLAGS = -acCgopt -k1,2,5,9,$$ -L ANSI-C
58
59 include ../Rules
60
61 CFLAGS-md5.c = -I../crypt
62
63 programs/%-kw.h: programs/%-kw.gperf
64         cd programs \
65         && $(GPERF) $(GPERFFLAGS) -N $(@F:-kw.h=_hash) $(<F) > $(@F).new
66         mv -f $@.new $@
67
68 $(objpfx)localedef: $(localedef-modules:%=$(objpfx)%.o)
69 $(objpfx)localedef: $(localedef-aux:%=$(objpfx)%.o)
70 $(objpfx)locale: $(locale-modules:%=$(objpfx)%.o)
71 $(objpfx)localedef $(objpfx)locale: $(lib-modules:%=$(objpfx)%.o)
72
73 C-translit.h: C-translit.h.in gen-translit.pl
74         $(PERL) gen-translit.pl < $< > $@.tmp
75         mv -f $@.tmp $@
76
77 localepath = "$(localedir):$(i18ndir)"
78
79 # -Iprograms doesn't really belong here, but this gets it at the head
80 # of the list instead of the tail, where CPPFLAGS-$(lib) gets added.
81 # We need it before the standard -I's to see programs/config.h first.
82 locale-CPPFLAGS = -DLOCALEDIR='"$(localedir)"' \
83                   -DLOCALE_ALIAS_PATH='"$(msgcatdir)"' \
84                   -Iprograms
85
86 CPPFLAGS-locale-programs = -DLOCALE_PATH='$(localepath)' \
87                            -DCHARMAP_PATH='"$(i18ndir)/charmaps"' \
88                            -DREPERTOIREMAP_PATH='"$(i18ndir)/repertoiremaps"' \
89                            -DLOCSRCDIR='"$(i18ndir)/locales"' \
90                            -DHAVE_CONFIG_H -DNOT_IN_libc
91
92 CFLAGS-charmap.c = -Wno-write-strings -Wno-char-subscripts
93 CFLAGS-locfile.c = -Wno-write-strings -Wno-char-subscripts
94 CFLAGS-charmap-dir.c = -Wno-write-strings
95
96 # This makes sure -DNOT_IN_libc et al are passed for all these modules.
97 cpp-srcs-left := $(addsuffix .c,$(localedef-modules) $(localedef-aux) \
98                                 $(locale-modules) $(lib-modules))
99 lib := locale-programs
100 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))