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