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