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 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
45 INSTALL_DATA = @INSTALL_DATA@
52 INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
53 INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
54 MSGMERGE = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist
55 GENPOT = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot
61 INCLUDES = -I.. -I$(top_srcdir)/intl
63 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
68 DISTFILES = ChangeLog Makefile.in.in POTFILES.in \
70 EXTRA_DISTFILES = POTFILES.skip Makevars LINGUAS
75 CATOBJEXT = @CATOBJEXT@
76 INSTOBJEXT = @INSTOBJEXT@
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 if test -n "$(MKINSTALLDIRS)"; then \
114 $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
116 $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
118 @catalogs='$(CATALOGS)'; \
119 for cat in $$catalogs; do \
120 cat=`basename $$cat`; \
122 *.gmo) destdir=$(gnulocaledir);; \
123 *) destdir=$(localedir);; \
125 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
126 dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
127 if test -n "$(MKINSTALLDIRS)"; then \
128 $(MKINSTALLDIRS) $$dir; \
130 $(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \
132 if test -r $$cat; then \
133 $(INSTALL_DATA) $$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
134 echo "installing $$cat as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
136 $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
137 echo "installing $(srcdir)/$$cat as" \
138 "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
140 if test -r $$cat.m; then \
141 $(INSTALL_DATA) $$cat.m $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
142 echo "installing $$cat.m as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
144 if test -r $(srcdir)/$$cat.m ; then \
145 $(INSTALL_DATA) $(srcdir)/$$cat.m \
146 $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
147 echo "installing $(srcdir)/$$cat as" \
148 "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
154 if test "$(PACKAGE)" = "glib"; then \
155 if test -n "$(MKINSTALLDIRS)"; then \
156 $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
158 $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
160 $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
161 $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
166 # Define this as empty until I found a useful application.
170 catalogs='$(CATALOGS)'; \
171 for cat in $$catalogs; do \
172 cat=`basename $$cat`; \
173 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
174 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
175 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
176 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
177 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
179 if test "$(PACKAGE)" = "glib"; then \
180 rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
183 check: all $(GETTEXT_PACKAGE).pot
185 dvi info tags TAGS ID:
188 rm -f core core.* *.pox $(GETTEXT_PACKAGE).pot *.old.po cat-id-tbl.tmp
190 rm -f .intltool-merge-cache
195 rm -f Makefile Makefile.in POTFILES
196 rm -f *.mo *.msg *.cat *.cat.m $(GMOFILES)
198 maintainer-clean: distclean
199 @echo "This command is intended for maintainers to use;"
200 @echo "it deletes files that may require special tools to rebuild."
203 distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir)
204 dist distdir: $(DISTFILES)
205 dists="$(DISTFILES)"; \
206 extra_dists="$(EXTRA_DISTFILES)"; \
207 for file in $$extra_dists; do \
208 test -f $$file && dists="$$dists $$file"; \
210 for file in $$dists; do \
211 ln $(srcdir)/$$file $(distdir) 2> /dev/null \
212 || cp -p $(srcdir)/$$file $(distdir); \
216 $(MAKE) $(GETTEXT_PACKAGE).pot
218 catalogs='$(CATALOGS)'; \
219 for cat in $$catalogs; do \
220 cat=`basename $$cat`; \
221 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
223 result="`$(MSGMERGE) -o $$tmpdir/$$lang.new.po $$lang`"; \
225 if cmp $(srcdir)/$$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
226 rm -f $$tmpdir/$$lang.new.po; \
228 if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
231 echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
232 rm -f $$tmpdir/$$lang.new.po; \
237 echo "msgmerge for $$cat failed!"; \
238 rm -f $$tmpdir/$$lang.new.po; \
242 # POTFILES is created from POTFILES.in by stripping comments, empty lines
243 # and Intltool tags (enclosed in square brackets), and appending a full
244 # relative path to them
245 POTFILES: POTFILES.in
246 ( posrcprefix='$(top_srcdir)/'; \
251 -e "s@^@ $$posrcprefix@" $(srcdir)/$@.in \
252 | sed -e '$$!s/$$/ \\/') > $@-t \
256 Makefile: Makefile.in.in ../config.status POTFILES
258 && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
259 $(SHELL) ./config.status
261 # Tell versions [3.59,3.63) of GNU make not to export all variables.
262 # Otherwise a system limit (for SysV at least) may be exceeded.