glibc/locale/Makefile
Carlos O'Donell 314f6deec9 Enable --localedir to set message catalog directory (Bug 14259)
In 1999 the project split "localedir" into "localedir" (path to compiled
locale archives) and "msgcatdir" (path to message catalogs). This
predates the 2002 change in the GNU Coding Standard to document the use
of "localedir" for the path to the message catalogs. It appears that
newlib, gcc, and several other projects also used "msgcatdir" at one
point or another in the past, and so it is in line with historical
precedent that glibc would also use "msgcatdir." However, given that the
GNU Coding Standard uses "localedir", we will switch to that for
consistency as a GNU project. Previous uses of --localdir didn't work
anyway (see bug 14259).

I am committing this patch in the understanding that nobody would object
to fixing #14259 as part of aligning our variable usage to the GNU
Coding Standard.

Given that previous "localedir" uses were converted to "complocaledir"
by [1], we can now convert "msgcatdir" to "localedir" and complete the
transition. With an addition to config.make.in we also fix bug 14259 and
allow users to specify the locale dependent data directory with
"--localedir" at configure time. There is still no way to control at
configure time the location of the *compiled* locale directory.

Tested on x86_64 with no regressions.

Tested using "--localedir" to specify alternate locale dependent data
directory and verified with "make install DESTDIR=/tmp/glibc".

[1] 90fe682d30
2016-02-24 20:06:04 -05:00

105 lines
3.5 KiB
Makefile

# Copyright (C) 1991-2016 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
# The GNU C Library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
#
# Makefile for locales.
#
subdir := locale
include ../Makeconfig
headers = locale.h bits/locale.h langinfo.h xlocale.h
routines = setlocale findlocale loadlocale loadarchive \
localeconv nl_langinfo nl_langinfo_l mb_cur_max \
newlocale duplocale freelocale uselocale
tests = tst-C-locale tst-locname tst-duplocale
categories = ctype messages monetary numeric time paper name \
address telephone measurement identification collate
aux = $(categories:%=lc-%) $(categories:%=C-%) SYS_libc C_name \
xlocale localename global-locale coll-lookup
others = localedef locale
#others-static = localedef locale
install-bin = localedef locale
extra-objs = $(localedef-modules:=.o) $(localedef-aux:=.o) \
$(locale-modules:=.o) $(lib-modules:=.o)
extra-libs = libBrokenLocale
extra-libs-others = $(extra-libs)
libBrokenLocale-routines = broken_cur_max
subdir-dirs = programs
vpath %.c programs ../crypt
vpath %.h programs
vpath %.gperf programs
localedef-modules := localedef $(categories:%=ld-%) \
charmap linereader locfile \
repertoire locarchive
localedef-aux := md5
locale-modules := locale locale-spec
lib-modules := charmap-dir simple-hash xmalloc xstrdup
GPERF = gperf
GPERFFLAGS = -acCgopt -k1,2,5,9,$$ -L ANSI-C
include ../Rules
CFLAGS-md5.c = -I../crypt
programs/%-kw.h: programs/%-kw.gperf
cd programs \
&& $(GPERF) $(GPERFFLAGS) -N $(@F:-kw.h=_hash) $(<F) > $(@F).new
mv -f $@.new $@
$(objpfx)localedef: $(localedef-modules:%=$(objpfx)%.o)
$(objpfx)localedef: $(localedef-aux:%=$(objpfx)%.o)
$(objpfx)locale: $(locale-modules:%=$(objpfx)%.o)
$(objpfx)localedef $(objpfx)locale: $(lib-modules:%=$(objpfx)%.o)
C-translit.h: C-translit.h.in gen-translit.pl
$(PERL) gen-translit.pl < $< > $@.tmp
mv -f $@.tmp $@
# The path to the compiled binary locale archive or compiled locales,
# along with the parent path to the source locales and source
# charmaps.
localepath = "$(complocaledir):$(i18ndir)"
# -Iprograms doesn't really belong here, but this gets it at the head
# of the list instead of the tail, where CPPFLAGS-$(lib) gets added.
# We need it before the standard -I's to see programs/config.h first.
locale-CPPFLAGS = -DCOMPLOCALEDIR='"$(complocaledir)"' \
-DLOCALE_ALIAS_PATH='"$(localedir)"' \
-Iprograms
CPPFLAGS-locale-programs = -DLOCALE_PATH='$(localepath)' \
-DCHARMAP_PATH='"$(i18ndir)/charmaps"' \
-DREPERTOIREMAP_PATH='"$(i18ndir)/repertoiremaps"' \
-DLOCSRCDIR='"$(i18ndir)/locales"'
CFLAGS-charmap.c = -Wno-write-strings -Wno-char-subscripts
CFLAGS-locfile.c = -Wno-write-strings -Wno-char-subscripts
CFLAGS-charmap-dir.c = -Wno-write-strings
# Set libof-* for each routine.
cpp-srcs-left := $(localedef-modules) $(localedef-aux) $(locale-modules) \
$(lib-modules)
lib := locale-programs
include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))