1# Makefile for directory with message catalog handling in GNU NLS Utilities.
2# Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc.
3#
4# This program is free software; you can redistribute it and/or modify it
5# under the terms of the GNU Library General Public License as published
6# by 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 GNU
12# Library General Public License for more details.
13#
14# You should have received a copy of the GNU Library General Public
15# License along with this program; if not, write to the Free Software
16# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17# USA.
18
19PACKAGE = @PACKAGE@
20VERSION = @VERSION@
21
22SHELL = /bin/sh
23
24srcdir = @srcdir@
25top_srcdir = @top_srcdir@
26top_builddir = ..
27VPATH = @srcdir@
28
29prefix = @prefix@
30exec_prefix = @exec_prefix@
31transform = @program_transform_name@
32libdir = @libdir@
33includedir = @includedir@
34datadir = @datadir@
35datarootdir = @datarootdir@
36localedir = $(datadir)/locale
37gettextsrcdir = $(datadir)/gettext/intl
38aliaspath = $(localedir)
39subdir = intl
40
41INSTALL = @INSTALL@
42INSTALL_DATA = @INSTALL_DATA@
43MKINSTALLDIRS = @MKINSTALLDIRS@
44mkinstalldirs = $(SHELL) `case "$(MKINSTALLDIRS)" in /*) echo "$(MKINSTALLDIRS)" ;; *) echo "$(top_builddir)/$(MKINSTALLDIRS)" ;; esac`
45
46l = @INTL_LIBTOOL_SUFFIX_PREFIX@
47
48AR = ar
49CC = @CC@
50LIBTOOL = @LIBTOOL@
51RANLIB = @RANLIB@
52YACC = @INTLBISON@ -y -d
53YFLAGS = --name-prefix=__gettext
54
55DEFS = -DLOCALEDIR=\"$(localedir)\" -DLOCALE_ALIAS_PATH=\"$(aliaspath)\" \
56-DLIBDIR=\"$(libdir)\" -DIN_LIBINTL @DEFS@
57CPPFLAGS = @CPPFLAGS@
58CFLAGS = @CFLAGS@
59LDFLAGS = @LDFLAGS@
60
61COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
62
63HEADERS = $(COMHDRS) libgnuintl.h loadinfo.h
64COMHDRS = gmo.h gettextP.h hash-string.h plural-exp.h eval-plural.h os2compat.h
65SOURCES = $(COMSRCS) intl-compat.c
66COMSRCS = bindtextdom.c dcgettext.c dgettext.c gettext.c \
67finddomain.c loadmsgcat.c localealias.c textdomain.c l10nflist.c \
68explodename.c dcigettext.c dcngettext.c dngettext.c ngettext.c plural.y \
69plural-exp.c localcharset.c localename.c osdep.c os2compat.c
70OBJECTS = @INTLOBJS@ bindtextdom.$lo dcgettext.$lo dgettext.$lo gettext.$lo \
71finddomain.$lo loadmsgcat.$lo localealias.$lo textdomain.$lo l10nflist.$lo \
72explodename.$lo dcigettext.$lo dcngettext.$lo dngettext.$lo ngettext.$lo \
73plural.$lo plural-exp.$lo localcharset.$lo localename.$lo osdep.$lo
74GETTOBJS = intl-compat.$lo
75DISTFILES.common = Makefile.in \
76config.charset locale.alias ref-add.sin ref-del.sin $(HEADERS) $(SOURCES)
77DISTFILES.generated = plural.c
78DISTFILES.normal = VERSION
79DISTFILES.gettext = COPYING.LIB-2.0 COPYING.LIB-2.1 libintl.glibc
80DISTFILES.obsolete = xopen-msg.sed linux-msg.sed po2tbl.sed.in cat-compat.c \
81COPYING.LIB-2 gettext.h libgettext.h plural-eval.c
82
83# Libtool's library version information for libintl.
84# Before making a gettext release, the gettext maintainer must change this
85# according to the libtool documentation, section "Library interface versions".
86# Maintainers of other packages that include the intl directory must *not*
87# change these values.
88LTV_CURRENT=4
89LTV_REVISION=0
90LTV_AGE=2
91
92.SUFFIXES:
93.SUFFIXES: .c .y .o .lo .sin .sed
94.c.o:
95	$(COMPILE) $<
96.c.lo:
97	$(LIBTOOL) --mode=compile $(COMPILE) $<
98
99.y.c:
100	$(YACC) $(YFLAGS) --output $@ $<
101	rm -f $*.h
102
103.sin.sed:
104	sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $< > t-$@
105	mv t-$@ $@
106
107INCLUDES = -I.. -I. -I$(top_srcdir)/intl
108
109all: all-@USE_INCLUDED_LIBINTL@
110all-yes: libintl.$la libintl.h charset.alias ref-add.sed ref-del.sed
111all-no: all-no-@BUILD_INCLUDED_LIBINTL@
112all-no-yes: libgnuintl.$la
113all-no-no:
114
115libintl.a libgnuintl.a: $(OBJECTS)
116	rm -f $@
117	$(AR) cru $@ $(OBJECTS)
118	$(RANLIB) $@
119
120libintl.la libgnuintl.la: $(OBJECTS)
121	$(LIBTOOL) --mode=link \
122	  $(CC) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) $(LDFLAGS) -o $@ \
123	  $(OBJECTS) @LTLIBICONV@ -lc \
124	  -version-info $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE) \
125	  -rpath $(libdir) \
126	  -no-undefined
127
128libintl.h: libgnuintl.h
129	cp $(srcdir)/libgnuintl.h libintl.h
130
131charset.alias: config.charset
132	$(SHELL) $(srcdir)/config.charset '@host@' > t-$@
133	mv t-$@ $@
134
135check: all
136
137# This installation goal is only used in GNU gettext.  Packages which
138# only use the library should use install instead.
139
140# We must not install the libintl.h/libintl.a files if we are on a
141# system which has the GNU gettext() function in its C library or in a
142# separate library.
143# If you want to use the one which comes with this version of the
144# package, you have to use `configure --with-included-gettext'.
145install: install-exec install-data
146install-exec: all
147	if test "$(PACKAGE)" = "gettext" \
148	   && test '@INTLOBJS@' = '$(GETTOBJS)'; then \
149	  $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \
150	  $(INSTALL_DATA) libintl.h $(DESTDIR)$(includedir)/libintl.h; \
151	  $(LIBTOOL) --mode=install \
152	    $(INSTALL_DATA) libintl.$la $(DESTDIR)$(libdir)/libintl.$la; \
153	else \
154	  : ; \
155	fi
156	if test '@USE_INCLUDED_LIBINTL@' = yes; then \
157	  test @GLIBC21@ != no || $(mkinstalldirs) $(DESTDIR)$(libdir); \
158	  temp=$(DESTDIR)$(libdir)/t-charset.alias; \
159	  dest=$(DESTDIR)$(libdir)/charset.alias; \
160	  if test -f $(DESTDIR)$(libdir)/charset.alias; then \
161	    orig=$(DESTDIR)$(libdir)/charset.alias; \
162	    sed -f ref-add.sed $$orig > $$temp; \
163	    $(INSTALL_DATA) $$temp $$dest; \
164	    rm -f $$temp; \
165	  else \
166	    if test @GLIBC21@ = no; then \
167	      orig=charset.alias; \
168	      sed -f ref-add.sed $$orig > $$temp; \
169	      $(INSTALL_DATA) $$temp $$dest; \
170	      rm -f $$temp; \
171	    fi; \
172	  fi; \
173	  $(mkinstalldirs) $(DESTDIR)$(localedir); \
174	  test -f $(DESTDIR)$(localedir)/locale.alias \
175	    && orig=$(DESTDIR)$(localedir)/locale.alias \
176	    || orig=$(srcdir)/locale.alias; \
177	  temp=$(DESTDIR)$(localedir)/t-locale.alias; \
178	  dest=$(DESTDIR)$(localedir)/locale.alias; \
179	  sed -f ref-add.sed $$orig > $$temp; \
180	  $(INSTALL_DATA) $$temp $$dest; \
181	  rm -f $$temp; \
182	else \
183	  : ; \
184	fi
185install-data: all
186	if test "$(PACKAGE)" = "gettext"; then \
187	  $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
188	  $(INSTALL_DATA) VERSION $(DESTDIR)$(gettextsrcdir)/VERSION; \
189	  $(INSTALL_DATA) ChangeLog.inst $(DESTDIR)$(gettextsrcdir)/ChangeLog; \
190	  dists="COPYING.LIB-2.0 COPYING.LIB-2.1 $(DISTFILES.common)"; \
191	  for file in $$dists; do \
192	    $(INSTALL_DATA) $(srcdir)/$$file \
193			    $(DESTDIR)$(gettextsrcdir)/$$file; \
194	  done; \
195	  chmod a+x $(DESTDIR)$(gettextsrcdir)/config.charset; \
196	  dists="$(DISTFILES.generated)"; \
197	  for file in $$dists; do \
198	    if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
199	    $(INSTALL_DATA) $$dir/$$file \
200			    $(DESTDIR)$(gettextsrcdir)/$$file; \
201	  done; \
202	  dists="$(DISTFILES.obsolete)"; \
203	  for file in $$dists; do \
204	    rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
205	  done; \
206	else \
207	  : ; \
208	fi
209
210install-strip: install
211
212installdirs:
213	if test "$(PACKAGE)" = "gettext" \
214	   && test '@INTLOBJS@' = '$(GETTOBJS)'; then \
215	  $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \
216	else \
217	  : ; \
218	fi
219	if test '@USE_INCLUDED_LIBINTL@' = yes; then \
220	  test @GLIBC21@ != no || $(mkinstalldirs) $(DESTDIR)$(libdir); \
221	  $(mkinstalldirs) $(DESTDIR)$(localedir); \
222	else \
223	  : ; \
224	fi
225	if test "$(PACKAGE)" = "gettext"; then \
226	  $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
227	else \
228	  : ; \
229	fi
230
231# Define this as empty until I found a useful application.
232installcheck:
233
234uninstall:
235	if test "$(PACKAGE)" = "gettext" \
236	   && test '@INTLOBJS@' = '$(GETTOBJS)'; then \
237	  rm -f $(DESTDIR)$(includedir)/libintl.h; \
238	  $(LIBTOOL) --mode=uninstall \
239	    rm -f $(DESTDIR)$(libdir)/libintl.$la; \
240	else \
241	  : ; \
242	fi
243	if test '@USE_INCLUDED_LIBINTL@' = yes; then \
244	  if test -f $(DESTDIR)$(libdir)/charset.alias; then \
245	    temp=$(DESTDIR)$(libdir)/t-charset.alias; \
246	    dest=$(DESTDIR)$(libdir)/charset.alias; \
247	    sed -f ref-del.sed $$dest > $$temp; \
248	    if grep '^# Packages using this file: $$' $$temp > /dev/null; then \
249	      rm -f $$dest; \
250	    else \
251	      $(INSTALL_DATA) $$temp $$dest; \
252	    fi; \
253	    rm -f $$temp; \
254	  fi; \
255	  if test -f $(DESTDIR)$(localedir)/locale.alias; then \
256	    temp=$(DESTDIR)$(localedir)/t-locale.alias; \
257	    dest=$(DESTDIR)$(localedir)/locale.alias; \
258	    sed -f ref-del.sed $$dest > $$temp; \
259	    if grep '^# Packages using this file: $$' $$temp > /dev/null; then \
260	      rm -f $$dest; \
261	    else \
262	      $(INSTALL_DATA) $$temp $$dest; \
263	    fi; \
264	    rm -f $$temp; \
265	  fi; \
266	else \
267	  : ; \
268	fi
269	if test "$(PACKAGE)" = "gettext"; then \
270	  for file in VERSION ChangeLog COPYING.LIB-2.0 COPYING.LIB-2.1 $(DISTFILES.common) $(DISTFILES.generated); do \
271	    rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
272	  done; \
273	else \
274	  : ; \
275	fi
276
277info dvi:
278
279$(OBJECTS): ../config.h libgnuintl.h
280bindtextdom.$lo dcgettext.$lo dcigettext.$lo dcngettext.$lo dgettext.$lo dngettext.$lo finddomain.$lo gettext.$lo intl-compat.$lo loadmsgcat.$lo localealias.$lo ngettext.$lo textdomain.$lo: gettextP.h gmo.h loadinfo.h
281dcigettext.$lo: hash-string.h
282explodename.$lo l10nflist.$lo: loadinfo.h
283dcigettext.$lo loadmsgcat.$lo plural.$lo plural-exp.$lo: plural-exp.h
284dcigettext.$lo: eval-plural.h
285
286tags: TAGS
287
288TAGS: $(HEADERS) $(SOURCES)
289	here=`pwd`; cd $(srcdir) && etags -o $$here/TAGS $(HEADERS) $(SOURCES)
290
291id: ID
292
293ID: $(HEADERS) $(SOURCES)
294	here=`pwd`; cd $(srcdir) && mkid -f$$here/ID $(HEADERS) $(SOURCES)
295
296
297mostlyclean:
298	rm -f *.a *.la *.o *.lo core core.*
299	rm -f libintl.h charset.alias ref-add.sed ref-del.sed
300	rm -f -r .libs _libs
301
302clean: mostlyclean
303
304distclean: clean
305	rm -f Makefile ID TAGS
306	if test "$(PACKAGE)" = gettext; then \
307	  rm -f ChangeLog.inst $(DISTFILES.normal); \
308	else \
309	  : ; \
310	fi
311
312maintainer-clean: distclean
313	@echo "This command is intended for maintainers to use;"
314	@echo "it deletes files that may require special tools to rebuild."
315
316
317# GNU gettext needs not contain the file `VERSION' but contains some
318# other files which should not be distributed in other packages.
319distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
320dist distdir: Makefile
321	if test "$(PACKAGE)" = gettext; then \
322	  additional="$(DISTFILES.gettext)"; \
323	else \
324	  additional="$(DISTFILES.normal)"; \
325	fi; \
326	$(MAKE) $(DISTFILES.common) $(DISTFILES.generated) $$additional; \
327	for file in ChangeLog $(DISTFILES.common) $(DISTFILES.generated) $$additional; do \
328	  if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
329	  cp -p $$dir/$$file $(distdir); \
330	done
331
332Makefile: Makefile.in ../config.status
333	cd .. \
334	  && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
335
336# Tell versions [3.59,3.63) of GNU make not to export all variables.
337# Otherwise a system limit (for SysV at least) may be exceeded.
338.NOEXPORT:
339