1## Makefile for the gettext-tools/src subdirectory of GNU gettext
2## Copyright (C) 1995-1998, 2000-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.5 gnits no-dependencies subdir-objects
20EXTRA_DIST =
21BUILT_SOURCES =
22MOSTLYCLEANFILES = core *.stackdump
23CLEANFILES =
24DISTCLEANFILES =
25MAINTAINERCLEANFILES =
26
27RM = rm -f
28
29bin_PROGRAMS = \
30msgcmp msgfmt msgmerge msgunfmt xgettext \
31msgattrib msgcat msgcomm msgconv msgen msgexec msgfilter msggrep msginit msguniq \
32recode-sr-latin
33
34noinst_PROGRAMS = hostname urlget cldr-plurals
35
36lib_LTLIBRARIES = libgettextsrc.la
37
38noinst_HEADERS = \
39  pos.h message.h po-error.h po-xerror.h po-gram.h po-charset.h \
40  po-lex.h open-catalog.h read-catalog-abstract.h read-catalog.h \
41  read-po.h read-properties.h read-stringtable.h \
42  str-list.h \
43  write-catalog.h write-po.h write-properties.h write-stringtable.h \
44  dir-list.h file-list.h po-gram-gen.h po-gram-gen2.h cldr-plural.h \
45  cldr-plural-exp.h locating-rule.h its.h search-path.h \
46  msgl-charset.h msgl-equal.h msgl-iconv.h msgl-ascii.h msgl-cat.h msgl-header.h \
47  msgl-english.h msgl-check.h msgl-fsearch.h msgfmt.h msgunfmt.h \
48  plural-count.h plural-eval.h plural-distrib.h \
49  read-mo.h write-mo.h \
50  read-java.h write-java.h \
51  read-csharp.h write-csharp.h \
52  read-resources.h write-resources.h \
53  read-tcl.h write-tcl.h \
54  write-qt.h \
55  read-desktop.h write-desktop.h \
56  write-xml.h \
57  po-time.h plural-table.h lang-table.h format.h filters.h \
58  xgettext.h \
59  rc-str-list.h xg-pos.h xg-encoding.h xg-mixed-string.h xg-arglist-context.h \
60  xg-arglist-callshape.h xg-arglist-parser.h xg-message.h \
61  x-po.h x-properties.h x-stringtable.h \
62  x-c.h \
63  x-python.h \
64  x-java.h \
65  x-csharp.h \
66  x-javascript.h \
67  x-scheme.h \
68  x-lisp.h \
69  x-elisp.h \
70  x-librep.h \
71  x-ruby.h \
72  x-sh.h \
73  x-awk.h \
74  x-lua.h \
75  x-smalltalk.h \
76  x-vala.h \
77  x-tcl.h \
78  x-perl.h \
79  x-php.h \
80  x-ycp.h \
81  x-rst.h \
82  x-desktop.h \
83  x-glade.h x-gsettings.h x-appdata.h
84
85EXTRA_DIST += FILES project-id
86
87aliaspath = $(localedir)
88jardir = $(datadir)/gettext
89pkgdatadir = $(datadir)/gettext
90projectsdir = $(pkgdatadir)/projects
91pkglibdir = $(libdir)/gettext
92
93AM_CPPFLAGS = \
94  -I. -I$(srcdir) \
95  -I.. -I$(top_srcdir) \
96  -I$(top_srcdir)/libgrep \
97  -I../gnulib-lib -I$(top_srcdir)/gnulib-lib \
98  -I../intl -I$(top_srcdir)/../gettext-runtime/intl
99DEFS = \
100  -DLOCALEDIR=\"$(localedir)\" -DBISON_LOCALEDIR=\"$(BISON_LOCALEDIR)\" \
101  -DLOCALE_ALIAS_PATH=\"$(aliaspath)\" \
102  -DUSEJAVA=$(USEJAVA) \
103  -DGETTEXTJAR=\"$(jardir)/gettext.jar\" \
104  -DLIBDIR=\"$(libdir)\" \
105  -DGETTEXTDATADIR=\"$(pkgdatadir)\" \
106  -DPROJECTSDIR=\"$(projectsdir)\" \
107  -DEXEEXT=\"@EXEEXT@\" @DEFS@
108# Ensure that <stdint.h> defines SIZE_MAX in C++ mode, like it does in C mode.
109AM_CXXFLAGS = -D__STDC_LIMIT_MACROS
110
111LDADD = ../gnulib-lib/libgettextlib.la $(LTLIBUNISTRING) @LTLIBINTL@ $(WOE32_LDADD)
112OTHERPROGDEPENDENCIES = ../gnulib-lib/libgettextlib.la $(WOE32_LDADD)
113
114SED = sed
115BISON = @TOOLS_BISON@
116YACC = @YACC@ -d
117JAR = @JAR@
118JAVACOMP = $(SHELL) ../javacomp.sh
119CSHARPCOMP = $(SHELL) ../csharpcomp.sh
120CSHARPCOMPFLAGS = @CSHARPCOMPFLAGS@
121
122
123# All programs deal with message lists.
124# All programs must read PO files. (msgunfmt also, for read-java.c,
125# read-csharp.c and read-resources.c.)
126# message.c -> str-list.c.
127# (read-catalog-abstract.c <--> po-gram-gen.y <--> po-lex.c) -> str-list.c.
128# (read-catalog-abstract.c <--> po-gram-gen.y <--> po-lex.c) -> open-catalog.c -> dir-list.c -> str-list.c.
129# (read-catalog-abstract.c <--> po-gram-gen.y <--> po-lex.c) -> po-charset.c.
130# (read-catalog-abstract.c <--> po-gram-gen.y <--> po-lex.c) -> message.c -> str-list.c.
131COMMON_SOURCE = message.c po-error.c po-xerror.c \
132read-catalog-abstract.c po-lex.c po-gram-gen.y po-charset.c \
133read-po.c read-properties.c read-stringtable.c open-catalog.c \
134dir-list.c str-list.c
135
136# xgettext and msgfmt deal with format strings.
137if !WOE32DLL
138FORMAT_SOURCE = format.c
139else
140FORMAT_SOURCE = ../woe32dll/c++format.cc
141endif
142FORMAT_SOURCE += \
143  format-invalid.h \
144  format-c.c format-c-parse.h \
145  format-python.c \
146  format-python-brace.c \
147  format-java.c \
148  format-java-printf.c \
149  format-csharp.c \
150  format-javascript.c \
151  format-scheme.c \
152  format-lisp.c \
153  format-elisp.c \
154  format-librep.c \
155  format-ruby.c \
156  format-sh.c \
157  format-awk.c \
158  format-lua.c \
159  format-pascal.c \
160  format-smalltalk.c \
161  format-qt.c \
162  format-qt-plural.c \
163  format-kde.c \
164  format-kde-kuit.c \
165  format-boost.c \
166  format-tcl.c \
167  format-perl.c \
168  format-perl-brace.c \
169  format-php.c \
170  format-gcc-internal.c \
171  format-gfc-internal.c
172
173# libgettextsrc contains all code that is needed by at least two programs.
174libgettextsrc_la_SOURCES = \
175$(COMMON_SOURCE) read-catalog.c \
176write-catalog.c write-properties.c write-stringtable.c write-po.c \
177msgl-ascii.c msgl-iconv.c msgl-equal.c msgl-cat.c msgl-header.c msgl-english.c \
178msgl-check.c file-list.c msgl-charset.c po-time.c plural-exp.c plural-eval.c \
179plural-table.c quote.h sentence.h sentence.c \
180$(FORMAT_SOURCE) \
181read-desktop.c locating-rule.c its.c search-path.c
182
183# msggrep needs pattern matching.
184LIBGREP = ../libgrep/libgrep.a
185
186# Source dependencies.
187msgcmp_SOURCES = msgcmp.c
188msgcmp_SOURCES += msgl-fsearch.c
189msgfmt_SOURCES = msgfmt.c
190msgfmt_SOURCES += \
191  write-mo.c write-java.c write-csharp.c write-resources.c write-tcl.c \
192  write-qt.c write-desktop.c write-xml.c \
193  ../../gettext-runtime/intl/hash-string.c
194if !WOE32DLL
195msgmerge_SOURCES = msgmerge.c
196else
197msgmerge_SOURCES = ../woe32dll/c++msgmerge.cc
198endif
199msgmerge_SOURCES += msgl-fsearch.c lang-table.c plural-count.c
200msgunfmt_SOURCES = msgunfmt.c
201msgunfmt_SOURCES += \
202  read-mo.c read-java.c read-csharp.c read-resources.c read-tcl.c \
203  ../../gettext-runtime/intl/hash-string.c
204if !WOE32DLL
205xgettext_SOURCES = xgettext.c
206else
207xgettext_SOURCES = ../woe32dll/c++xgettext.cc
208endif
209xgettext_SOURCES += \
210  xg-pos.c \
211  xg-encoding.c \
212  xg-mixed-string.c \
213  xg-arglist-context.c xg-arglist-callshape.c xg-arglist-parser.c \
214  xg-message.c \
215  x-po.c \
216  x-c.c \
217  x-python.c \
218  x-java.c \
219  x-csharp.c \
220  x-javascript.c \
221  x-scheme.c \
222  x-lisp.c \
223  x-elisp.c \
224  x-librep.c \
225  x-ruby.c \
226  x-sh.c ../../gettext-runtime/src/escapes.h \
227  x-awk.c \
228  x-lua.c \
229  x-smalltalk.c \
230  x-vala.c \
231  x-tcl.c \
232  x-perl.c \
233  x-php.c \
234  x-ycp.c \
235  x-rst.c \
236  x-desktop.c
237if !WOE32DLL
238msgattrib_SOURCES = msgattrib.c
239else
240msgattrib_SOURCES = ../woe32dll/c++msgattrib.cc
241endif
242if !WOE32DLL
243msgcat_SOURCES = msgcat.c
244else
245msgcat_SOURCES = ../woe32dll/c++msgcat.cc
246endif
247if !WOE32DLL
248msgcomm_SOURCES = msgcomm.c
249else
250msgcomm_SOURCES = ../woe32dll/c++msgcomm.cc
251endif
252if !WOE32DLL
253msgconv_SOURCES = msgconv.c
254else
255msgconv_SOURCES = ../woe32dll/c++msgconv.cc
256endif
257if !WOE32DLL
258msgen_SOURCES = msgen.c
259else
260msgen_SOURCES = ../woe32dll/c++msgen.cc
261endif
262msgexec_SOURCES = msgexec.c
263if !WOE32DLL
264msgfilter_SOURCES = msgfilter.c
265else
266msgfilter_SOURCES = ../woe32dll/c++msgfilter.cc
267endif
268msgfilter_SOURCES += filter-sr-latin.c
269msgfilter_SOURCES += filter-quote.c
270if !WOE32DLL
271msggrep_SOURCES = msggrep.c
272else
273msggrep_SOURCES = ../woe32dll/c++msggrep.cc
274endif
275msginit_SOURCES = msginit.c
276msginit_SOURCES += lang-table.c plural-count.c
277msginit_SOURCES += ../../gettext-runtime/intl/localealias.c
278# This is needed because on Solaris, localealias.c requires the symbol
279# libintl_thread_in_use which is defined in lock.c. The copy of lock.c inside
280# libintl.so is not sufficient, because libintl.so doesn't export the symbol
281# libintl_thread_in_use.
282msginit_SOURCES += ../../gettext-runtime/intl/lock.c
283if !WOE32DLL
284msguniq_SOURCES = msguniq.c
285else
286msguniq_SOURCES = ../woe32dll/c++msguniq.cc
287endif
288recode_sr_latin_SOURCES = recode-sr-latin.c filter-sr-latin.c
289hostname_SOURCES = hostname.c
290urlget_SOURCES = urlget.c
291cldr_plurals_SOURCES = cldr-plural.y cldr-plural-exp.c cldr-plurals.c
292cldr_plurals_CFLAGS = $(AM_CFLAGS) $(INCXML)
293cldr_plurals_LDADD = libgettextsrc.la $(LDADD)
294
295if USE_INSTALLED_LIBTEXTSTYLE
296LT_LIBTEXTSTYLE = @LTLIBTEXTSTYLE@
297else
298# How to get the include files of libtextstyle.
299textstyle.h textstyle/stdbool.h textstyle/version.h textstyle/woe32dll.h:
300	here=`pwd`; \
301	cd ../../libtextstyle/lib && \
302	  $(MAKE) install-nobase_includeHEADERS install-nobase_nodist_includeHEADERS includedir="$$here"
303BUILT_SOURCES    += textstyle.h textstyle/stdbool.h textstyle/version.h textstyle/woe32dll.h
304MOSTLYCLEANFILES += textstyle.h textstyle/stdbool.h textstyle/version.h textstyle/woe32dll.h
305# Where to find the built libtextstyle library.
306LT_LIBTEXTSTYLE = ../../libtextstyle/lib/libtextstyle.la
307endif
308
309# How to build libgettextsrc.la.
310# Need ../gnulib-lib/libgettextlib.la.
311# Need $(LTLIBUNISTRING) because ulc_width_linebreaks, uc_width, etc. may be
312# taken from libunistring, when the configure option --with-libunistring-prefix
313# was given.
314# Need @LTLIBINTL@ because many source files use gettext().
315# Need @LTLIBICONV@ because po-charset.c, po-lex.c, msgl-iconv.c, write-po.c
316# use iconv().
317libgettextsrc_la_LDFLAGS = \
318  -release @VERSION@ \
319  ../gnulib-lib/libgettextlib.la $(LTLIBUNISTRING) $(LT_LIBTEXTSTYLE) @LTLIBINTL@ @LTLIBICONV@ -lc -no-undefined
320
321# OS/2 does not support a DLL name longer than 8 characters.
322if OS2
323libgettextsrc_la_LDFLAGS += -os2dllname gtsrc
324endif
325
326libgettextsrc_la_CPPFLAGS = $(AM_CPPFLAGS) $(INCXML)
327
328# Tell the mingw or Cygwin linker which symbols to export.
329if WOE32DLL
330libgettextsrc_la_SOURCES += ../woe32dll/gettextsrc-exports.c
331libgettextsrc_la_LDFLAGS += -Wl,--export-all-symbols
332libgettextsrc_la_CPPFLAGS += $(GETTEXTLIB_EXPORTS_FLAGS)
333endif
334
335# Specify installation directory, for --enable-relocatable.
336if RELOCATABLE_VIA_LD
337# This is needed, because libgettextsrc depends on libgettextlib and libintl.
338libgettextsrc_la_LDFLAGS += `$(RELOCATABLE_LDFLAGS) $(libdir)`
339endif
340
341# No need to install libgettextsrc.a, except on AIX.
342install-exec-hook: install-exec-clean
343install-exec-clean:
344	case "@host_os@" in \
345	  aix*) ;; \
346	  *) $(RM) $(DESTDIR)$(libdir)/libgettextsrc.a ;; \
347	esac
348
349# Compile-time flags for particular source files.
350msgmerge_CFLAGS = $(AM_CFLAGS) $(OPENMP_CFLAGS)
351msgmerge_CXXFLAGS = $(AM_CXXFLAGS) $(OPENMP_CFLAGS)
352
353# Link dependencies.
354# INTL_MACOSX_LIBS is needed because the programs depend on libintl.la
355# but libtool doesn't put -Wl,-framework options into .la files.
356# For msginit, it is also needed because of localename.c.
357msgcmp_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ @MSGMERGE_LIBM@ $(WOE32_LDADD)
358msgfmt_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
359msgmerge_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ @MSGMERGE_LIBM@ $(WOE32_LDADD) $(OPENMP_CFLAGS)
360msgunfmt_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
361xgettext_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ @LTLIBICONV@ $(WOE32_LDADD)
362msgattrib_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
363msgcat_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
364msgcomm_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
365msgconv_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
366msgen_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
367msgexec_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
368msgfilter_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
369msggrep_LDADD = $(LIBGREP) libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
370msginit_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
371msguniq_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
372
373# Specify when to relink the programs.
374msgcmp_DEPENDENCIES = libgettextsrc.la ../gnulib-lib/libgettextlib.la $(WOE32_LDADD)
375msgfmt_DEPENDENCIES = libgettextsrc.la ../gnulib-lib/libgettextlib.la $(WOE32_LDADD)
376msgmerge_DEPENDENCIES = libgettextsrc.la ../gnulib-lib/libgettextlib.la $(WOE32_LDADD)
377msgunfmt_DEPENDENCIES = libgettextsrc.la ../gnulib-lib/libgettextlib.la $(WOE32_LDADD)
378xgettext_DEPENDENCIES = libgettextsrc.la ../gnulib-lib/libgettextlib.la $(WOE32_LDADD)
379msgattrib_DEPENDENCIES = libgettextsrc.la ../gnulib-lib/libgettextlib.la $(WOE32_LDADD)
380msgcat_DEPENDENCIES = libgettextsrc.la ../gnulib-lib/libgettextlib.la $(WOE32_LDADD)
381msgcomm_DEPENDENCIES = libgettextsrc.la ../gnulib-lib/libgettextlib.la $(WOE32_LDADD)
382msgconv_DEPENDENCIES = libgettextsrc.la ../gnulib-lib/libgettextlib.la $(WOE32_LDADD)
383msgen_DEPENDENCIES = libgettextsrc.la ../gnulib-lib/libgettextlib.la $(WOE32_LDADD)
384msgexec_DEPENDENCIES = libgettextsrc.la ../gnulib-lib/libgettextlib.la $(WOE32_LDADD)
385msgfilter_DEPENDENCIES = libgettextsrc.la ../gnulib-lib/libgettextlib.la $(WOE32_LDADD)
386msggrep_DEPENDENCIES = $(LIBGREP) libgettextsrc.la ../gnulib-lib/libgettextlib.la $(WOE32_LDADD)
387msginit_DEPENDENCIES = libgettextsrc.la ../gnulib-lib/libgettextlib.la $(WOE32_LDADD)
388msguniq_DEPENDENCIES = libgettextsrc.la ../gnulib-lib/libgettextlib.la $(WOE32_LDADD)
389recode_sr_latin_DEPENDENCIES = $(OTHERPROGDEPENDENCIES)
390hostname_DEPENDENCIES = $(OTHERPROGDEPENDENCIES)
391urlget_DEPENDENCIES = $(OTHERPROGDEPENDENCIES)
392
393# Specify installation directory, for --enable-relocatable.
394msgcmp_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
395msgfmt_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
396msgmerge_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
397msgunfmt_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
398xgettext_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
399msgattrib_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
400msgcat_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
401msgcomm_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
402msgconv_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
403msgen_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
404msgexec_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
405msgfilter_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
406msggrep_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
407msginit_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
408msguniq_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
409recode_sr_latin_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
410hostname_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(pkglibdir)\"
411urlget_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(pkglibdir)\"
412cldr_plurals_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(pkglibdir)\"
413if RELOCATABLE_VIA_LD
414msgcmp_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
415msgfmt_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
416msgmerge_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
417msgunfmt_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
418xgettext_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
419msgattrib_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
420msgcat_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
421msgcomm_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
422msgconv_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
423msgen_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
424msgexec_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
425msgfilter_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
426msggrep_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
427msginit_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
428msguniq_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
429recode_sr_latin_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
430hostname_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(pkglibdir)`
431urlget_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(pkglibdir)`
432cldr_plurals_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(pkglibdir)`
433endif
434
435# Linking with C++ libraries is needed _only_ on mingw and Cygwin.
436if !WOE32DLL
437libgettextsrc_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
438	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
439	$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(libgettextsrc_la_LDFLAGS) $(LDFLAGS) \
440	-o $@
441msgattrib_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
442	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
443	$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(msgattrib_LDFLAGS) $(LDFLAGS) \
444	-o $@
445msgcat_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
446	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
447	$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(msgcat_LDFLAGS) $(LDFLAGS) \
448	-o $@
449msgcomm_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
450	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
451	$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(msgcomm_LDFLAGS) $(LDFLAGS) \
452	-o $@
453msgconv_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
454	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
455	$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(msgconv_LDFLAGS) $(LDFLAGS) \
456	-o $@
457msgen_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
458	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
459	$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(msgen_LDFLAGS) $(LDFLAGS) \
460	-o $@
461msgfilter_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
462	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
463	$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(msgfilter_LDFLAGS) $(LDFLAGS) \
464	-o $@
465msggrep_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
466	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
467	$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(msggrep_LDFLAGS) $(LDFLAGS) \
468	-o $@
469msgmerge_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
470	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
471	$(CCLD) $(msgmerge_CFLAGS) $(CFLAGS) $(msgmerge_LDFLAGS) $(LDFLAGS) \
472	-o $@
473msguniq_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
474	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
475	$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(msguniq_LDFLAGS) $(LDFLAGS) \
476	-o $@
477xgettext_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
478	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
479	$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(xgettext_LDFLAGS) $(LDFLAGS) \
480	-o $@
481else
482libgettextsrc_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
483	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
484	$(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(libgettextsrc_la_LDFLAGS) $(LDFLAGS) \
485	-o $@
486msgattrib_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
487	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
488	$(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(msgattrib_LDFLAGS) $(LDFLAGS) \
489	-o $@
490msgcat_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
491	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
492	$(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(msgcat_LDFLAGS) $(LDFLAGS) \
493	-o $@
494msgcomm_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
495	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
496	$(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(msgcomm_LDFLAGS) $(LDFLAGS) \
497	-o $@
498msgconv_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
499	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
500	$(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(msgconv_LDFLAGS) $(LDFLAGS) \
501	-o $@
502msgen_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
503	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
504	$(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(msgen_LDFLAGS) $(LDFLAGS) \
505	-o $@
506msgfilter_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
507	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
508	$(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(msgfilter_LDFLAGS) $(LDFLAGS) \
509	-o $@
510msggrep_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
511	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
512	$(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(msggrep_LDFLAGS) $(LDFLAGS) \
513	-o $@
514msgmerge_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
515	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
516	$(CXXLD) $(msgmerge_CXXFLAGS) $(CXXFLAGS) $(msgmerge_LDFLAGS) $(LDFLAGS) \
517	-o $@
518msguniq_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
519	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
520	$(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(msguniq_LDFLAGS) $(LDFLAGS) \
521	-o $@
522xgettext_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
523	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
524	$(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(xgettext_LDFLAGS) $(LDFLAGS) \
525	-o $@
526endif
527
528# Special rules for bison and flex generated files.
529
530# The Automake generated .y.c rule is broken: When executed in a VPATH build,
531#   - The .c file gets generated in the build directory. But since it requires
532#     special tools to rebuild it, we need to distribute it in the tarballs,
533#     and by the GNU Coding Standards
534#     <https://www.gnu.org/prep/standards/html_node/Makefile-Basics.html>
535#     the file should be generated in the source directory.
536#   - The #line numbers in the .c file refer to a nonexistent file once it
537#     has been moved from the build directory to the source directory. This
538#     leads to error if 'lcov' is used later.
539# Therefore we override this rule.
540#
541# Also, the ylwrap script is not usable when both a .c and a .h file are to be
542# generated from the .y file. The reason is that this script does nothing in a
543# situation where the .h file is older than the .y file and the .y file is older
544# than the .c file. (This is intentional, see the comment "Do not overwrite
545# unchanged header files to avoid useless recompilations.") The effect is that
546# during "make dist", a tarball is created where the .h file is older than the
547# .y file. This has two negative consequences:
548#   - For a user who builds an unmodified tarball, bison will be invoked.
549#   - During "make distcheck" the rule
550#       FILE.c FILE.h: FILE.y
551#     always fires and, since $(srcdir) is read-only, the commands which update
552#     (or at least touch) $(srcdir)/FILE.c and $(srcdir)/FILE.h fail.
553# Therefore we don't use ylwrap.
554
555po-gram-gen.c po-gram-gen.h: po-gram-gen.y
556	$(AM_V_YACC)$(BISON) -d $(YFLAGS) $(AM_YFLAGS) $(srcdir)/po-gram-gen.y \
557	&& test ':' = '$(BISON)' || { \
558	  sed -e 's|".*/po-gram-gen.y"|"po-gram-gen.y"|' < po-gram-gen.tab.c > po-gram-gen.c-tmp \
559	  && rm -f po-gram-gen.tab.c \
560	  && mv po-gram-gen.c-tmp $(srcdir)/po-gram-gen.c \
561	  && mv po-gram-gen.tab.h $(srcdir)/po-gram-gen.h; \
562	}
563BUILT_SOURCES += po-gram-gen.c po-gram-gen.h
564MOSTLYCLEANFILES += po-gram-gen.tab.c po-gram-gen.tab.h po-gram-gen.c-tmp
565MAINTAINERCLEANFILES += po-gram-gen.c po-gram-gen.h
566EXTRA_DIST += po-gram-gen.c po-gram-gen.h
567
568# po-gram-gen2.h is generated from po-gram-gen.h and is also distributed in the
569# tarballs (just for convenience).
570po-gram-gen2.h: po-gram-gen.h
571	$(SED) -e 's/yy/po_gram_/g' -e 's/extern /extern DLL_VARIABLE /' $(srcdir)/po-gram-gen.h > po-gram-gen2.h-tmp \
572	&& mv po-gram-gen2.h-tmp $(srcdir)/po-gram-gen2.h
573BUILT_SOURCES += po-gram-gen2.h
574MOSTLYCLEANFILES += po-gram-gen2.h-tmp
575MAINTAINERCLEANFILES += po-gram-gen2.h
576EXTRA_DIST += po-gram-gen2.h
577
578po-lex.o po-lex.lo: po-gram-gen2.h
579
580cldr-plural.c cldr-plural.h: cldr-plural.y
581	$(AM_V_YACC)$(BISON) -d $(YFLAGS) $(AM_YFLAGS) $(srcdir)/cldr-plural.y \
582	&& test ':' = '$(BISON)' || { \
583	  sed -e 's|".*/cldr-plural.y"|"cldr-plural.y"|' < cldr-plural.tab.c > cldr-plural.c-tmp \
584	  && rm -f cldr-plural.tab.c \
585	  && mv cldr-plural.c-tmp $(srcdir)/cldr-plural.c \
586	  && mv cldr-plural.tab.h $(srcdir)/cldr-plural.h; \
587	}
588BUILT_SOURCES += cldr-plural.c cldr-plural.h
589MOSTLYCLEANFILES += cldr-plural.tab.c cldr-plural.tab.h cldr-plural.c-tmp
590MAINTAINERCLEANFILES += cldr-plural.c cldr-plural.h
591EXTRA_DIST += cldr-plural.c cldr-plural.h
592
593
594# Special rules for installation of auxiliary programs.
595
596install-exec-local:
597	$(MKDIR_P) $(DESTDIR)$(pkglibdir)
598	$(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) hostname$(EXEEXT) $(DESTDIR)$(pkglibdir)/hostname$(EXEEXT)
599	$(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) urlget$(EXEEXT) $(DESTDIR)$(pkglibdir)/urlget$(EXEEXT)
600	$(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) cldr-plurals$(EXEEXT) $(DESTDIR)$(pkglibdir)/cldr-plurals$(EXEEXT)
601	$(INSTALL_SCRIPT) user-email $(DESTDIR)$(pkglibdir)/user-email
602	$(INSTALL_SCRIPT) $(srcdir)/project-id $(DESTDIR)$(pkglibdir)/project-id
603
604installdirs-local:
605	$(MKDIR_P) $(DESTDIR)$(pkglibdir)
606
607uninstall-local:
608	$(RM) $(DESTDIR)$(pkglibdir)/hostname$(EXEEXT)
609	$(RM) $(DESTDIR)$(pkglibdir)/urlget$(EXEEXT)
610	$(RM) $(DESTDIR)$(pkglibdir)/cldr-plurals$(EXEEXT)
611	$(RM) $(DESTDIR)$(pkglibdir)/user-email
612	$(RM) $(DESTDIR)$(pkglibdir)/project-id
613
614DISTCLEANFILES += user-email
615
616
617# Special rules for Java compilation.
618
619USEJAVA = $(USEJAVA_@BUILDJAVA@)
620USEJAVA_yes = 1
621USEJAVA_no = 0
622
623all-local: all-java-@BUILDJAVA@
624all-java-yes: gettext.jar
625all-java-no:
626
627gnu/gettext/DumpResource.class: $(srcdir)/gnu/gettext/DumpResource.java
628	$(JAVACOMP) -d . $(srcdir)/gnu/gettext/DumpResource.java
629
630gnu/gettext/GetURL.class: $(srcdir)/gnu/gettext/GetURL.java
631	$(JAVACOMP) -d . $(srcdir)/gnu/gettext/GetURL.java
632
633gettext.jar: gnu/gettext/DumpResource.class gnu/gettext/GetURL.class
634	$(JAR) cf $@ gnu/gettext/DumpResource*.class gnu/gettext/GetURL*.class
635
636EXTRA_DIST += gnu/gettext/DumpResource.java gnu/gettext/GetURL.java
637
638CLEANFILES += gettext.jar gnu/gettext/*.class
639
640install-data-local: install-data-java-@BUILDJAVA@
641install-data-java-yes: all-java-yes
642	$(INSTALL_DATA) gettext.jar $(DESTDIR)$(jardir)/gettext.jar
643install-data-java-no:
644
645installdirs-local: installdirs-java-@BUILDJAVA@
646installdirs-java-yes:
647	$(MKDIR_P) $(DESTDIR)$(jardir)
648installdirs-java-no:
649
650uninstall-local: uninstall-java-@BUILDJAVA@
651uninstall-java-yes:
652	$(RM) $(DESTDIR)$(jardir)/gettext.jar
653uninstall-java-no:
654
655
656# Special rules for C# auxiliary programs.
657
658EXTRA_DIST += msgfmt.cs msgunfmt.cs
659
660CLEANFILES += \
661  msgfmt.net.exe msgfmt.net.exe.mdb \
662  msgunfmt.net.exe msgunfmt.net.exe.mdb
663
664all-local: all-csharp-@BUILDCSHARP@
665all-csharp-yes: msgfmt.net.exe msgunfmt.net.exe
666all-csharp-no:
667
668msgfmt.net.exe: msgfmt.cs
669	$(CSHARPCOMP) $(CSHARPCOMPFLAGS) -o $@ $(srcdir)/msgfmt.cs
670
671if USE_INSTALLED_CSHARP_DLL
672CSHARP_DLL_DIR = $(libdir)
673else
674CSHARP_DLL_DIR = ../../gettext-runtime/intl-csharp
675endif
676msgunfmt.net.exe: msgunfmt.cs
677	$(CSHARPCOMP) $(CSHARPCOMPFLAGS) -o $@ -L '$(CSHARP_DLL_DIR)' -l GNU.Gettext $(srcdir)/msgunfmt.cs
678
679install-exec-local: install-exec-csharp-@BUILDCSHARP@
680install-exec-csharp-yes: all-csharp-yes
681	$(MKDIR_P) $(DESTDIR)$(pkglibdir)
682	$(INSTALL_DATA) msgfmt.net.exe $(DESTDIR)$(pkglibdir)/msgfmt.net.exe
683	$(INSTALL_DATA) msgunfmt.net.exe $(DESTDIR)$(pkglibdir)/msgunfmt.net.exe
684install-exec-csharp-no:
685	$(MKDIR_P) $(DESTDIR)$(pkglibdir)
686
687installdirs-local: install-csharp
688installdirs-csharp:
689	$(MKDIR_P) $(DESTDIR)$(pkglibdir)
690
691uninstall-local: uninstall-csharp-@BUILDCSHARP@
692uninstall-csharp-yes: all-csharp-yes
693	$(RM) $(DESTDIR)$(pkglibdir)/msgfmt.net.exe
694	$(RM) $(DESTDIR)$(pkglibdir)/msgunfmt.net.exe
695uninstall-csharp-no:
696
697
698# Special rules for Tcl auxiliary program.
699
700EXTRA_DIST += msgunfmt.tcl
701
702install-data-local: install-tcl
703install-tcl:
704	$(MKDIR_P) $(DESTDIR)$(pkgdatadir)
705	$(INSTALL_DATA) $(srcdir)/msgunfmt.tcl $(DESTDIR)$(pkgdatadir)/msgunfmt.tcl
706
707installdirs-local: installdirs-tcl
708installdirs-tcl:
709	$(MKDIR_P) $(DESTDIR)$(pkgdatadir)
710
711uninstall-local: uninstall-tcl
712uninstall-tcl:
713	$(RM) $(DESTDIR)$(pkgdatadir)/msgunfmt.tcl
714
715
716# Support for relocatability.
717RELOCATABLE_LIBRARY_PATH = $(libdir)
718RELOCATABLE_SRC_DIR = $(top_srcdir)/gnulib-lib
719RELOCATABLE_BUILD_DIR = ../gnulib-lib
720RELOCATABLE_CONFIG_H_DIR = ..
721RELOCATABLE_STRIP = :
722
723
724# Version information according to Woe32 conventions.
725if WOE32
726WOE32_LDADD = gettext.res
727gettext.res : $(top_srcdir)/../windows/gettext.rc
728	$(WINDRES) `$(SHELL) $(top_srcdir)/../windows/windres-options --escape $(VERSION)` -i $(top_srcdir)/../windows/gettext.rc -o gettext.res --output-format=coff
729MOSTLYCLEANFILES += gettext.res
730else
731WOE32_LDADD =
732endif
733
734
735# This Makefile contains rules which don't work with parallel make,
736# namely those which build textstyle.h, po-gram-gen.c, cldr-plural.c.
737# See <https://lists.gnu.org/archive/html/bug-make/2019-05/msg00011.html>.
738# So, turn off parallel execution in this Makefile.
739.NOTPARALLEL:
740