1## Makefile for the gettext-tools/src subdirectory of GNU gettext
2## Copyright (C) 1995-1998, 2000-2005 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 2, or (at your option)
7## 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, write to the Free Software
16## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18## Process this file with automake to produce Makefile.in.
19
20AUTOMAKE_OPTIONS = 1.5 gnits no-dependencies
21EXTRA_DIST =
22CLEANFILES =
23DISTCLEANFILES =
24
25RM = rm -f
26
27bin_PROGRAMS = \
28msgcmp msgfmt msgmerge msgunfmt xgettext \
29msgattrib msgcat msgcomm msgconv msgen msgexec msgfilter msggrep msginit msguniq
30
31noinst_PROGRAMS = hostname urlget
32
33lib_LTLIBRARIES = libgettextsrc.la libgettextpo.la
34
35include_HEADERS = gettext-po.h
36
37noinst_HEADERS = pos.h message.h po-error.h po-gram.h po-charset.h \
38po-lex.h open-po.h \
39read-po-abstract.h read-po.h read-properties.h read-stringtable.h \
40str-list.h \
41write-po.h write-properties.h write-stringtable.h \
42dir-list.h file-list.h po-gram-gen.h po-gram-gen2.h \
43msgl-charset.h msgl-equal.h msgl-iconv.h msgl-ascii.h msgl-cat.h \
44msgl-english.h msgfmt.h msgunfmt.h plural-count.h \
45read-mo.h write-mo.h \
46read-java.h write-java.h \
47read-csharp.h write-csharp.h \
48read-resources.h write-resources.h \
49read-tcl.h write-tcl.h \
50write-qt.h \
51po-time.h plural-table.h format.h \
52xgettext.h x-c.h x-po.h x-sh.h x-python.h x-lisp.h x-elisp.h x-librep.h \
53x-scheme.h x-smalltalk.h x-java.h x-properties.h x-csharp.h x-awk.h x-ycp.h \
54x-tcl.h x-perl.h x-php.h x-stringtable.h x-rst.h x-glade.h
55
56EXTRA_DIST += FILES project-id ChangeLog.0
57
58localedir = $(datadir)/locale
59aliaspath = $(localedir)
60jardir = $(datadir)/gettext
61pkgdatadir = $(datadir)/gettext
62projectsdir = $(pkgdatadir)/projects
63pkglibdir = $(libdir)/gettext
64
65AM_CPPFLAGS = \
66  -I. -I$(srcdir) \
67  -I.. \
68  -I$(top_srcdir)/libgrep \
69  -I$(top_srcdir)/libuniname \
70  -I../lib -I$(top_srcdir)/lib \
71  -I../intl -I$(top_srcdir)/../gettext-runtime/intl
72DEFS = \
73  -DLOCALEDIR=\"$(localedir)\" \
74  -DLOCALE_ALIAS_PATH=\"$(aliaspath)\" \
75  -DUSEJEXE=$(USEJEXE) \
76  -DGETTEXTJEXEDIR=\"$(pkglibdir)\" \
77  -DGETTEXTJAR=\"$(jardir)/gettext.jar\" \
78  -DLIBDIR=\"$(libdir)\" \
79  -DGETTEXTDATADIR=\"$(pkgdatadir)\" \
80  -DPROJECTSDIR=\"$(projectsdir)\" @DEFS@
81LDADD = ../lib/libgettextlib.la @LTLIBINTL@
82
83SED = sed
84YACC = @YACC@ -d
85GCJ = @GCJ@
86GCJFLAGS = @GCJFLAGS@
87JAR = @JAR@
88JAVACOMP = $(SHELL) ../lib/javacomp.sh
89CSHARPCOMP = $(SHELL) ../lib/csharpcomp.sh
90CSHARPCOMPFLAGS = -O -g
91
92
93# All programs deal with message lists.
94# All programs must read PO files. (msgunfmt also, for read-java.c,
95# read-csharp.c and read-resources.c.)
96# message.c -> str-list.c.
97# (read-po-abstract.c <--> po-gram-gen.y <--> po-lex.c) -> str-list.c.
98# (read-po-abstract.c <--> po-gram-gen.y <--> po-lex.c) -> open-po.c -> dir-list.c -> str-list.c.
99# (read-po-abstract.c <--> po-gram-gen.y <--> po-lex.c) -> po-charset.c.
100# (read-po-abstract.c <--> po-gram-gen.y <--> po-lex.c) -> message.c -> str-list.c.
101COMMON_SOURCE = message.c po-error.c \
102read-po-abstract.c po-lex.c po-gram-gen.y po-charset.c \
103read-properties.c read-stringtable.c open-po.c dir-list.c str-list.c
104
105# xgettext and msgfmt deal with format strings.
106FORMAT_SOURCE = format.c format-invalid.h \
107format-c.c format-sh.c format-python.c format-lisp.c format-elisp.c \
108format-librep.c format-scheme.c format-java.c format-csharp.c format-awk.c \
109format-pascal.c format-ycp.c format-tcl.c format-perl.c format-perl-brace.c \
110format-php.c format-gcc-internal.c format-qt.c
111
112# libgettextsrc contains all code that is needed by at least two programs.
113libgettextsrc_la_SOURCES = \
114$(COMMON_SOURCE) read-po.c write-properties.c write-stringtable.c write-po.c \
115msgl-ascii.c msgl-iconv.c msgl-equal.c msgl-cat.c msgl-english.c file-list.c \
116msgl-charset.c po-time.c plural.c plural-table.c $(FORMAT_SOURCE)
117
118# libgettextpo contains the public API for PO files.
119libgettextpo_la_SOURCES = gettext-po.c
120# Libtool's library version information for libgettextpo.
121# See the libtool documentation, section "Library interface versions".
122LTV_CURRENT=1
123LTV_REVISION=0
124LTV_AGE=1
125
126# msggrep needs pattern matching.
127LIBGREP = ../libgrep/libgrep.a
128
129# x-python needs table of Unicode character names.
130LIBUNINAME = ../libuniname/libuniname.a
131
132# Source dependencies.
133msgcmp_SOURCES = msgcmp.c
134msgfmt_SOURCES = msgfmt.c \
135  write-mo.c write-java.c write-csharp.c write-resources.c write-tcl.c \
136  write-qt.c plural-eval.c
137msgmerge_SOURCES = msgmerge.c plural-count.c
138msgunfmt_SOURCES = msgunfmt.c \
139  read-mo.c read-java.c read-csharp.c read-resources.c read-tcl.c
140xgettext_SOURCES = xgettext.c \
141  x-c.c x-po.c x-sh.c x-python.c x-lisp.c x-elisp.c x-librep.c x-scheme.c \
142  x-smalltalk.c x-java.c x-csharp.c x-awk.c x-ycp.c x-tcl.c x-perl.c x-php.c \
143  x-rst.c x-glade.c
144msgattrib_SOURCES = msgattrib.c
145msgcat_SOURCES = msgcat.c
146msgcomm_SOURCES = msgcomm.c
147msgconv_SOURCES = msgconv.c
148msgen_SOURCES = msgen.c
149msgexec_SOURCES = msgexec.c
150msgfilter_SOURCES = msgfilter.c
151msggrep_SOURCES = msggrep.c
152msginit_SOURCES = msginit.c plural-count.c ../../gettext-runtime/intl/localealias.c
153msguniq_SOURCES = msguniq.c
154hostname_SOURCES = hostname.c
155urlget_SOURCES = urlget.c
156
157# How to build libgettextsrc.la.
158# Need ../lib/libgettextlib.la.
159# Need @LTLIBINTL@ because many source files use gettext().
160# Need @LTLIBICONV@ because po-charset.c, po-lex.c, msgl-iconv.c, write-po.c
161# use iconv().
162libgettextsrc_la_LDFLAGS = \
163  -release @VERSION@ \
164  ../lib/libgettextlib.la @LTLIBINTL@ @LTLIBICONV@ -lc -no-undefined
165
166# No need to install libgettextsrc.a, except on AIX.
167install-exec-local: install-libLTLIBRARIES install-exec-clean
168install-exec-clean:
169	case "@host_os@" in \
170	  aix*) ;; \
171	  *) $(RM) $(DESTDIR)$(libdir)/libgettextsrc.a ;; \
172	esac
173
174# How to build libgettextpo.la.
175# Need libgettextsrc.la.
176# Need ../lib/libgettextlib.la because of xmalloc.
177libgettextpo_la_LDFLAGS = \
178  -version-info $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE) \
179  -rpath $(libdir) \
180  libgettextsrc.la ../lib/libgettextlib.la @LTLIBINTL@ @LTLIBICONV@ -lc -no-undefined
181# Build order. Only needed for "make -j[N]".
182libgettextpo_la_DEPENDENCIES = libgettextsrc.la
183
184# Link dependencies.
185# INTL_MACOSX_LIBS is needed because the programs depend on libintl.la
186# but libtool doesn't put -Wl,-framework options into .la files.
187# For msginit, it is also needed because of localename.c.
188msgcmp_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@
189msgfmt_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@
190msgmerge_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@
191msgunfmt_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@
192xgettext_LDADD = $(LIBUNINAME) libgettextsrc.la @INTL_MACOSX_LIBS@ @LTLIBEXPAT@
193msgattrib_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@
194msgcat_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@
195msgcomm_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@
196msgconv_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@
197msgen_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@
198msgexec_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@
199msgfilter_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@
200msggrep_LDADD = $(LIBGREP) libgettextsrc.la @INTL_MACOSX_LIBS@
201msginit_LDADD = ../intl/localename.@INTL_LIBTOOL_SUFFIX_PREFIX@o \
202                libgettextsrc.la @INTL_MACOSX_LIBS@
203msguniq_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@
204
205# Specify installation directory, for --enable-relocatable.
206msgcmp_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
207msgfmt_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
208msgmerge_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
209msgunfmt_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
210xgettext_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
211msgattrib_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
212msgcat_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
213msgcomm_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
214msgconv_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
215msgen_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
216msgexec_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
217msgfilter_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
218msggrep_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
219msginit_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
220msguniq_CFLAGS = -DINSTALLDIR=\"$(bindir)\"
221hostname_CFLAGS = -DINSTALLDIR=\"$(pkglibdir)\"
222urlget_CFLAGS = -DINSTALLDIR=\"$(pkglibdir)\"
223if RELOCATABLE_VIA_LD
224msgcmp_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
225msgfmt_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
226msgmerge_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
227msgunfmt_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
228xgettext_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
229msgattrib_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
230msgcat_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
231msgcomm_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
232msgconv_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
233msgen_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
234msgexec_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
235msgfilter_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
236msggrep_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
237msginit_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
238msguniq_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
239hostname_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(pkglibdir)`
240urlget_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(pkglibdir)`
241endif
242
243# Special rules for bison and flex generated files.
244
245BUILT_SOURCES = \
246  po-gram-gen.c po-gram-gen.h po-gram-gen2.h
247
248po-lex.o po-lex.lo: po-gram-gen2.h
249po-gram-gen2.h: po-gram-gen.h
250	$(SED) -e 's/yy/po_gram_/g' -e 's/extern /extern DLL_VARIABLE /' $(srcdir)/po-gram-gen.h > $@-tmp
251	mv $@-tmp $@
252
253
254# Special rules for installation of auxiliary programs.
255
256install-exec-local:
257	$(mkinstalldirs) $(DESTDIR)$(pkglibdir)
258	$(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) hostname$(EXEEXT) $(DESTDIR)$(pkglibdir)/hostname$(EXEEXT)
259	$(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) urlget$(EXEEXT) $(DESTDIR)$(pkglibdir)/urlget$(EXEEXT)
260	$(INSTALL_SCRIPT) user-email $(DESTDIR)$(pkglibdir)/user-email
261	$(INSTALL_SCRIPT) $(srcdir)/project-id $(DESTDIR)$(pkglibdir)/project-id
262
263installdirs-local:
264	$(mkinstalldirs) $(DESTDIR)$(pkglibdir)
265
266uninstall-local:
267	$(RM) $(DESTDIR)$(pkglibdir)/hostname$(EXEEXT)
268	$(RM) $(DESTDIR)$(pkglibdir)/urlget$(EXEEXT)
269	$(RM) $(DESTDIR)$(pkglibdir)/user-email
270	$(RM) $(DESTDIR)$(pkglibdir)/project-id
271
272DISTCLEANFILES += user-email
273
274
275# Special rules for Java compilation.
276
277USEJEXE = $(USEJEXE_@BUILDJAVAEXE@)
278USEJEXE_yes = 1
279USEJEXE_no = 0
280
281all-local: all-java-@BUILDJAVAEXE@
282all-java-yes: gnu.gettext.DumpResource$(EXEEXT) gnu.gettext.GetURL$(EXEEXT)
283all-java-no: all-java-no-@BUILDJAVA@
284all-java-no-yes: gettext.jar
285all-java-no-no:
286
287gnu.gettext.DumpResource$(EXEEXT): $(srcdir)/gnu/gettext/DumpResource.java
288	$(GCJ) $(GCJFLAGS) $(srcdir)/gnu/gettext/DumpResource.java --main=gnu.gettext.DumpResource -o $@
289
290gnu.gettext.GetURL$(EXEEXT): $(srcdir)/gnu/gettext/GetURL.java
291	$(GCJ) $(GCJFLAGS) $(srcdir)/gnu/gettext/GetURL.java --main=gnu.gettext.GetURL -o $@
292
293gnu/gettext/DumpResource.class: $(srcdir)/gnu/gettext/DumpResource.java
294	$(JAVACOMP) -d . $(srcdir)/gnu/gettext/DumpResource.java
295
296gnu/gettext/GetURL.class: $(srcdir)/gnu/gettext/GetURL.java
297	$(JAVACOMP) -d . $(srcdir)/gnu/gettext/GetURL.java
298
299gettext.jar: gnu/gettext/DumpResource.class gnu/gettext/GetURL.class
300	$(JAR) cf $@ gnu/gettext/DumpResource*.class gnu/gettext/GetURL*.class
301
302EXTRA_DIST += gnu/gettext/DumpResource.java gnu/gettext/GetURL.java
303
304CLEANFILES += gnu.gettext.DumpResource$(EXEEXT) gnu.gettext.GetURL$(EXEEXT) \
305              gettext.jar gnu/gettext/*.class
306
307install-exec-local: install-exec-java-@BUILDJAVAEXE@
308install-exec-java-yes: all-java-yes
309	$(mkinstalldirs) $(DESTDIR)$(pkglibdir)
310	$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) gnu.gettext.DumpResource$(EXEEXT) $(DESTDIR)$(pkglibdir)/gnu.gettext.DumpResource$(EXEEXT)
311	$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) gnu.gettext.GetURL$(EXEEXT) $(DESTDIR)$(pkglibdir)/gnu.gettext.GetURL$(EXEEXT)
312install-exec-java-no:
313
314install-data-local: install-data-java-@BUILDJAVAEXE@
315install-data-java-yes:
316install-data-java-no: install-data-java-no-@BUILDJAVA@
317install-data-java-no-yes: all-java-no-yes
318	$(INSTALL_DATA) gettext.jar $(DESTDIR)$(jardir)/gettext.jar
319install-data-java-no-no:
320
321installdirs-local: installdirs-java-@BUILDJAVAEXE@
322installdirs-java-yes:
323	$(mkinstalldirs) $(DESTDIR)$(pkglibdir)
324installdirs-java-no: installdirs-java-no-@BUILDJAVA@
325installdirs-java-no-yes:
326	$(mkinstalldirs) $(DESTDIR)$(jardir)
327installdirs-java-no-no:
328
329uninstall-local: uninstall-java-@BUILDJAVAEXE@
330uninstall-java-yes:
331	$(RM) $(DESTDIR)$(pkglibdir)/gnu.gettext.DumpResource$(EXEEXT)
332	$(RM) $(DESTDIR)$(pkglibdir)/gnu.gettext.GetURL$(EXEEXT)
333uninstall-java-no: uninstall-java-no-@BUILDJAVA@
334uninstall-java-no-yes:
335	$(RM) $(DESTDIR)$(jardir)/gettext.jar
336uninstall-java-no-no:
337
338
339# Special rules for C# auxiliary programs.
340
341EXTRA_DIST += msgfmt.cs msgunfmt.cs
342
343CLEANFILES += msgfmt.net.exe msgunfmt.net.exe
344
345all-local: all-csharp-@BUILDCSHARP@
346all-csharp-yes: msgfmt.net.exe msgunfmt.net.exe
347all-csharp-no:
348
349msgfmt.net.exe: msgfmt.cs
350	$(CSHARPCOMP) $(CSHARPCOMPFLAGS) -o $@ $(srcdir)/msgfmt.cs
351
352msgunfmt.net.exe: msgunfmt.cs
353	$(CSHARPCOMP) $(CSHARPCOMPFLAGS) -o $@ -L ../../gettext-runtime/intl-csharp -l GNU.Gettext $(srcdir)/msgunfmt.cs
354
355install-exec-local: install-exec-csharp-@BUILDCSHARP@
356install-exec-csharp-yes: all-csharp-yes
357	$(mkinstalldirs) $(DESTDIR)$(pkglibdir)
358	$(INSTALL_DATA) msgfmt.net.exe $(DESTDIR)$(pkglibdir)/msgfmt.net.exe
359	$(INSTALL_DATA) msgunfmt.net.exe $(DESTDIR)$(pkglibdir)/msgunfmt.net.exe
360install-exec-csharp-no:
361	$(mkinstalldirs) $(DESTDIR)$(pkglibdir)
362
363installdirs-local: install-csharp
364installdirs-csharp:
365	$(mkinstalldirs) $(DESTDIR)$(pkglibdir)
366
367uninstall-local: uninstall-csharp-@BUILDCSHARP@
368uninstall-csharp-yes: all-csharp-yes
369	$(RM) $(DESTDIR)$(pkglibdir)/msgfmt.net.exe
370	$(RM) $(DESTDIR)$(pkglibdir)/msgunfmt.net.exe
371uninstall-csharp-no:
372
373
374# Special rules for Tcl auxiliary program.
375
376EXTRA_DIST += msgunfmt.tcl
377
378install-data-local: install-tcl
379install-tcl:
380	$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
381	$(INSTALL_DATA) $(srcdir)/msgunfmt.tcl $(DESTDIR)$(pkgdatadir)/msgunfmt.tcl
382
383installdirs-local: installdirs-tcl
384installdirs-tcl:
385	$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
386
387uninstall-local: uninstall-tcl
388uninstall-tcl:
389	$(RM) $(DESTDIR)$(pkgdatadir)/msgunfmt.tcl
390
391
392# Support for relocatability.
393RELOCATABLE_LIBRARY_PATH = $(libdir)
394RELOCATABLE_SRC_DIR = $(top_srcdir)/lib
395RELOCATABLE_BUILD_DIR = ../lib
396RELOCATABLE_CONFIG_H_DIR = ..
397@SET_RELOCATABLE@
398
399
400# VMS support.
401
402EXTRA_DIST += Makefile.vms
403
404
405# Woe32 support.
406
407EXTRA_DIST += Makefile.msvc
408