1 # Makefile for program source directory in GNU NLS utilities package.
2 # Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
4 # This file file be copied and used freely without restrictions. It can
5 # be used in projects which are not available under the GNU Public License
6 # but which still want to provide support for the GNU gettext functionality.
7 # Please note that the actual code is *not* freely available.
9 # - Modified by Owen Taylor <otaylor@redhat.com> to use GETTEXT_PACKAGE
10 # instead of PACKAGE and to look for po2tbl in ./ not in intl/
12 # - Modified by jacob berkman <jacob@ximian.com> to install
13 # Makefile.in.in and po2tbl.sed.in for use with glib-gettextize
15 # - Modified by Rodney Dawes <dobey@novell.com> for use with intltool
17 # We have the following line for use by intltoolize:
20 GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
28 top_srcdir = @top_srcdir@
33 exec_prefix = @exec_prefix@
35 datarootdir = @datarootdir@
37 localedir = $(libdir)/locale
38 gnulocaledir = $(datadir)/locale
39 gettextsrcdir = $(datadir)/glib-2.0/gettext/po
41 install_sh = @install_sh@
42 # Automake >= 1.8 provides @mkdir_p@.
43 # Until it can be supposed, use the safe fallback:
44 mkdir_p = $(install_sh) -d
47 INSTALL_DATA = @INSTALL_DATA@
53 INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
54 INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
55 MSGMERGE = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist
56 GENPOT = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot
62 INCLUDES = -I.. -I$(top_srcdir)/intl
64 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
69 DISTFILES = ChangeLog Makefile.in.in POTFILES.in \
71 EXTRA_DISTFILES = POTFILES.skip Makevars LINGUAS
76 CATOBJEXT = @CATOBJEXT@
79 .SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
85 $(MAKE) $(GETTEXT_PACKAGE).pot
86 $(MSGMERGE) $< $(GETTEXT_PACKAGE).pot -o $*.pox
92 file=`echo $* | sed 's,.*/,,'`.gmo \
93 && rm -f $$file && $(GMSGFMT) -o $$file $<
96 sed -f ../intl/po2msg.sed < $< > $*.msg \
97 && rm -f $@ && gencat $@ $*.msg
105 $(GETTEXT_PACKAGE).pot: $(POTFILES)
108 install: install-exec install-data
110 install-data: install-data-@USE_NLS@
112 install-data-yes: all
113 $(mkdir_p) $(DESTDIR)$(datadir)
114 @catalogs='$(CATALOGS)'; \
115 for cat in $$catalogs; do \
116 cat=`basename $$cat`; \
118 *.gmo) destdir=$(gnulocaledir);; \
119 *) destdir=$(localedir);; \
121 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
122 dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
124 if test -r $$cat; then \
125 $(INSTALL_DATA) $$cat $$dir/$(GETTEXT_PACKAGE).mo; \
126 echo "installing $$cat as $$dir/$(GETTEXT_PACKAGE).mo"; \
128 $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(GETTEXT_PACKAGE).mo; \
129 echo "installing $(srcdir)/$$cat as" \
130 "$$dir/$(GETTEXT_PACKAGE).mo"; \
132 if test -r $$cat.m; then \
133 $(INSTALL_DATA) $$cat.m $$dir/$(GETTEXT_PACKAGE).mo.m; \
134 echo "installing $$cat.m as $$dir/$(GETTEXT_PACKAGE).mo.m"; \
136 if test -r $(srcdir)/$$cat.m ; then \
137 $(INSTALL_DATA) $(srcdir)/$$cat.m \
138 $$dir/$(GETTEXT_PACKAGE).mo.m; \
139 echo "installing $(srcdir)/$$cat as" \
140 "$$dir/$(GETTEXT_PACKAGE).mo.m"; \
146 if test "$(PACKAGE)" = "glib"; then \
147 $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
148 $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
149 $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
154 # Define this as empty until I found a useful application.
158 catalogs='$(CATALOGS)'; \
159 for cat in $$catalogs; do \
160 cat=`basename $$cat`; \
161 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
162 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
163 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo.m; \
164 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
165 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo.m; \
167 if test "$(PACKAGE)" = "glib"; then \
168 rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
171 check: all $(GETTEXT_PACKAGE).pot
173 dvi info tags TAGS ID:
176 rm -f core core.* *.pox $(GETTEXT_PACKAGE).pot *.old.po cat-id-tbl.tmp
178 rm -f .intltool-merge-cache
183 rm -f Makefile Makefile.in POTFILES stamp-it
184 rm -f *.mo *.msg *.cat *.cat.m *.gmo
186 maintainer-clean: distclean
187 @echo "This command is intended for maintainers to use;"
188 @echo "it deletes files that may require special tools to rebuild."
191 distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir)
192 dist distdir: $(DISTFILES)
193 dists="$(DISTFILES)"; \
194 extra_dists="$(EXTRA_DISTFILES)"; \
195 for file in $$extra_dists; do \
196 test -f $(srcdir)/$$file && dists="$$dists $(srcdir)/$$file"; \
198 for file in $$dists; do \
199 test -f $$file || file="$(srcdir)/$$file"; \
200 ln $$file $(distdir) 2> /dev/null \
201 || cp -p $$file $(distdir); \
205 $(MAKE) $(GETTEXT_PACKAGE).pot
207 catalogs='$(CATALOGS)'; \
208 for cat in $$catalogs; do \
209 cat=`basename $$cat`; \
210 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
212 result="`$(MSGMERGE) -o $$tmpdir/$$lang.new.po $$lang`"; \
214 if cmp $(srcdir)/$$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
215 rm -f $$tmpdir/$$lang.new.po; \
217 if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
220 echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
221 rm -f $$tmpdir/$$lang.new.po; \
226 echo "msgmerge for $$cat failed!"; \
227 rm -f $$tmpdir/$$lang.new.po; \
231 Makefile POTFILES: stamp-it
232 @if test ! -f $@; then \
237 stamp-it: Makefile.in.in ../config.status POTFILES.in
239 && CONFIG_FILES=$(subdir)/Makefile.in CONFIG_HEADERS= CONFIG_LINKS= \
240 $(SHELL) ./config.status
242 # Tell versions [3.59,3.63) of GNU make not to export all variables.
243 # Otherwise a system limit (for SysV at least) may be exceeded.