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>
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
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.
11 # Origin: gettext-0.18
12 GETTEXT_MACRO_VERSION = 0.18
16 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
22 top_srcdir = @top_srcdir@
26 exec_prefix = @exec_prefix@
27 datarootdir = @datarootdir@
29 localedir = @localedir@
30 gettextsrcdir = $(datadir)/gettext/po
33 INSTALL_DATA = @INSTALL_DATA@
36 # In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as
37 # "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions,
38 # @install_sh@ does not start with $(SHELL), so we add it.
39 # In automake >= 1.10, @mkdir_p@ is derived from ${MKDIR_P}, which is defined
40 # either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake
41 # versions, $(mkinstalldirs) and $(install_sh) are unused.
42 mkinstalldirs = $(SHELL) @install_sh@ -d
43 install_sh = $(SHELL) @install_sh@
48 GMSGFMT_no = @GMSGFMT@
49 GMSGFMT_yes = @GMSGFMT_015@
50 GMSGFMT = $(GMSGFMT_$(USE_MSGCTXT))
53 MSGFMT_yes = @MSGFMT_015@
54 MSGFMT = $(MSGFMT_$(USE_MSGCTXT))
55 XGETTEXT_ = @XGETTEXT@
56 XGETTEXT_no = @XGETTEXT@
57 XGETTEXT_yes = @XGETTEXT_015@
58 XGETTEXT = $(XGETTEXT_$(USE_MSGCTXT))
60 MSGMERGE_UPDATE = @MSGMERGE@ --update
67 UPDATEPOFILES = @UPDATEPOFILES@
68 DUMMYPOFILES = @DUMMYPOFILES@
69 DISTFILES.common = Makefile.in.in remove-potcdate.sin \
70 $(DISTFILES.common.extra1) $(DISTFILES.common.extra2) \
71 $(DISTFILES.common.extra3) $(DISTFILES.common.extra4) $(DISTFILES.common.extra5)
72 DISTFILES = $(DISTFILES.common) Makevars POTFILES.in POTFILES-shell.in \
73 $(POFILES) $(GMOFILES) \
74 $(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3) $(DISTFILES.extra4) $(DISTFILES.extra5) grub.d.sed README
80 # Makevars gets inserted here. (Don't remove this line!)
83 .SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update
86 @echo "$(MSGFMT) -c -o $@ $<"; \
87 $(MSGFMT) --endianness=little -c -o t-$@ $< && mv t-$@ $@
90 @lang=`echo $* | sed -e 's,.*/,,'`; \
91 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
92 echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) --endianness=little -c --statistics --verbose -o $${lang}.gmo $${lang}.po"; \
93 cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) --endianness=little -c --statistics --verbose -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
96 sed -e '/^#/d' $< > t-$@
100 all: check-macro-version all-@USE_NLS@
105 # Ensure that the gettext macros and this Makefile.in.in are in sync.
107 @test "$(GETTEXT_MACRO_VERSION)" = "@GETTEXT_MACRO_VERSION@" \
108 || { 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; \
112 # $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no
113 # internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
114 # we don't want to bother translators with empty POT files). We assume that
115 # LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty.
116 # In this case, stamp-po is a nop (i.e. a phony target).
118 # stamp-po is a timestamp denoting the last time at which the CATALOGS have
119 # been loosely updated. Its purpose is that when a developer or translator
120 # checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
121 # "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
122 # invocations of "make" will do nothing. This timestamp would not be necessary
123 # if updating the $(CATALOGS) would always touch them; however, the rule for
124 # $(POFILES) has been designed to not touch files that don't need to be
126 stamp-po: $(srcdir)/$(DOMAIN).pot
127 test ! -f $(srcdir)/$(DOMAIN).pot || \
128 test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
129 @test ! -f $(srcdir)/$(DOMAIN).pot || { \
130 echo "touch stamp-po" && \
131 echo timestamp > stamp-poT && \
132 mv stamp-poT stamp-po; \
135 # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
136 # otherwise packages like GCC can not be built if only parts of the source
137 # have been downloaded.
139 # This target rebuilds $(DOMAIN).pot; it is an expensive operation.
140 # Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
141 $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in $(srcdir)/POTFILES-shell.in remove-potcdate.sed
142 if LC_ALL=C grep 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null | grep -v 'libtool:' >/dev/null; then \
143 package_gnu='GNU '; \
147 if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \
148 msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
150 msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \
152 case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
153 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \
154 $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
155 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
156 --files-from=$(srcdir)/POTFILES.in \
157 --copyright-holder='$(COPYRIGHT_HOLDER)' \
158 --msgid-bugs-address="$$msgid_bugs_address" \
161 $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
162 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
163 --files-from=$(srcdir)/POTFILES.in \
164 --copyright-holder='$(COPYRIGHT_HOLDER)' \
165 --package-name="$${package_gnu}@PACKAGE@" \
166 --package-version='@VERSION@' \
167 --msgid-bugs-address="$$msgid_bugs_address" \
170 case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
171 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \
172 $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
173 --add-comments=TRANSLATORS: @XGETTEXT_EXTRA_OPTIONS@ \
174 --files-from=$(srcdir)/POTFILES-shell.in \
175 --copyright-holder='$(COPYRIGHT_HOLDER)' \
176 --msgid-bugs-address="$$msgid_bugs_address" \
177 --join-existing --language=Shell \
178 --keyword=gettext_quoted --keyword=gettext_printf \
181 $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
182 --add-comments=TRANSLATORS: @XGETTEXT_EXTRA_OPTIONS@ \
183 --files-from=$(srcdir)/POTFILES-shell.in \
184 --copyright-holder='$(COPYRIGHT_HOLDER)' \
185 --package-name="$${package_gnu}@PACKAGE@" \
186 --package-version='@VERSION@' \
187 --msgid-bugs-address="$$msgid_bugs_address" \
188 --join-existing --language=Shell \
189 --keyword=gettext_quoted --keyword=gettext_printf \
192 test ! -f $(DOMAIN).po || { \
193 sed -f grub.d.sed < $(DOMAIN).po > $(DOMAIN).1po && \
194 mv $(DOMAIN).1po $(DOMAIN).po; \
195 if test -f $(srcdir)/$(DOMAIN).pot; then \
196 sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
197 sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
198 if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
199 rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
201 rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
202 mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
205 mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
209 # This rule has no dependencies: we don't need to update $(DOMAIN).pot at
210 # every "make" invocation, only create it when it is missing.
211 # Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
212 $(srcdir)/$(DOMAIN).pot:
213 $(MAKE) $(DOMAIN).pot-update
215 # This target rebuilds a PO file if $(DOMAIN).pot has changed.
216 # Note that a PO file is not touched if it doesn't need to be changed.
217 $(POFILES): $(srcdir)/$(DOMAIN).pot
218 @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
219 if test -f "$(srcdir)/$${lang}.po"; then \
220 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
221 echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot"; \
223 && { case `$(MSGMERGE_UPDATE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
224 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
225 $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \
227 $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot;; \
231 $(MAKE) $${lang}.po-create; \
235 install: install-exec install-data
237 install-data: install-data-@USE_NLS@
238 if test "$(PACKAGE)" = "gettext-tools"; then \
239 $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
240 for file in $(DISTFILES.common) Makevars.template; do \
241 $(INSTALL_DATA) $(srcdir)/$$file \
242 $(DESTDIR)$(gettextsrcdir)/$$file; \
244 for file in Makevars; do \
245 rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
251 install-data-yes: all
252 @catalogs='$(CATALOGS)'; \
253 for cat in $$catalogs; do \
254 cat=`basename $$cat`; \
255 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
256 dir=$(localedir)/$$lang/LC_MESSAGES; \
257 $(mkdir_p) $(DESTDIR)$$dir; \
258 if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
259 $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
260 echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
261 for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
262 if test -n "$$lc"; then \
263 if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
264 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
265 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
266 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
267 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
269 if test -f $$file; then \
270 ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
273 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
275 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
278 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
279 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
282 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
283 ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
284 ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
285 cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
286 echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
291 install-strip: install
293 installdirs: installdirs-exec installdirs-data
295 installdirs-data: installdirs-data-@USE_NLS@
296 if test "$(PACKAGE)" = "gettext-tools"; then \
297 $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
302 installdirs-data-yes:
303 @catalogs='$(CATALOGS)'; \
304 for cat in $$catalogs; do \
305 cat=`basename $$cat`; \
306 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
307 dir=$(localedir)/$$lang/LC_MESSAGES; \
308 $(mkdir_p) $(DESTDIR)$$dir; \
309 for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
310 if test -n "$$lc"; then \
311 if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
312 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
313 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
314 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
315 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
317 if test -f $$file; then \
318 ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
321 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
323 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
326 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
327 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
334 # Define this as empty until I found a useful application.
337 uninstall: uninstall-exec uninstall-data
339 uninstall-data: uninstall-data-@USE_NLS@
340 if test "$(PACKAGE)" = "gettext-tools"; then \
341 for file in $(DISTFILES.common) Makevars.template; do \
342 rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
349 catalogs='$(CATALOGS)'; \
350 for cat in $$catalogs; do \
351 cat=`basename $$cat`; \
352 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
353 for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
354 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
360 info dvi ps pdf html tags TAGS ctags CTAGS ID:
363 rm -f remove-potcdate.sed
365 rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
371 rm -f Makefile Makefile.in POTFILES *.mo
373 maintainer-clean: distclean
374 @echo "This command is intended for maintainers to use;"
375 @echo "it deletes files that may require special tools to rebuild."
376 rm -f stamp-po $(GMOFILES)
378 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
382 # This is a separate target because 'update-po' must be executed before.
383 dist2: stamp-po $(DISTFILES)
384 dists="$(DISTFILES)"; \
385 if test "$(PACKAGE)" = "gettext-tools"; then \
386 dists="$$dists Makevars.template"; \
388 if test -f $(srcdir)/$(DOMAIN).pot; then \
389 dists="$$dists $(DOMAIN).pot stamp-po"; \
391 if test -f $(srcdir)/ChangeLog; then \
392 dists="$$dists ChangeLog"; \
394 for i in 0 1 2 3 4 5 6 7 8 9; do \
395 if test -f $(srcdir)/ChangeLog.$$i; then \
396 dists="$$dists ChangeLog.$$i"; \
399 if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
400 for file in $$dists; do \
401 if test -f $$file; then \
402 cp -p $$file $(distdir) || exit 1; \
404 cp -p $(srcdir)/$$file $(distdir) || exit 1; \
409 $(MAKE) $(DOMAIN).pot-update
410 test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
413 # General rule for creating PO files.
416 @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
417 echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
420 # General rule for updating PO files.
423 @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
424 if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \
427 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
428 echo "$${cdcmd}$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
430 if { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
431 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
432 $(MSGMERGE) $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
434 $(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
437 if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
438 rm -f $$tmpdir/$$lang.new.po; \
440 if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
443 echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
448 echo "msgmerge for $$lang.po failed!" 1>&2; \
449 rm -f $$tmpdir/$$lang.new.po; \
454 update-gmo: Makefile $(GMOFILES)
457 # Recreate Makefile by invoking config.status. Explicitly invoke the shell,
458 # because execution permission bits may not work on the current file system.
459 # Use @SHELL@, which is the shell determined by autoconf for the use by its
460 # scripts, not $(SHELL) which is hardwired to /bin/sh and may be deficient.
461 Makefile: Makefile.in.in Makevars $(top_builddir)/config.status @POMAKEFILEDEPS@
463 && @SHELL@ ./config.status $(subdir)/$@.in po-directories
467 # Tell versions [3.59,3.63) of GNU make not to export all variables.
468 # Otherwise a system limit (for SysV at least) may be exceeded.