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