Merge remote branch 'gvdb/master'
[platform/upstream/glib.git] / po / Makefile.in.in
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>
3 #
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.
8 #
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/
11 #
12 # - Modified by jacob berkman <jacob@ximian.com> to install
13 #   Makefile.in.in and po2tbl.sed.in for use with glib-gettextize
14
15 GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
16 PACKAGE = @PACKAGE@
17 VERSION = @VERSION@
18
19 SHELL = @SHELL@
20 @SET_MAKE@
21
22 srcdir = @srcdir@
23 top_srcdir = @top_srcdir@
24 VPATH = @srcdir@
25
26 prefix = @prefix@
27 exec_prefix = @exec_prefix@
28 datarootdir = @datarootdir@
29 datadir = @datadir@
30 libdir = @libdir@
31 localedir = $(libdir)/locale
32 gnulocaledir = $(datadir)/locale
33 gettextsrcdir = $(datadir)/glib-2.0/gettext/po
34 subdir = po
35
36 INSTALL = @INSTALL@
37 INSTALL_DATA = @INSTALL_DATA@
38 MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@
39
40 CC = @CC@
41 GENCAT = @GENCAT@
42 GMSGFMT = @GMSGFMT@
43 MSGFMT = @MSGFMT@
44 MSGFMT_OPTS = @MSGFMT_OPTS@
45 XGETTEXT = @XGETTEXT@
46 MSGMERGE = msgmerge
47
48 DEFS = @DEFS@
49 CFLAGS = @CFLAGS@
50 CPPFLAGS = @CPPFLAGS@
51
52 INCLUDES = -I.. -I$(top_srcdir)/intl
53
54 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
55
56 SOURCES = 
57 POFILES = @POFILES@
58 GMOFILES = @GMOFILES@
59 DISTFILES = LINGUAS ChangeLog Makefile.in.in POTFILES.in $(GETTEXT_PACKAGE).pot \
60 $(POFILES) $(GMOFILES) $(SOURCES)
61
62 POTFILES = \
63
64 CATALOGS = @CATALOGS@
65 CATOBJEXT = @CATOBJEXT@
66 INSTOBJEXT = @INSTOBJEXT@
67
68 .SUFFIXES:
69 .SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
70
71 .c.o:
72         $(COMPILE) $<
73
74 .po.pox:
75         $(MAKE) $(GETTEXT_PACKAGE).pot
76         $(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox
77
78 .po.mo:
79         $(MSGFMT) -o $@ $<
80
81 .po.gmo:
82         file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
83           && rm -f $$file && $(GMSGFMT) $(MSGFMT_OPTS) -o $$file $<
84
85 .po.cat:
86         sed -f ../intl/po2msg.sed < $< > $*.msg \
87           && rm -f $@ && $(GENCAT) $@ $*.msg
88
89
90 all: all-@USE_NLS@
91
92 all-yes: $(CATALOGS)
93 all-no:
94
95 $(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES)
96         $(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) --directory=$(top_srcdir) \
97           --add-comments --keyword=_ --keyword=N_ \
98           --keyword=C_:1c,2 \
99           --keyword=NC_:1c,2 \
100           --keyword=g_dcgettext:2 \
101           --keyword=g_dngettext:2,3 \
102           --keyword=g_dpgettext2:2c,3 \
103           --flag=N_:1:pass-c-format \
104           --flag=C_:2:pass-c-format \
105           --flag=NC_:2:pass-c-format \
106           --flag=g_dngettext:2:pass-c-format \
107           --flag=g_strdup_printf:1:c-format \
108           --flag=g_string_printf:2:c-format \
109           --flag=g_string_append_printf:2:c-format \
110           --flag=g_error_new:3:c-format \
111           --flag=g_set_error:4:c-format \
112           --flag=g_markup_printf_escaped:1:c-format \
113           --flag=g_log:3:c-format \
114           --flag=g_print:1:c-format \
115           --flag=g_printerr:1:c-format \
116           --flag=g_printf:1:c-format \
117           --flag=g_fprintf:2:c-format \
118           --flag=g_sprintf:2:c-format \
119           --flag=g_snprintf:3:c-format \
120           --flag=g_scanner_error:2:c-format \
121           --flag=g_scanner_warn:2:c-format \
122           --files-from=$(srcdir)/POTFILES.in \
123         && test ! -f $(GETTEXT_PACKAGE).po \
124            || ( rm -f $(srcdir)/$(GETTEXT_PACKAGE).pot \
125                 && mv $(GETTEXT_PACKAGE).po $(srcdir)/$(GETTEXT_PACKAGE).pot )
126
127 install: install-exec install-data
128 install-exec:
129 install-data: install-data-@USE_NLS@
130 install-data-no: all
131 install-data-yes: all
132         if test -r "$(MKINSTALLDIRS)"; then \
133           $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
134         else \
135           $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
136         fi
137         @catalogs='$(CATALOGS)'; \
138         for cat in $$catalogs; do \
139           cat=`basename $$cat`; \
140           case "$$cat" in \
141             *.gmo) destdir=$(gnulocaledir);; \
142             *)     destdir=$(localedir);; \
143           esac; \
144           lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
145           dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
146           if test -r "$(MKINSTALLDIRS)"; then \
147             $(MKINSTALLDIRS) $$dir; \
148           else \
149             $(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \
150           fi; \
151           if test -r $$cat; then \
152             $(INSTALL_DATA) $$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
153             echo "installing $$cat as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
154           else \
155             $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
156             echo "installing $(srcdir)/$$cat as" \
157                  "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
158           fi; \
159           if test -r $$cat.m; then \
160             $(INSTALL_DATA) $$cat.m $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
161             echo "installing $$cat.m as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
162           else \
163             if test -r $(srcdir)/$$cat.m ; then \
164               $(INSTALL_DATA) $(srcdir)/$$cat.m \
165                 $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
166               echo "installing $(srcdir)/$$cat as" \
167                    "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
168             else \
169               true; \
170             fi; \
171           fi; \
172         done
173         if test "$(PACKAGE)" = "glib"; then \
174           if test -r "$(MKINSTALLDIRS)"; then \
175             $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
176           else \
177             $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
178           fi; \
179           $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
180                           $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
181         else \
182           : ; \
183         fi
184
185 # Define this as empty until I found a useful application.
186 installcheck:
187
188 uninstall:
189         catalogs='$(CATALOGS)'; \
190         for cat in $$catalogs; do \
191           cat=`basename $$cat`; \
192           lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
193           rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
194           rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
195           rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
196           rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
197         done
198         if test "$(PACKAGE)" = "glib"; then \
199           rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
200         fi
201
202 check: all
203
204 dvi info tags TAGS ID:
205
206 mostlyclean:
207         rm -f core core.* *.pox $(GETTEXT_PACKAGE).po *.old.po cat-id-tbl.tmp
208         rm -fr *.o
209
210 clean: mostlyclean
211
212 distclean: clean
213         rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
214
215 maintainer-clean: distclean
216         @echo "This command is intended for maintainers to use;"
217         @echo "it deletes files that may require special tools to rebuild."
218         rm -f $(GMOFILES)
219
220 distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir)
221 dist distdir: $(DISTFILES)
222         dists="$(DISTFILES)"; \
223         for file in $$dists; do \
224           ln $(srcdir)/$$file $(distdir) 2> /dev/null \
225             || cp -p $(srcdir)/$$file $(distdir); \
226         done
227
228 update-po: Makefile
229         $(MAKE) $(GETTEXT_PACKAGE).pot
230         tmpdir=`pwd`; \
231         cd $(srcdir); \
232         catalogs='$(CATALOGS)'; \
233         for cat in $$catalogs; do \
234           cat=`basename $$cat`; \
235           lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
236           echo "$$lang:"; \
237           if $(MSGMERGE) $$lang.po $(GETTEXT_PACKAGE).pot -o $$tmpdir/$$lang.new.po; then \
238             if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
239               rm -f $$tmpdir/$$lang.new.po; \
240             else \
241               if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
242                 :; \
243               else \
244                 echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
245                 rm -f $$tmpdir/$$lang.new.po; \
246                 exit 1; \
247               fi; \
248             fi; \
249           else \
250             echo "msgmerge for $$cat failed!"; \
251             rm -f $$tmpdir/$$lang.new.po; \
252           fi; \
253         done
254
255 # POTFILES is created from POTFILES.in by stripping comments, empty lines
256 # and Intltool tags (enclosed in square brackets), and appending a full
257 # relative path to them
258 POTFILES: POTFILES.in
259         ( if test 'x$(srcdir)' != 'x.'; then \
260             posrcprefix='$(top_srcdir)/'; \
261           else \
262             posrcprefix="../"; \
263           fi; \
264           rm -f $@-t $@ \
265             && (sed -e '/^#/d'                                          \
266                     -e "s/^\[.*\] +//"                                  \
267                     -e '/^[     ]*$$/d'                                 \
268                     -e "s@.*@   $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
269                 | sed -e '$$s/\\$$//') > $@-t \
270             && chmod a-w $@-t \
271             && mv $@-t $@ )
272
273 Makefile: Makefile.in.in ../config.status POTFILES
274         cd .. \
275           && $(SHELL) ./config.status $(subdir)/$@.in
276
277 # Tell versions [3.59,3.63) of GNU make not to export all variables.
278 # Otherwise a system limit (for SysV at least) may be exceeded.
279 .NOEXPORT: