1## Makefile for the gettext-tools/tests subdirectory of GNU gettext
2## Copyright (C) 1995-1997, 2001-2010, 2012-2016, 2018-2020 Free Software Foundation, Inc.
3##
4## This program is free software: you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 3 of the License, or
7## (at your option) any later version.
8##
9## This program 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
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program.  If not, see <https://www.gnu.org/licenses/>.
16
17## Process this file with automake to produce Makefile.in.
18
19AUTOMAKE_OPTIONS = 1.11 gnits no-dependencies color-tests
20EXTRA_DIST =
21MOSTLYCLEANFILES = core *.stackdump
22
23TESTS = gettext-1 gettext-2 \
24	intl-1 intl-2 intl-3 intl-4 intl-5 intl-6 \
25	intl-setlocale-1 intl-setlocale-2 \
26	intl-thread-1 intl-thread-2 intl-thread-3 \
27	intl-version \
28	msgattrib-1 msgattrib-2 msgattrib-3 msgattrib-4 msgattrib-5 \
29	msgattrib-6 msgattrib-7 msgattrib-8 msgattrib-9 msgattrib-10 \
30	msgattrib-11 msgattrib-12 msgattrib-13 msgattrib-14 msgattrib-15 \
31	msgattrib-16 msgattrib-17 msgattrib-18 msgattrib-19 \
32	msgattrib-properties-1 \
33	msgcat-1 msgcat-2 msgcat-3 msgcat-4 msgcat-5 msgcat-6 msgcat-7 \
34	msgcat-8 msgcat-9 msgcat-10 msgcat-11 msgcat-12 msgcat-13 msgcat-14 \
35	msgcat-15 msgcat-16 msgcat-17 msgcat-18 msgcat-19 msgcat-20 msgcat-21 \
36	msgcat-properties-1 msgcat-properties-2 \
37	msgcat-stringtable-1 \
38	msgcmp-1 msgcmp-2 msgcmp-3 msgcmp-4 \
39	msgcomm-1 msgcomm-2 msgcomm-3 msgcomm-4 msgcomm-5 msgcomm-6 msgcomm-7 \
40	msgcomm-8 msgcomm-9 msgcomm-10 msgcomm-11 msgcomm-12 msgcomm-13 \
41	msgcomm-14 msgcomm-15 msgcomm-16 msgcomm-17 msgcomm-18 msgcomm-19 \
42	msgcomm-20 msgcomm-21 msgcomm-22 msgcomm-23 msgcomm-24 msgcomm-25 \
43	msgcomm-26 msgcomm-27 msgcomm-28 \
44	msgconv-1 msgconv-2 msgconv-3 msgconv-4 msgconv-5 msgconv-6 msgconv-7 \
45	msgen-1 msgen-2 msgen-3 msgen-4 \
46	msgexec-1 msgexec-2 msgexec-3 msgexec-4 msgexec-5 msgexec-6 \
47	msgfilter-1 msgfilter-2 msgfilter-3 msgfilter-4 msgfilter-5 \
48	msgfilter-6 msgfilter-7 msgfilter-8 \
49	msgfilter-sr-latin-1 msgfilter-quote-1 \
50	msgfmt-1 msgfmt-2 msgfmt-3 msgfmt-4 msgfmt-5 msgfmt-6 msgfmt-7 \
51	msgfmt-8 msgfmt-9 msgfmt-10 msgfmt-11 msgfmt-12 msgfmt-13 msgfmt-14 \
52	msgfmt-15 msgfmt-16 msgfmt-17 msgfmt-18 msgfmt-19 \
53	msgfmt-properties-1 \
54	msgfmt-qt-1 msgfmt-qt-2 \
55	msgfmt-desktop-1 msgfmt-desktop-2 msgfmt-desktop-3 \
56	msgfmt-xml-1 msgfmt-xml-2 \
57	msggrep-1 msggrep-2 msggrep-3 msggrep-4 msggrep-5 msggrep-6 msggrep-7 \
58	msggrep-8 msggrep-9 msggrep-10 msggrep-11 \
59	msginit-1 msginit-2 msginit-3 msginit-4 \
60	msgmerge-1 msgmerge-2 msgmerge-3 msgmerge-4 msgmerge-5 msgmerge-6 \
61	msgmerge-7 msgmerge-8 msgmerge-9 msgmerge-10 msgmerge-11 msgmerge-12 \
62	msgmerge-13 msgmerge-14 msgmerge-15 msgmerge-16 msgmerge-17 \
63	msgmerge-18 msgmerge-19 msgmerge-20 msgmerge-21 msgmerge-22 \
64	msgmerge-23 msgmerge-24 msgmerge-25 msgmerge-26 msgmerge-27 \
65	msgmerge-28 msgmerge-29 \
66	msgmerge-compendium-1 msgmerge-compendium-2 msgmerge-compendium-3 \
67	msgmerge-compendium-4 msgmerge-compendium-5 msgmerge-compendium-6 \
68	msgmerge-properties-1 msgmerge-properties-2 \
69	msgmerge-update-1 msgmerge-update-2 msgmerge-update-3 \
70	msgmerge-update-4 \
71	msgunfmt-1 msgunfmt-2 msgunfmt-3 \
72	msgunfmt-csharp-1 \
73	msgunfmt-java-1 \
74	msgunfmt-properties-1 \
75	msgunfmt-tcl-1 \
76	msguniq-1 msguniq-2 msguniq-3 msguniq-4 msguniq-5 msguniq-6 msguniq-7 \
77	recode-sr-latin-1 recode-sr-latin-2 \
78	xgettext-2 xgettext-3 xgettext-4 xgettext-5 xgettext-6 \
79	xgettext-7 xgettext-8 xgettext-9 xgettext-10 xgettext-11 xgettext-12 \
80	xgettext-13 xgettext-14 xgettext-15 \
81	xgettext-appdata-1 \
82	xgettext-awk-1 xgettext-awk-2 \
83	xgettext-c-2 xgettext-c-3 xgettext-c-4 xgettext-c-5 xgettext-c-6 \
84	xgettext-c-comment-1 xgettext-c-comment-2 xgettext-c-comment-3 \
85	xgettext-c-comment-4 xgettext-c-comment-5 xgettext-c-comment-6 \
86	xgettext-c-escape-1 xgettext-c-escape-2 xgettext-c-escape-3 \
87	xgettext-c-format-1 xgettext-c-format-2 xgettext-c-format-3 \
88	xgettext-c-format-4 xgettext-c-format-5 \
89	xgettext-c-ctxt-1 xgettext-c-ctxt-2 xgettext-c-ctxt-3 \
90	xgettext-c-c++-1 xgettext-c-c++-2 \
91	xgettext-csharp-1 xgettext-csharp-2 xgettext-csharp-3 \
92	xgettext-csharp-4 xgettext-csharp-5 xgettext-csharp-6 \
93	xgettext-csharp-7 xgettext-csharp-8 \
94	xgettext-desktop-1 xgettext-desktop-2 \
95	xgettext-elisp-1 xgettext-elisp-2 \
96	xgettext-glade-1 xgettext-glade-2 xgettext-glade-3 xgettext-glade-4 \
97	xgettext-glade-5 xgettext-glade-6 xgettext-glade-7 \
98	xgettext-gsettings-1 \
99	xgettext-its-1 xgettext-its-2 \
100	xgettext-java-1 xgettext-java-2 xgettext-java-3 xgettext-java-4 \
101	xgettext-java-5 xgettext-java-6 xgettext-java-7 \
102	xgettext-javascript-1 xgettext-javascript-2 xgettext-javascript-3 \
103	xgettext-javascript-4 xgettext-javascript-5 xgettext-javascript-6 \
104	xgettext-javascript-7 \
105	xgettext-librep-1 xgettext-librep-2 \
106	xgettext-lisp-1 xgettext-lisp-2 \
107	xgettext-lua-1 xgettext-lua-2 \
108	xgettext-objc-1 xgettext-objc-2 \
109	xgettext-perl-1 xgettext-perl-2 xgettext-perl-3 xgettext-perl-4 \
110	xgettext-perl-5 xgettext-perl-6 xgettext-perl-7 xgettext-perl-8 \
111	xgettext-php-1 xgettext-php-2 xgettext-php-3 xgettext-php-4 \
112	xgettext-po-1 xgettext-po-2 \
113	xgettext-properties-1 xgettext-properties-2 xgettext-properties-3 \
114	xgettext-properties-4 \
115	xgettext-rst-1 xgettext-rst-2 \
116	xgettext-python-1 xgettext-python-2 xgettext-python-3 \
117	xgettext-python-4 \
118	xgettext-ruby-1 \
119	xgettext-scheme-1 xgettext-scheme-2 xgettext-scheme-3 \
120	xgettext-scheme-4 \
121	xgettext-sh-1 xgettext-sh-2 xgettext-sh-3 xgettext-sh-4 xgettext-sh-5 \
122	xgettext-sh-6 xgettext-sh-7 \
123	xgettext-smalltalk-1 xgettext-smalltalk-2 \
124	xgettext-stringtable-1 \
125	xgettext-tcl-1 xgettext-tcl-2 xgettext-tcl-3 xgettext-tcl-4 \
126	xgettext-vala-1 xgettext-vala-2 \
127	xgettext-ycp-1 xgettext-ycp-2 xgettext-ycp-3 xgettext-ycp-4 \
128	format-awk-1 format-awk-2 \
129	format-boost-1 format-boost-2 \
130	format-c-1 format-c-2 format-c-3 format-c-4 format-c-5 \
131	format-csharp-1 format-csharp-2 \
132	format-elisp-1 format-elisp-2 \
133	format-gcc-internal-1 format-gcc-internal-2 \
134	format-gfc-internal-1 format-gfc-internal-2 \
135	format-java-1 format-java-2 \
136	format-java-printf-1 format-java-printf-2 \
137	format-javascript-1 format-javascript-2 \
138	format-kde-1 format-kde-2 \
139	format-kde-kuit-1 format-kde-kuit-2 \
140	format-librep-1 format-librep-2 \
141	format-lisp-1 format-lisp-2 \
142	format-lua-1 format-lua-2 \
143	format-php-1 format-php-2 \
144	format-python-1 format-python-2 \
145	format-python-brace-1 format-python-brace-2 \
146	format-pascal-1 format-pascal-2 \
147	format-perl-1 format-perl-2 \
148	format-perl-brace-1 format-perl-brace-2 \
149	format-perl-mixed-1 format-perl-mixed-2 \
150	format-qt-1 format-qt-2 \
151	format-qt-plural-1 format-qt-plural-2 \
152	format-ruby-1 format-ruby-2 \
153	format-scheme-1 format-scheme-2 \
154	format-sh-1 format-sh-2 \
155	format-tcl-1 format-tcl-2 \
156	format-ycp-1 format-ycp-2 \
157	plural-1 plural-2 \
158	gettextpo-1 sentence-1 \
159	lang-po \
160	lang-c lang-c++ lang-objc \
161	lang-python-1 lang-python-2 \
162	lang-java \
163	lang-csharp \
164	lang-javascript \
165	lang-guile lang-clisp lang-elisp lang-librep \
166	lang-sh lang-bash \
167	lang-gawk \
168	lang-lua \
169	lang-pascal \
170	lang-smalltalk \
171	lang-vala \
172	lang-tcl \
173	lang-perl-1 lang-perl-2 \
174	lang-php \
175	lang-ycp \
176	lang-rst \
177	autopoint-1 autopoint-2 autopoint-3 cldr-plurals-1
178
179EXTRA_DIST += init.sh init.cfg $(TESTS) \
180	test.mo overflow-1.mo overflow-2.mo overflow-3.mo overflow-4.mo \
181	overflow-5.mo overflow-6.mo overflow-7.mo sysdep-without-nul.mo \
182	xg-c-1.ok.po mex-test2.ok \
183	mm-ko.ascii.pot mm-ko.euc-kr.po mm-ko-comp.euc-kr.po \
184	mm-viet.comp.po mm-viet.pot mm-viet.out \
185	msguniq-a.in msguniq-a.inp msguniq-a.out \
186	qttest_pl.po qttest_pl.qm \
187	qttest2_de.po qttest2_de.qm qttest2_de.ts \
188	intl-1.po intl-2-1.po intl-2-2.po intl-4.po \
189	intl-setlocale-1-1.po intl-setlocale-1-2.po intl-setlocale-2.po \
190	intl-thread-1.po intl-thread-2-1.po intl-thread-2-2.po \
191	intl-thread-3.po \
192	gettextpo-1.de.po \
193	xgettext-1 \
194	xgettext-c-1 xg-c-comment-6.c xg-c-escape-3.c xg-vala-2.vala \
195	common/supplemental/plurals.xml
196
197XGETTEXT = ../src/xgettext
198
199# For debugging memory leaks and memory allocation bugs.
200# You should build with --disable-shared when using valgrind.
201CHECKER =
202#CHECKER = valgrind --tool=memcheck --suppressions=$(abs_srcdir)/../gnulib-lib/libunistring.valgrind --num-callers=20 --leak-check=yes --leak-resolution=high --show-reachable=yes
203#CHECKER = valgrind --tool=massif --format=html --depth=10 --alloc-fn=xmalloc --alloc-fn=xrealloc --stacks=no
204
205TESTS_ENVIRONMENT = top_srcdir=$(top_srcdir) \
206		    abs_srcdir=$(abs_srcdir) \
207		    abs_top_srcdir=$(abs_top_srcdir) \
208		    GETTEXT="$(CHECKER) tstgettext" \
209		    NGETTEXT="$(CHECKER) tstngettext" \
210		    XGETTEXT="$(CHECKER) xgettext" \
211		    MSGATTRIB="$(CHECKER) msgattrib" \
212		    MSGCAT="$(CHECKER) msgcat" \
213		    MSGCMP="$(CHECKER) msgcmp" \
214		    MSGCOMM="$(CHECKER) msgcomm" \
215		    MSGCONV="$(CHECKER) msgconv" \
216		    MSGEN="$(CHECKER) msgen" \
217		    MSGEXEC="$(CHECKER) msgexec" \
218		    MSGFILTER="$(CHECKER) msgfilter" \
219		    MSGFMT="$(CHECKER) msgfmt" \
220		    MSGGREP="$(CHECKER) msggrep" \
221		    MSGINIT="$(CHECKER) msginit" \
222		    MSGMERGE="$(CHECKER) msgmerge" \
223		    MSGUNFMT="$(CHECKER) msgunfmt" \
224		    MSGUNIQ="$(CHECKER) msguniq" \
225		    RECODE="$(CHECKER) recode" \
226		    CONFIG_SHELL='$(SHELL)'
227
228# Invoke the shell explicitly, because the execute-permission bit on the scripts
229# may get lost in particular circumstances (e.g. when unpacking a tarball, or
230# under Cygwin).
231# This has the consequence that all tests have to be shell scripts.
232LOG_COMPILER = $(SHELL)
233
234# Update the expected test results.
235update-expected: xg-c-1.ok.po
236xg-c-1.ok.po: $(top_srcdir)/src/xgettext.c $(top_srcdir)/src/msgfmt.c
237	$(XGETTEXT) -d xg-c-1.ok -p $(srcdir) \
238	  -k_ --omit-header --no-location \
239	  $(top_srcdir)/src/xgettext.c $(top_srcdir)/src/msgfmt.c
240
241# Auxiliary programs used by the tests.
242AM_CPPFLAGS = \
243  -I.. \
244  -I../gnulib-lib -I$(top_srcdir)/gnulib-lib \
245  -I../intl
246DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
247# INTL_MACOSX_LIBS is needed because the programs depend on libintl.la
248# but libtool doesn't put -Wl,-framework options into .la files.
249LDADD = $(LDADD_@USE_INCLUDED_LIBINTL@) @INTL_MACOSX_LIBS@
250LDADD_yes = ../intl/libintl.la @LTLIBTHREAD@
251LDADD_no = ../intl/libgnuintl.la @LTLIBTHREAD@ @LTLIBINTL@
252check_PROGRAMS = tstgettext tstngettext testlocale intl-1-prg intl-3-prg intl-4-prg intl-5-prg intl-6-prg intl-setlocale-1-prg intl-setlocale-2-prg intl-thread-1-prg intl-thread-2-prg intl-thread-3-prg intl-version-prg cake fc3 fc4 fc5 gettextpo-1-prg sentence-1-prg
253tstgettext_SOURCES = \
254  tstgettext.c ../../gettext-runtime/src/escapes.h \
255  setlocale.c
256tstgettext_CFLAGS = -DINSTALLDIR=\".\"
257tstgettext_LDADD = ../gnulib-lib/libgettextlib.la $(LDADD)
258tstngettext_SOURCES = tstngettext.c setlocale.c
259tstngettext_CFLAGS = -DINSTALLDIR=\".\"
260tstngettext_LDADD = ../gnulib-lib/libgettextlib.la $(LDADD)
261testlocale_SOURCES = testlocale.c
262intl_1_prg_SOURCES = intl-1-prg.c
263intl_1_prg_LDADD = ../gnulib-lib/libgettextlib.la $(LDADD)
264intl_3_prg_SOURCES = intl-3-prg.c
265intl_3_prg_LDADD = ../gnulib-lib/libgettextlib.la $(LDADD)
266intl_4_prg_SOURCES = intl-4-prg.c
267intl_4_prg_LDADD = ../gnulib-lib/libgettextlib.la $(LDADD)
268intl_5_prg_SOURCES = intl-5-prg.c
269intl_5_prg_LDADD = ../gnulib-lib/libgettextlib.la $(LDADD)
270intl_6_prg_SOURCES = intl-6-prg.c
271intl_6_prg_LDADD = ../gnulib-lib/libgettextlib.la $(LDADD)
272intl_setlocale_1_prg_SOURCES = intl-setlocale-1-prg.c
273intl_setlocale_1_prg_LDADD = ../gnulib-lib/libgettextlib.la $(LDADD)
274intl_setlocale_2_prg_SOURCES = intl-setlocale-2-prg.c
275intl_setlocale_2_prg_LDADD = ../gnulib-lib/libgettextlib.la $(LDADD)
276intl_thread_1_prg_SOURCES = intl-thread-1-prg.c
277intl_thread_1_prg_CFLAGS = $(intl_thread_1_prg_CFLAGS_@HAVE_NEWLOCALE@)
278intl_thread_1_prg_CFLAGS_1 = -DUSE_POSIX_THREADS
279intl_thread_1_prg_LDADD = ../gnulib-lib/libgettextlib.la $(LDADD) $(intl_thread_1_prg_LDADD_@HAVE_NEWLOCALE@)
280intl_thread_1_prg_LDADD_1 = -lpthread
281intl_thread_2_prg_SOURCES = intl-thread-2-prg.c
282intl_thread_2_prg_CFLAGS = $(intl_thread_2_prg_CFLAGS_@HAVE_NEWLOCALE@)
283intl_thread_2_prg_CFLAGS_1 = -DUSE_POSIX_THREADS
284intl_thread_2_prg_LDADD = ../gnulib-lib/libgettextlib.la $(LDADD) $(intl_thread_2_prg_LDADD_@HAVE_NEWLOCALE@)
285intl_thread_2_prg_LDADD_1 = -lpthread
286intl_thread_3_prg_SOURCES = intl-thread-3-prg.c
287intl_thread_3_prg_CFLAGS = $(intl_thread_3_prg_CFLAGS_@HAVE_NEWLOCALE@)
288intl_thread_3_prg_CFLAGS_1 = -DUSE_POSIX_THREADS
289intl_thread_3_prg_LDADD = ../gnulib-lib/libgettextlib.la $(LDADD) $(intl_thread_3_prg_LDADD_@HAVE_NEWLOCALE@)
290intl_thread_3_prg_LDADD_1 = -lpthread
291intl_version_prg_SOURCES = intl-version-prg.c
292intl_version_prg_LDADD = ../gnulib-lib/libgettextlib.la $(LDADD)
293cake_SOURCES = plural-1-prg.c setlocale.c
294cake_LDADD = ../gnulib-lib/libgettextlib.la $(LDADD)
295fc3_SOURCES = format-c-3-prg.c setlocale.c
296fc3_LDADD = ../gnulib-lib/libgettextlib.la $(LDADD)
297fc4_SOURCES = format-c-4-prg.c setlocale.c
298fc4_LDADD = ../gnulib-lib/libgettextlib.la $(LDADD)
299fc5_SOURCES = format-c-5-prg.c
300fc5_LDADD = ../gnulib-lib/libgettextlib.la $(LDADD)
301gettextpo_1_prg_SOURCES = gettextpo-1-prg.c
302# Don't add 'gnulib-lib' to the include path here.  Some header files
303# there may interfere with the ones in 'libgettextpo'.
304gettextpo_1_prg_CPPFLAGS = \
305  -I.. \
306  -I../libgettextpo -I$(top_srcdir)/libgettextpo \
307  -I../intl
308# Don't add more libraries here. This test must check whether libgettextpo is
309# self contained.
310gettextpo_1_prg_LDADD = ../libgettextpo/libgettextpo.la $(LDADD)
311sentence_1_prg_SOURCES = sentence-1-prg.c
312sentence_1_prg_CPPFLAGS = $(AM_CPPFLAGS) -I../src -I$(top_srcdir)/src
313sentence_1_prg_LDADD = ../src/libgettextsrc.la $(LDADD)
314
315# Clean up after Solaris cc.
316clean-local:
317	rm -rf SunWS_cache
318