2012-10-10 [colin] 3.8.1cvs89
[claws.git] / po / Makefile.in.in
1 # Makefile for PO directory in any package using GNU gettext.
2 # Copyright (C) 1995-1997, 2000-2006 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
3 #
4 # This file can be copied and used freely without restrictions.  It can
5 # be used in projects which are not available under the GNU General Public
6 # License but which still want to provide support for the GNU gettext
7 # functionality.
8 # Please note that the actual code of GNU gettext is covered by the GNU
9 # General Public License and is *not* in the public domain.
10 #
11 # Origin: gettext-0.15
12
13 PACKAGE = @PACKAGE@
14 VERSION = @VERSION@
15 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
16
17 SHELL = /bin/sh
18 @SET_MAKE@
19
20 srcdir = @srcdir@
21 top_srcdir = @top_srcdir@
22 VPATH = @srcdir@
23
24 prefix = @prefix@
25 exec_prefix = @exec_prefix@
26 datarootdir = @datarootdir@
27 datadir = @datadir@
28 localedir = @localedir@
29 gettextsrcdir = $(datadir)/gettext/po
30
31 INSTALL = @INSTALL@
32 INSTALL_DATA = @INSTALL_DATA@
33 mkinstalldirs = $(SHELL) @install_sh@ -d
34 mkdir_p = @mkdir_p@
35
36 GMSGFMT_ = @GMSGFMT@
37 GMSGFMT_no = @GMSGFMT@
38 GMSGFMT_yes = @GMSGFMT_015@
39 GMSGFMT = $(GMSGFMT_$(USE_MSGCTXT))
40 MSGFMT_ = @MSGFMT@
41 MSGFMT_no = @MSGFMT@
42 MSGFMT_yes = @MSGFMT_015@
43 MSGFMT = $(MSGFMT_$(USE_MSGCTXT))
44 XGETTEXT_ = @XGETTEXT@
45 XGETTEXT_no = @XGETTEXT@
46 XGETTEXT_yes = @XGETTEXT_015@
47 XGETTEXT = $(XGETTEXT_$(USE_MSGCTXT))
48 MSGMERGE = msgmerge
49 MSGMERGE_UPDATE = @MSGMERGE@ --update
50 MSGATTRIB = msgattrib --no-obsolete
51 MSGINIT = msginit
52 MSGCONV = msgconv
53 MSGFILTER = msgfilter
54
55 POFILES = @POFILES@
56 GMOFILES = @GMOFILES@
57 UPDATEPOFILES = @UPDATEPOFILES@
58 DUMMYPOFILES = @DUMMYPOFILES@
59 DISTFILES.common = Makefile.in.in remove-potcdate.sin \
60 $(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
61 DISTFILES = $(DISTFILES.common) Makevars POTFILES.in \
62 $(POFILES) $(GMOFILES) \
63 $(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)
64
65 POTFILES = \
66
67 CATALOGS = @CATALOGS@
68
69 # Makevars gets inserted here. (Don't remove this line!)
70
71 .SUFFIXES:
72 .SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update
73
74 .po.mo:
75         @echo "$(MSGFMT) -c -o $@ $<"; \
76         $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
77
78 .po.gmo:
79         @lang=`echo $* | sed -e 's,.*/,,'`; \
80         test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
81         echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
82         cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
83
84 .sin.sed:
85         sed -e '/^#/d' $< > t-$@
86         mv t-$@ $@
87
88
89 all: all-@USE_NLS@
90
91 all-yes: stamp-po
92 all-no:
93
94 # $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no
95 # internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
96 # we don't want to bother translators with empty POT files). We assume that
97 # LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty.
98 # In this case, stamp-po is a nop (i.e. a phony target).
99
100 # stamp-po is a timestamp denoting the last time at which the CATALOGS have
101 # been loosely updated. Its purpose is that when a developer or translator
102 # checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
103 # "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
104 # invocations of "make" will do nothing. This timestamp would not be necessary
105 # if updating the $(CATALOGS) would always touch them; however, the rule for
106 # $(POFILES) has been designed to not touch files that don't need to be
107 # changed.
108 stamp-po: $(srcdir)/$(DOMAIN).pot
109         test ! -f $(srcdir)/$(DOMAIN).pot || \
110           test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
111         @test ! -f $(srcdir)/$(DOMAIN).pot || { \
112           echo "touch stamp-po" && \
113           echo timestamp > stamp-poT && \
114           mv stamp-poT stamp-po; \
115         }
116
117 # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
118 # otherwise packages like GCC can not be built if only parts of the source
119 # have been downloaded.
120
121 # This target rebuilds $(DOMAIN).pot; it is an expensive operation.
122 # Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
123 $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
124         if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \
125           msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
126         else \
127           msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \
128         fi; \
129         $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
130           --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
131           --files-from=$(srcdir)/POTFILES.in \
132           --copyright-holder='$(COPYRIGHT_HOLDER)' \
133           --msgid-bugs-address="$$msgid_bugs_address"
134         test ! -f $(DOMAIN).po || { \
135           if test -f $(srcdir)/$(DOMAIN).pot; then \
136             sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
137             sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
138             if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
139               rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
140             else \
141               rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
142               mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
143             fi; \
144           else \
145             mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
146           fi; \
147         }
148
149 # This rule has no dependencies: we don't need to update $(DOMAIN).pot at
150 # every "make" invocation, only create it when it is missing.
151 # Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
152 $(srcdir)/$(DOMAIN).pot:
153         $(MAKE) $(DOMAIN).pot-update
154
155 # This target rebuilds a PO file if $(DOMAIN).pot has changed.
156 # Note that a PO file is not touched if it doesn't need to be changed.
157 $(POFILES): $(srcdir)/$(DOMAIN).pot
158         @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
159         if test -f "$(srcdir)/$${lang}.po"; then \
160           test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
161           echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
162           cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \
163           echo "$(MSGATTRIB) -o $${lang}.po $${lang}.po"; \
164           $(MSGATTRIB) -o $${lang}.po $${lang}.po; \
165         else \
166           $(MAKE) $${lang}.po-create; \
167         fi
168
169
170 install: install-exec install-data
171 install-exec:
172 install-data: install-data-@USE_NLS@
173         if test "$(PACKAGE)" = "gettext-tools"; then \
174           $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
175           for file in $(DISTFILES.common) Makevars.template; do \
176             $(INSTALL_DATA) $(srcdir)/$$file \
177                             $(DESTDIR)$(gettextsrcdir)/$$file; \
178           done; \
179           for file in Makevars; do \
180             rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
181           done; \
182         else \
183           : ; \
184         fi
185 install-data-no: all
186 install-data-yes: all
187         $(mkdir_p) $(DESTDIR)$(datadir)
188         @catalogs='$(CATALOGS)'; \
189         for cat in $$catalogs; do \
190           cat=`basename $$cat`; \
191           lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
192           dir=$(localedir)/$$lang/LC_MESSAGES; \
193           $(mkdir_p) $(DESTDIR)$$dir; \
194           if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
195           $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
196           echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
197           for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
198             if test -n "$$lc"; then \
199               if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
200                 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
201                 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
202                 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
203                 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
204                  for file in *; do \
205                    if test -f $$file; then \
206                      ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
207                    fi; \
208                  done); \
209                 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
210               else \
211                 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
212                   :; \
213                 else \
214                   rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
215                   mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
216                 fi; \
217               fi; \
218               rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
219               ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
220               ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
221               cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
222               echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
223             fi; \
224           done; \
225         done
226
227 install-strip: install
228
229 installdirs: installdirs-exec installdirs-data
230 installdirs-exec:
231 installdirs-data: installdirs-data-@USE_NLS@
232         if test "$(PACKAGE)" = "gettext-tools"; then \
233           $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
234         else \
235           : ; \
236         fi
237 installdirs-data-no:
238 installdirs-data-yes:
239         $(mkdir_p) $(DESTDIR)$(datadir)
240         @catalogs='$(CATALOGS)'; \
241         for cat in $$catalogs; do \
242           cat=`basename $$cat`; \
243           lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
244           dir=$(localedir)/$$lang/LC_MESSAGES; \
245           $(mkdir_p) $(DESTDIR)$$dir; \
246           for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
247             if test -n "$$lc"; then \
248               if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
249                 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
250                 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
251                 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
252                 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
253                  for file in *; do \
254                    if test -f $$file; then \
255                      ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
256                    fi; \
257                  done); \
258                 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
259               else \
260                 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
261                   :; \
262                 else \
263                   rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
264                   mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
265                 fi; \
266               fi; \
267             fi; \
268           done; \
269         done
270
271 # Define this as empty until I found a useful application.
272 installcheck:
273
274 uninstall: uninstall-exec uninstall-data
275 uninstall-exec:
276 uninstall-data: uninstall-data-@USE_NLS@
277         if test "$(PACKAGE)" = "gettext-tools"; then \
278           for file in $(DISTFILES.common) Makevars.template; do \
279             rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
280           done; \
281         else \
282           : ; \
283         fi
284 uninstall-data-no:
285 uninstall-data-yes:
286         catalogs='$(CATALOGS)'; \
287         for cat in $$catalogs; do \
288           cat=`basename $$cat`; \
289           lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
290           for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
291             rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
292           done; \
293         done
294
295 check: all
296
297 info dvi ps pdf html tags TAGS ctags CTAGS ID:
298
299 mostlyclean:
300         rm -f remove-potcdate.sed
301         rm -f stamp-poT
302         rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
303         rm -fr *.o
304
305 clean: mostlyclean
306
307 distclean: clean
308         rm -f Makefile Makefile.in POTFILES *.mo
309
310 maintainer-clean: distclean
311         @echo "This command is intended for maintainers to use;"
312         @echo "it deletes files that may require special tools to rebuild."
313         rm -f stamp-po $(GMOFILES)
314
315 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
316 dist distdir:
317         $(MAKE) update-po
318         @$(MAKE) dist2
319 # This is a separate target because 'update-po' must be executed before.
320 dist2: stamp-po $(DISTFILES)
321         dists="$(DISTFILES)"; \
322         if test "$(PACKAGE)" = "gettext-tools"; then \
323           dists="$$dists Makevars.template"; \
324         fi; \
325         if test -f $(srcdir)/$(DOMAIN).pot; then \
326           dists="$$dists $(DOMAIN).pot stamp-po"; \
327         fi; \
328         if test -f $(srcdir)/ChangeLog; then \
329           dists="$$dists ChangeLog"; \
330         fi; \
331         for i in 0 1 2 3 4 5 6 7 8 9; do \
332           if test -f $(srcdir)/ChangeLog.$$i; then \
333             dists="$$dists ChangeLog.$$i"; \
334           fi; \
335         done; \
336         if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
337         for file in $$dists; do \
338           if test -f $$file; then \
339             cp -p $$file $(distdir) || exit 1; \
340           else \
341             cp -p $(srcdir)/$$file $(distdir) || exit 1; \
342           fi; \
343         done
344
345 update-po: Makefile
346         $(MAKE) $(DOMAIN).pot-update
347         test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
348         $(MAKE) update-gmo
349
350 # General rule for creating PO files.
351
352 .nop.po-create:
353         @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
354         echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
355         exit 1
356
357 # General rule for updating PO files.
358
359 .nop.po-update:
360         @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
361         if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \
362         tmpdir=`pwd`; \
363         echo "$$lang:"; \
364         test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
365         echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
366         cd $(srcdir); \
367         if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
368           if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
369             rm -f $$tmpdir/$$lang.new.po; \
370           else \
371             if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
372               :; \
373             else \
374               echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
375               exit 1; \
376             fi; \
377           fi; \
378         else \
379           echo "msgmerge for $$lang.po failed!" 1>&2; \
380           rm -f $$tmpdir/$$lang.new.po; \
381         fi
382
383 $(DUMMYPOFILES):
384
385 update-gmo: Makefile $(GMOFILES)
386         @:
387
388 Makefile: Makefile.in.in Makevars $(top_builddir)/config.status @POMAKEFILEDEPS@
389         cd $(top_builddir) \
390           && $(SHELL) ./config.status $(subdir)/$@.in po-directories
391
392 force:
393
394 # Tell versions [3.59,3.63) of GNU make not to export all variables.
395 # Otherwise a system limit (for SysV at least) may be exceeded.
396 .NOEXPORT: