Use po/LINGUAS
[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 = /bin/sh
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           --flag=g_strdup_printf:1:c-format \
99           --flag=g_string_printf:2:c-format \
100           --flag=g_string_append_printf:2:c-format \
101           --flag=g_error_new:3:c-format \
102           --flag=g_set_error:4:c-format \
103           --flag=g_markup_printf_escaped:1:c-format \
104           --flag=g_log:3:c-format \
105           --flag=g_print:1:c-format \
106           --flag=g_printerr:1:c-format \
107           --flag=g_printf:1:c-format \
108           --flag=g_fprintf:2:c-format \
109           --flag=g_sprintf:2:c-format \
110           --flag=g_snprintf:3:c-format \
111           --flag=g_scanner_error:2:c-format \
112           --flag=g_scanner_warn:2:c-format \
113           --files-from=$(srcdir)/POTFILES.in \
114         && test ! -f $(GETTEXT_PACKAGE).po \
115            || ( rm -f $(srcdir)/$(GETTEXT_PACKAGE).pot \
116                 && mv $(GETTEXT_PACKAGE).po $(srcdir)/$(GETTEXT_PACKAGE).pot )
117
118 install: install-exec install-data
119 install-exec:
120 install-data: install-data-@USE_NLS@
121 install-data-no: all
122 install-data-yes: all
123         if test -r "$(MKINSTALLDIRS)"; then \
124           $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
125         else \
126           $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
127         fi
128         @catalogs='$(CATALOGS)'; \
129         for cat in $$catalogs; do \
130           cat=`basename $$cat`; \
131           case "$$cat" in \
132             *.gmo) destdir=$(gnulocaledir);; \
133             *)     destdir=$(localedir);; \
134           esac; \
135           lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
136           dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
137           if test -r "$(MKINSTALLDIRS)"; then \
138             $(MKINSTALLDIRS) $$dir; \
139           else \
140             $(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \
141           fi; \
142           if test -r $$cat; then \
143             $(INSTALL_DATA) $$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
144             echo "installing $$cat as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
145           else \
146             $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
147             echo "installing $(srcdir)/$$cat as" \
148                  "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
149           fi; \
150           if test -r $$cat.m; then \
151             $(INSTALL_DATA) $$cat.m $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
152             echo "installing $$cat.m as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
153           else \
154             if test -r $(srcdir)/$$cat.m ; then \
155               $(INSTALL_DATA) $(srcdir)/$$cat.m \
156                 $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
157               echo "installing $(srcdir)/$$cat as" \
158                    "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
159             else \
160               true; \
161             fi; \
162           fi; \
163         done
164         if test "$(PACKAGE)" = "glib"; then \
165           if test -r "$(MKINSTALLDIRS)"; then \
166             $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
167           else \
168             $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
169           fi; \
170           $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
171                           $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
172         else \
173           : ; \
174         fi
175
176 # Define this as empty until I found a useful application.
177 installcheck:
178
179 uninstall:
180         catalogs='$(CATALOGS)'; \
181         for cat in $$catalogs; do \
182           cat=`basename $$cat`; \
183           lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
184           rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
185           rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
186           rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
187           rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
188         done
189         if test "$(PACKAGE)" = "glib"; then \
190           rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
191         fi
192
193 check: all
194
195 dvi info tags TAGS ID:
196
197 mostlyclean:
198         rm -f core core.* *.pox $(GETTEXT_PACKAGE).po *.old.po cat-id-tbl.tmp
199         rm -fr *.o
200
201 clean: mostlyclean
202
203 distclean: clean
204         rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
205
206 maintainer-clean: distclean
207         @echo "This command is intended for maintainers to use;"
208         @echo "it deletes files that may require special tools to rebuild."
209         rm -f $(GMOFILES)
210
211 distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir)
212 dist distdir: update-po $(DISTFILES)
213         dists="$(DISTFILES)"; \
214         for file in $$dists; do \
215           ln $(srcdir)/$$file $(distdir) 2> /dev/null \
216             || cp -p $(srcdir)/$$file $(distdir); \
217         done
218
219 update-po: Makefile
220         $(MAKE) $(GETTEXT_PACKAGE).pot
221         tmpdir=`pwd`; \
222         cd $(srcdir); \
223         catalogs='$(CATALOGS)'; \
224         for cat in $$catalogs; do \
225           cat=`basename $$cat`; \
226           lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
227           echo "$$lang:"; \
228           if $(MSGMERGE) $$lang.po $(GETTEXT_PACKAGE).pot -o $$tmpdir/$$lang.new.po; then \
229             if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
230               rm -f $$tmpdir/$$lang.new.po; \
231             else \
232               if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
233                 :; \
234               else \
235                 echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
236                 rm -f $$tmpdir/$$lang.new.po; \
237                 exit 1; \
238               fi; \
239             fi; \
240           else \
241             echo "msgmerge for $$cat failed!"; \
242             rm -f $$tmpdir/$$lang.new.po; \
243           fi; \
244         done
245
246 # POTFILES is created from POTFILES.in by stripping comments, empty lines
247 # and Intltool tags (enclosed in square brackets), and appending a full
248 # relative path to them
249 POTFILES: POTFILES.in
250         ( if test 'x$(srcdir)' != 'x.'; then \
251             posrcprefix='$(top_srcdir)/'; \
252           else \
253             posrcprefix="../"; \
254           fi; \
255           rm -f $@-t $@ \
256             && (sed -e '/^#/d'                                          \
257                     -e "s/^\[.*\] +//"                                  \
258                     -e '/^[     ]*$$/d'                                 \
259                     -e "s@.*@   $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
260                 | sed -e '$$s/\\$$//') > $@-t \
261             && chmod a-w $@-t \
262             && mv $@-t $@ )
263
264 Makefile: Makefile.in.in ../config.status POTFILES
265         cd .. \
266           && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
267                $(SHELL) ./config.status
268
269 # Tell versions [3.59,3.63) of GNU make not to export all variables.
270 # Otherwise a system limit (for SysV at least) may be exceeded.
271 .NOEXPORT: