1 # Copyright (C) 1995-2023 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.
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
)
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
64 tests-special
+= $(objpfx
)mtrace-tst-gettext.out
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
)
83 $(objpfx
)mtrace-tst-gettext.out
: $(objpfx
)tst-gettext.out
84 $(common-objpfx
)malloc
/mtrace
$(objpfx
)tst-gettext.mtrace
> $@
; \
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
; \
91 $(objpfx
)tst-translit.out
: tst-translit.sh
$(objpfx
)tst-translit
92 $(SHELL
) $< $(common-objpfx
) '$(test-program-prefix)' \
93 $(common-objpfx
)intl
/; \
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
/; \
100 $(objpfx
)tst-gettext4.out
: tst-gettext4.sh
$(objpfx
)tst-gettext4
101 $(SHELL
) $< $(common-objpfx
) '$(test-program-prefix)' $(common-objpfx
)intl
/; \
103 $(objpfx
)tst-gettext6.out
: tst-gettext6.sh
$(objpfx
)tst-gettext6
104 $(SHELL
) $< $(common-objpfx
) '$(test-program-prefix)' $(common-objpfx
)intl
/; \
107 $(objpfx
)tst-codeset.out
: $(codeset_mo
)
108 $(objpfx
)tst-gettext3.out
: $(codeset_mo
)
109 $(objpfx
)tst-gettext5.out
: $(codeset_mo
)
112 LOCALES
:= de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ANSI_X3.4
-1968 fr_FR.ISO-8859-1 \
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
)
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
)
148 $(addprefix $(objpfx
),$(multithread-test-srcs
)): $(static-thread-library
)
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)