sh: Fix static build with --enable-fortify
[glibc.git] / intl / Makefile
blob9b79198e685d6ef04bf4a8a4fcde3d59724e226a
1 # Copyright (C) 1995-2024 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 # <https://www.gnu.org/licenses/>.
18 # Makefile for intl subdirectory: message handling code from GNU gettext.
20 subdir = intl
22 include ../Makeconfig
24 headers = libintl.h
25 routines = bindtextdom dcgettext dgettext gettext \
26 dcigettext dcngettext dngettext ngettext \
27 finddomain loadmsgcat localealias textdomain
28 aux = l10nflist explodename plural plural-exp hash-string
30 multithread-test-srcs := tst-gettext4 tst-gettext5 tst-gettext6
31 test-srcs := tst-gettext tst-translit tst-gettext2 tst-codeset tst-gettext3
32 ifeq ($(have-thread-library),yes)
33 test-srcs += $(multithread-test-srcs)
34 endif
35 tests = \
36 tst-gettext-c-utf8 \
37 tst-ngettext \
38 # tests
40 before-compile += $(objpfx)msgs.h
42 install-others = $(inst_localedir)/locale.alias
44 generated += msgs.h mtrace-tst-gettext.out tst-gettext.mtrace plural.c
45 generated-dirs += domaindir localedir
47 $(objpfx)plural.c: plural.y
48 $(make-target-directory)
49 $(BISON) $(BISONFLAGS) $@ $^
51 $(objpfx)plural.o: $(objpfx)plural.c
53 ifeq ($(run-built-tests),yes)
54 ifeq (yes,$(build-shared))
55 ifneq ($(strip $(MSGFMT)),:)
56 tests-special += $(objpfx)tst-translit.out $(objpfx)tst-gettext.out \
57 $(objpfx)tst-gettext2.out $(objpfx)tst-codeset.out \
58 $(objpfx)tst-gettext3.out
59 ifeq ($(have-thread-library),yes)
60 tests-special += $(objpfx)tst-gettext4.out $(objpfx)tst-gettext5.out \
61 $(objpfx)tst-gettext6.out
62 endif
63 ifneq (no,$(PERL))
64 tests-special += $(objpfx)mtrace-tst-gettext.out
65 endif
66 endif
67 endif
68 endif
70 include ../Rules
72 ifeq ($(run-built-tests),yes)
73 ifeq (yes,$(build-shared))
74 # Multiple tests use this data. Create it once to avoid racing and
75 # spurious test failures.
76 codeset_mo = $(objpfx)domaindir/de_DE/LC_MESSAGES/codeset.mo
78 $(codeset_mo): tstcodeset.po
79 $(make-target-directory)
80 msgfmt -o $@T $<
81 mv -f $@T $@
83 $(objpfx)mtrace-tst-gettext.out: $(objpfx)tst-gettext.out
84 $(common-objpfx)malloc/mtrace $(objpfx)tst-gettext.mtrace > $@; \
85 $(evaluate-test)
86 $(objpfx)tst-gettext.out: tst-gettext.sh $(objpfx)tst-gettext
87 $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
88 '$(run-program-env)' '$(test-program-prefix-after-env)' \
89 $(common-objpfx)intl/ $(objpfx)tst-gettext.mtrace; \
90 $(evaluate-test)
91 $(objpfx)tst-translit.out: tst-translit.sh $(objpfx)tst-translit
92 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' \
93 $(common-objpfx)intl/; \
94 $(evaluate-test)
95 $(objpfx)tst-gettext2.out: tst-gettext2.sh $(objpfx)tst-gettext2
96 $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
97 '$(run-program-env)' '$(test-program-prefix-after-env)' \
98 $(common-objpfx)intl/; \
99 $(evaluate-test)
100 $(objpfx)tst-gettext4.out: tst-gettext4.sh $(objpfx)tst-gettext4
101 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' $(common-objpfx)intl/; \
102 $(evaluate-test)
103 $(objpfx)tst-gettext6.out: tst-gettext6.sh $(objpfx)tst-gettext6
104 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' $(common-objpfx)intl/; \
105 $(evaluate-test)
107 $(objpfx)tst-codeset.out: $(codeset_mo)
108 $(objpfx)tst-gettext3.out: $(codeset_mo)
109 $(objpfx)tst-gettext5.out: $(codeset_mo)
110 endif
112 LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ANSI_X3.4-1968 fr_FR.ISO-8859-1 \
113 ja_JP.UTF-8
114 include ../gen-locales.mk
116 $(objpfx)tst-codeset.out: $(gen-locales)
117 $(objpfx)tst-gettext.out: $(gen-locales)
118 $(objpfx)tst-gettext2.out: $(gen-locales)
119 $(objpfx)tst-gettext3.out: $(gen-locales)
120 $(objpfx)tst-gettext4.out: $(gen-locales)
121 $(objpfx)tst-gettext5.out: $(gen-locales)
122 $(objpfx)tst-gettext6.out: $(gen-locales)
123 $(objpfx)tst-gettext-c-utf8.out: $(gen-locales)
124 $(objpfx)tst-translit.out: $(gen-locales)
125 endif
127 $(objpfx)tst-gettext-de.po: ../po/de.po
128 $(make-target-directory)
129 LC_ALL=C $(AWK) '!/^"POT-Creation-Date: [0-9-]+ [0-9:+-]+\\n"$$/' $^ > $@
131 $(objpfx)msgs.h: po2test.awk $(objpfx)tst-gettext-de.po
132 $(make-target-directory)
133 LC_ALL=C $(AWK) -f $^ > $@
135 CFLAGS-tst-gettext.c += -DTESTSTRS_H=\"$(objpfx)msgs.h\"
136 CFLAGS-tst-translit.c += -DOBJPFX=\"$(objpfx)\"
137 CFLAGS-tst-gettext2.c += -DOBJPFX=\"$(objpfx)\"
138 CFLAGS-tst-codeset.c += -DOBJPFX=\"$(objpfx)\"
139 CFLAGS-tst-gettext3.c += -DOBJPFX=\"$(objpfx)\"
140 CFLAGS-tst-gettext4.c += -DOBJPFX=\"$(objpfx)\"
141 CFLAGS-tst-gettext5.c += -DOBJPFX=\"$(objpfx)\"
142 CFLAGS-tst-gettext6.c += -DOBJPFX=\"$(objpfx)\"
144 ifeq ($(have-thread-library),yes)
145 ifeq (yes,$(build-shared))
146 $(addprefix $(objpfx),$(multithread-test-srcs)): $(shared-thread-library)
147 else
148 $(addprefix $(objpfx),$(multithread-test-srcs)): $(static-thread-library)
149 endif
150 endif
152 $(objpfx)tst-translit.out: $(objpfx)tst-gettext.out
153 $(objpfx)tst-gettext2.out: $(objpfx)tst-gettext.out
154 $(objpfx)tst-codeset.out: $(objpfx)tst-gettext.out
155 $(objpfx)tst-gettext3.out: $(objpfx)tst-gettext.out
156 $(objpfx)tst-gettext4.out: $(objpfx)tst-gettext.out
157 $(objpfx)tst-gettext5.out: $(objpfx)tst-gettext.out
158 $(objpfx)tst-gettext6.out: $(objpfx)tst-gettext.out
160 CPPFLAGS += -D'LOCALEDIR="$(localedir)"' \
161 -D'LOCALE_ALIAS_PATH="$(localedir)"' \
162 -Wno-unused-but-set-variable
163 BISONFLAGS = --yacc --no-lines --name-prefix=__gettext --output
165 $(inst_localedir)/locale.alias: locale.alias $(+force)
166 $(do-install)