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