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 GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
23 top_srcdir = @top_srcdir@
27 exec_prefix = @exec_prefix@
28 datarootdir = @datarootdir@
31 localedir = $(libdir)/locale
32 gnulocaledir = $(datadir)/locale
33 gettextsrcdir = $(datadir)/glib-2.0/gettext/po
37 INSTALL_DATA = @INSTALL_DATA@
38 MKINSTALLDIRS = mkdir -p
44 MSGFMT_OPTS = @MSGFMT_OPTS@
52 INCLUDES = -I.. -I$(top_srcdir)/intl
54 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
59 DISTFILES = LINGUAS ChangeLog Makefile.in.in POTFILES.in $(GETTEXT_PACKAGE).pot \
60 $(POFILES) $(GMOFILES) $(SOURCES)
65 CATOBJEXT = @CATOBJEXT@
66 INSTOBJEXT = @INSTOBJEXT@
69 .SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
75 $(MAKE) $(GETTEXT_PACKAGE).pot
76 $(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox
82 $(AM_V_GEN) file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
83 && rm -f $$file && $(GMSGFMT) $(MSGFMT_OPTS) -o $$file $<
86 sed -f ../intl/po2msg.sed < $< > $*.msg \
87 && rm -f $@ && $(GENCAT) $@ $*.msg
95 $(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES)
96 $(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) \
97 --msgid-bugs-address='http://bugzilla.gnome.org/enter_bug.cgi?product=glib&keywords=I18N+L10N&component=general' \
98 --add-comments --keyword=_ --keyword=N_ \
101 --keyword=g_dcgettext:2 \
102 --keyword=g_dngettext:2,3 \
103 --keyword=g_dpgettext2:2c,3 \
104 --flag=N_:1:pass-c-format \
105 --flag=C_:2:pass-c-format \
106 --flag=NC_:2:pass-c-format \
107 --flag=g_dngettext:2:pass-c-format \
108 --flag=g_strdup_printf:1:c-format \
109 --flag=g_string_printf:2:c-format \
110 --flag=g_string_append_printf:2:c-format \
111 --flag=g_error_new:3:c-format \
112 --flag=g_set_error:4:c-format \
113 --flag=g_markup_printf_escaped:1:c-format \
114 --flag=g_log:3:c-format \
115 --flag=g_print:1:c-format \
116 --flag=g_printerr:1:c-format \
117 --flag=g_printf:1:c-format \
118 --flag=g_fprintf:2:c-format \
119 --flag=g_sprintf:2:c-format \
120 --flag=g_snprintf:3:c-format \
121 --flag=g_scanner_error:2:c-format \
122 --flag=g_scanner_warn:2:c-format \
124 && test ! -f $(GETTEXT_PACKAGE).po \
125 || ( rm -f $(srcdir)/$(GETTEXT_PACKAGE).pot \
126 && mv $(GETTEXT_PACKAGE).po $(srcdir)/$(GETTEXT_PACKAGE).pot )
128 install: install-exec install-data
130 install-data: install-data-@USE_NLS@
132 install-data-yes: all
133 $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
134 catalogs='$(CATALOGS)'; \
135 for cat in $$catalogs; do \
136 cat=`basename $$cat`; \
138 *.gmo) destdir=$(gnulocaledir);; \
139 *) destdir=$(localedir);; \
141 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
142 dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
143 $(MKINSTALLDIRS) $$dir; \
144 if test -r $$cat; then \
145 $(INSTALL_DATA) $$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
146 echo "installing $$cat as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
148 $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
149 echo "installing $(srcdir)/$$cat as" \
150 "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
152 if test -r $$cat.m; then \
153 $(INSTALL_DATA) $$cat.m $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
154 echo "installing $$cat.m as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
156 if test -r $(srcdir)/$$cat.m ; then \
157 $(INSTALL_DATA) $(srcdir)/$$cat.m \
158 $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
159 echo "installing $(srcdir)/$$cat as" \
160 "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
166 if test "$(PACKAGE)" = "glib"; then \
167 $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
168 $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
169 $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
174 # Define this as empty until I found a useful application.
178 catalogs='$(CATALOGS)'; \
179 for cat in $$catalogs; do \
180 cat=`basename $$cat`; \
181 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
182 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
183 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
184 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
185 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
187 if test "$(PACKAGE)" = "glib"; then \
188 rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
193 dvi info tags TAGS ID:
196 rm -f core core.* *.pox $(GETTEXT_PACKAGE).po *.old.po cat-id-tbl.tmp
202 rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
204 maintainer-clean: distclean
205 @echo "This command is intended for maintainers to use;"
206 @echo "it deletes files that may require special tools to rebuild."
209 distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir)
210 dist distdir: $(DISTFILES)
211 dists="$(DISTFILES)"; \
212 for file in $$dists; do \
213 ln $(srcdir)/$$file $(distdir) 2> /dev/null \
214 || cp -p $(srcdir)/$$file $(distdir); \
218 $(MAKE) $(GETTEXT_PACKAGE).pot
221 catalogs='$(CATALOGS)'; \
222 for cat in $$catalogs; do \
223 cat=`basename $$cat`; \
224 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
226 if $(MSGMERGE) $$lang.po $(GETTEXT_PACKAGE).pot -o $$tmpdir/$$lang.new.po; then \
227 if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
228 rm -f $$tmpdir/$$lang.new.po; \
230 if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
233 echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
234 rm -f $$tmpdir/$$lang.new.po; \
239 echo "msgmerge for $$cat failed!"; \
240 rm -f $$tmpdir/$$lang.new.po; \
244 # POTFILES is created from POTFILES.in by stripping comments, empty lines
245 # and Intltool tags (enclosed in square brackets), and appending a full
246 # relative path to them
247 POTFILES: POTFILES.in
248 ( if test 'x$(srcdir)' != 'x.'; then \
249 posrcprefix='$(top_srcdir)/'; \
257 -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
258 | sed -e '$$s/\\$$//') > $@-t \
262 Makefile: Makefile.in.in ../config.status POTFILES
264 && $(SHELL) ./config.status $(subdir)/$@.in
266 # Tell versions [3.59,3.63) of GNU make not to export all variables.
267 # Otherwise a system limit (for SysV at least) may be exceeded.