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