GLIBC-SA-2024-0004: add commit for 2.31 branch
[glibc.git] / gen-locales.mk
blobb005a7286622e4db27c93a9d26fa647757027c40
1 # defines target $(gen-locales) that generates the locales given in $(LOCALES)
3 LOCALE_SRCS := $(shell echo "$(LOCALES)"|sed 's/\([^ .]*\)[^@ ]*\(@[^ ]*\)\?/\1\2/g')
4 # The CHARMAPS dependency handling must be able to process:
5 # 1. No character map e.g. eo, en_US
6 # 2. Character maps e.g. en_US.UTF-8
7 # 3. Character maps with modifier e.g. tt_RU.UTF-8@iqtelif
8 # This complicates the processing slightly so we do it in multiple edits,
9 # the first captures the character map with the anchoring period while
10 # the rest of the edits remove the period to get a valid file or adjust
11 # the name to match the true name.
12 CHARMAPS := $(shell echo "$(LOCALES)" | \
13 sed -e 's/\([^ .]*\)\([^@ ]*\)\(@[^@ ]*\)*/\2/g' \
14 -e 's/^\./ /g' \
15 -e 's/ \./ /g' \
16 -e s/SJIS/SHIFT_JIS/g)
17 CTYPE_FILES = $(addsuffix /LC_CTYPE,$(LOCALES))
18 gen-locales := $(addprefix $(common-objpfx)localedata/,$(CTYPE_FILES))
20 # Dependency for the locale files. We actually make it depend only on
21 # one of the files.
22 $(addprefix $(common-objpfx)localedata/,$(CTYPE_FILES)): %: \
23 ../localedata/gen-locale.sh \
24 $(common-objpfx)locale/localedef \
25 ../localedata/Makefile \
26 $(addprefix ../localedata/charmaps/,$(CHARMAPS)) \
27 $(addprefix ../localedata/locales/,$(LOCALE_SRCS))
28 @$(SHELL) ../localedata/gen-locale.sh $(common-objpfx) \
29 '$(built-program-cmd-before-env)' '$(run-program-env)' \
30 '$(built-program-cmd-after-env)' $@; \
31 $(evaluate-test)