Document use of CC and CFLAGS in more detail (bug 20980, bug 21234).
[glibc.git] / locale / Makefile
blobfd9972279ba7fe0b75e158aa080cdc31cdf7b666
1 # Copyright (C) 1991-2018 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, see
16 # <http://www.gnu.org/licenses/>.
19 # Makefile for locales.
21 subdir := locale
23 include ../Makeconfig
25 headers = langinfo.h locale.h bits/locale.h \
26 bits/types/locale_t.h bits/types/__locale_t.h
27 routines = setlocale findlocale loadlocale loadarchive \
28 localeconv nl_langinfo nl_langinfo_l mb_cur_max \
29 newlocale duplocale freelocale uselocale
30 tests = tst-C-locale tst-locname tst-duplocale
31 categories = ctype messages monetary numeric time paper name \
32 address telephone measurement identification collate
33 aux = $(categories:%=lc-%) $(categories:%=C-%) SYS_libc C_name \
34 xlocale localename global-locale coll-lookup
35 others = localedef locale
36 #others-static = localedef locale
37 install-bin = localedef locale
38 extra-objs = $(localedef-modules:=.o) $(localedef-aux:=.o) \
39 $(locale-modules:=.o) $(lib-modules:=.o)
41 extra-libs = libBrokenLocale
42 extra-libs-others = $(extra-libs)
44 libBrokenLocale-routines = broken_cur_max
46 subdir-dirs = programs
47 vpath %.c programs ../crypt
48 vpath %.h programs
49 vpath %.gperf programs
51 localedef-modules := localedef $(categories:%=ld-%) \
52 charmap linereader locfile \
53 repertoire locarchive
54 localedef-aux := md5
55 locale-modules := locale locale-spec
56 lib-modules := charmap-dir simple-hash xmalloc xstrdup \
57 record-status
60 GPERF = gperf
61 GPERFFLAGS = -acCgopt -k1,2,5,9,$$ -L ANSI-C
63 include ../Rules
65 CFLAGS-md5.c += -I../crypt
67 programs/%-kw.h: programs/%-kw.gperf
68 cd programs \
69 && $(GPERF) $(GPERFFLAGS) -N $(@F:-kw.h=_hash) $(<F) > $(@F).new
70 mv -f $@.new $@
72 $(objpfx)localedef: $(localedef-modules:%=$(objpfx)%.o)
73 $(objpfx)localedef: $(localedef-aux:%=$(objpfx)%.o)
74 $(objpfx)locale: $(locale-modules:%=$(objpfx)%.o)
75 $(objpfx)localedef $(objpfx)locale: $(lib-modules:%=$(objpfx)%.o)
77 C-translit.h: C-translit.h.in gen-translit.pl
78 $(PERL) gen-translit.pl < $< > $@.tmp
79 mv -f $@.tmp $@
81 # The path to the compiled binary locale archive or compiled locales,
82 # along with the parent path to the source locales and source
83 # charmaps.
84 localepath = "$(complocaledir):$(i18ndir)"
86 # -Iprograms doesn't really belong here, but this gets it at the head
87 # of the list instead of the tail, where CPPFLAGS-$(lib) gets added.
88 # We need it before the standard -I's to see programs/config.h first.
89 locale-CPPFLAGS = -DCOMPLOCALEDIR='"$(complocaledir)"' \
90 -DLOCALE_ALIAS_PATH='"$(localedir)"' \
91 -Iprograms
93 CPPFLAGS-locale-programs = -DLOCALE_PATH='$(localepath)' \
94 -DCHARMAP_PATH='"$(i18ndir)/charmaps"' \
95 -DREPERTOIREMAP_PATH='"$(i18ndir)/repertoiremaps"' \
96 -DLOCSRCDIR='"$(i18ndir)/locales"'
98 CFLAGS-charmap.c += -Wno-write-strings -Wno-char-subscripts
99 CFLAGS-locfile.c += -Wno-write-strings -Wno-char-subscripts
100 CFLAGS-charmap-dir.c += -Wno-write-strings
102 # Set libof-* for each routine.
103 cpp-srcs-left := $(localedef-modules) $(localedef-aux) $(locale-modules) \
104 $(lib-modules)
105 lib := locale-programs
106 include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))