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