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