1# Copyright (C) 1991-2022 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# <https://www.gnu.org/licenses/>. 17 18# 19# Makefile for locales. 20# 21subdir := locale 22 23include ../Makeconfig 24 25headers = langinfo.h locale.h bits/locale.h \ 26 bits/types/locale_t.h bits/types/__locale_t.h 27routines = setlocale findlocale loadlocale loadarchive \ 28 localeconv nl_langinfo nl_langinfo_l mb_cur_max \ 29 newlocale duplocale freelocale uselocale 30tests = tst-C-locale tst-locname tst-duplocale 31tests-container = tst-localedef-path-norm 32categories = ctype messages monetary numeric time paper name \ 33 address telephone measurement identification collate 34aux = $(categories:%=lc-%) $(categories:%=C-%) SYS_libc C_name \ 35 xlocale localename global-locale coll-lookup 36others = localedef locale 37#others-static = localedef locale 38install-bin = localedef locale 39extra-objs = $(localedef-modules:=.o) $(localedef-aux:=.o) \ 40 $(locale-modules:=.o) $(lib-modules:=.o) 41generated += C-translit.h 42before-compile += $(objpfx)C-translit.h 43 44extra-libs = libBrokenLocale 45extra-libs-others = $(extra-libs) 46 47libBrokenLocale-routines = broken_cur_max 48 49subdir-dirs = programs 50vpath %.c programs ../crypt 51vpath %.h programs 52vpath %.gperf programs 53 54localedef-modules := localedef $(categories:%=ld-%) \ 55 charmap linereader locfile \ 56 repertoire locarchive 57localedef-aux := md5 58locale-modules := locale locale-spec 59lib-modules := charmap-dir simple-hash xmalloc xstrdup \ 60 record-status xasprintf 61 62 63GPERF = gperf 64GPERFFLAGS = -acCgopt -k1,2,5,9,$$ -L ANSI-C 65 66ifeq ($(run-built-tests),yes) 67tests-special += $(objpfx)tst-locale-locpath.out 68endif 69 70include ../Rules 71 72CFLAGS-md5.c += -I../crypt 73 74programs/%-kw.h: programs/%-kw.gperf 75 cd programs \ 76 && $(GPERF) $(GPERFFLAGS) -N $(@F:-kw.h=_hash) $(<F) > $(@F).new 77 mv -f $@.new $@ 78 79$(objpfx)localedef: $(localedef-modules:%=$(objpfx)%.o) 80$(objpfx)localedef: $(localedef-aux:%=$(objpfx)%.o) 81$(objpfx)locale: $(locale-modules:%=$(objpfx)%.o) 82$(objpfx)localedef $(objpfx)locale: $(lib-modules:%=$(objpfx)%.o) 83 84$(objpfx)C-translit.h: C-translit.h.in gen-translit.py 85 $(make-target-directory) 86 $(PYTHON) gen-translit.py < $< > $@.tmp 87 mv -f $@.tmp $@ 88 89# The path to the compiled binary locale archive or compiled locales, 90# along with the parent path to the source locales and source 91# charmaps. 92localepath = "$(complocaledir):$(i18ndir)" 93 94# -Iprograms doesn't really belong here, but this gets it at the head 95# of the list instead of the tail, where CPPFLAGS-$(lib) gets added. 96# We need it before the standard -I's to see programs/config.h first. 97locale-CPPFLAGS = -DCOMPLOCALEDIR='"$(complocaledir)"' \ 98 -DLOCALE_ALIAS_PATH='"$(localedir)"' \ 99 -Iprograms 100 101CPPFLAGS-locale-programs = -DLOCALE_PATH='$(localepath)' \ 102 -DCHARMAP_PATH='"$(i18ndir)/charmaps"' \ 103 -DREPERTOIREMAP_PATH='"$(i18ndir)/repertoiremaps"' \ 104 -DLOCSRCDIR='"$(i18ndir)/locales"' 105 106CFLAGS-charmap.c += -Wno-write-strings -Wno-char-subscripts 107CFLAGS-locfile.c += -Wno-write-strings -Wno-char-subscripts 108CFLAGS-charmap-dir.c += -Wno-write-strings 109 110# Set libof-* for each routine. 111cpp-srcs-left := $(localedef-modules) $(localedef-aux) $(locale-modules) \ 112 $(lib-modules) 113lib := locale-programs 114include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left)) 115 116$(objpfx)tst-locale-locpath.out : tst-locale-locpath.sh $(objpfx)locale 117 $(SHELL) $< '$(common-objpfx)' '$(test-wrapper-env)' '$(run-program-env)' > $@; \ 118 $(evaluate-test) 119 120$(objpfx)tst-localedef-path-norm: $(shared-thread-library) 121