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