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