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 # Copying and distribution of this file, with or without modification,
5 # are permitted in any medium without royalty provided the copyright
6 # notice and this notice are preserved. This file is offered as-is,
7 # without any warranty.
9 # Origin: gettext-0.19.6
10 GETTEXT_MACRO_VERSION = 0.19
14 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
21 top_srcdir = @top_srcdir@
25 exec_prefix = @exec_prefix@
26 datarootdir = @datarootdir@
28 localedir = @localedir@
29 gettextsrcdir = $(datadir)/gettext/po
32 INSTALL_DATA = @INSTALL_DATA@
35 # In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as
36 # "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions,
37 # @install_sh@ does not start with $(SHELL), so we add it.
38 # In automake >= 1.10, @mkdir_p@ is derived from ${MKDIR_P}, which is defined
39 # either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake
40 # versions, $(mkinstalldirs) and $(install_sh) are unused.
41 mkinstalldirs = $(SHELL) @install_sh@ -d
42 install_sh = $(SHELL) @install_sh@
47 GMSGFMT_no = @GMSGFMT@
48 GMSGFMT_yes = @GMSGFMT_015@
49 GMSGFMT = $(GMSGFMT_$(USE_MSGCTXT))
52 MSGFMT_yes = @MSGFMT_015@
53 MSGFMT = $(MSGFMT_$(USE_MSGCTXT))
54 XGETTEXT_ = @XGETTEXT@
55 XGETTEXT_no = @XGETTEXT@
56 XGETTEXT_yes = @XGETTEXT_015@
57 XGETTEXT = $(XGETTEXT_$(USE_MSGCTXT))
59 MSGMERGE_UPDATE = @MSGMERGE@ --update
66 UPDATEPOFILES = @UPDATEPOFILES@
67 DUMMYPOFILES = @DUMMYPOFILES@
68 DISTFILES.common = Makefile.in.in remove-potcdate.sin \
69 $(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
70 DISTFILES = $(DISTFILES.common) Makevars POTFILES.in \
71 $(POFILES) $(GMOFILES) \
72 $(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)
78 POFILESDEPS_ = $(srcdir)/$(DOMAIN).pot
79 POFILESDEPS_yes = $(POFILESDEPS_)
81 POFILESDEPS = $(POFILESDEPS_$(PO_DEPENDS_ON_POT))
83 DISTFILESDEPS_ = update-po
84 DISTFILESDEPS_yes = $(DISTFILESDEPS_)
86 DISTFILESDEPS = $(DISTFILESDEPS_$(DIST_DEPENDS_ON_UPDATE_PO))
88 # Makevars gets inserted here. (Don't remove this line!)
91 .SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update
94 @echo "$(MSGFMT) -c -o $@ $<"; \
95 $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
98 @lang=`echo $* | sed -e 's,.*/,,'`; \
99 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
100 echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o $${lang}.gmo $${lang}.po"; \
101 cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
104 sed -e '/^#/d' $< > t-$@
113 # Ensure that the gettext macros and this Makefile.in.in are in sync.
114 CHECK_MACRO_VERSION = \
115 test "$(GETTEXT_MACRO_VERSION)" = "@GETTEXT_MACRO_VERSION@" \
116 || { 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; \
120 # $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no
121 # internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
122 # we don't want to bother translators with empty POT files). We assume that
123 # LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty.
124 # In this case, stamp-po is a nop (i.e. a phony target).
126 # stamp-po is a timestamp denoting the last time at which the CATALOGS have
127 # been loosely updated. Its purpose is that when a developer or translator
128 # checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
129 # "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
130 # invocations of "make" will do nothing. This timestamp would not be necessary
131 # if updating the $(CATALOGS) would always touch them; however, the rule for
132 # $(POFILES) has been designed to not touch files that don't need to be
134 stamp-po: $(srcdir)/$(DOMAIN).pot
135 @$(CHECK_MACRO_VERSION)
136 test ! -f $(srcdir)/$(DOMAIN).pot || \
137 test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
138 @test ! -f $(srcdir)/$(DOMAIN).pot || { \
139 echo "touch stamp-po" && \
140 echo timestamp > stamp-poT && \
141 mv stamp-poT stamp-po; \
144 # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
145 # otherwise packages like GCC can not be built if only parts of the source
146 # have been downloaded.
148 # This target rebuilds $(DOMAIN).pot; it is an expensive operation.
149 # Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
150 # The determination of whether the package xyz is a GNU one is based on the
151 # heuristic whether some file in the top level directory mentions "GNU xyz".
152 # If GNU 'find' is available, we avoid grepping through monster files.
153 $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
154 package_gnu="$(PACKAGE_GNU)"; \
155 test -n "$$package_gnu" || { \
156 if { if (LC_ALL=C find --version) 2>/dev/null | grep GNU >/dev/null; then \
157 LC_ALL=C find -L $(top_srcdir) -maxdepth 1 -type f \
158 -size -10000000c -exec grep 'GNU @PACKAGE@' \
159 /dev/null '{}' ';' 2>/dev/null; \
161 LC_ALL=C grep 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null; \
163 } | grep -v 'libtool:' >/dev/null; then \
169 if test "$$package_gnu" = "yes"; then \
170 package_prefix='GNU '; \
174 if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \
175 msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
177 msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \
179 case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
180 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \
181 $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
182 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
183 --files-from=$(srcdir)/POTFILES.in \
184 --copyright-holder='$(COPYRIGHT_HOLDER)' \
185 --msgid-bugs-address="$$msgid_bugs_address" \
188 $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
189 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
190 --files-from=$(srcdir)/POTFILES.in \
191 --copyright-holder='$(COPYRIGHT_HOLDER)' \
192 --package-name="$${package_prefix}@PACKAGE@" \
193 --package-version='@VERSION@' \
194 --msgid-bugs-address="$$msgid_bugs_address" \
197 test ! -f $(DOMAIN).po || { \
198 if test -f $(srcdir)/$(DOMAIN).pot-header; then \
199 sed -e '1,/^#$$/d' < $(DOMAIN).po > $(DOMAIN).1po && \
200 cat $(srcdir)/$(DOMAIN).pot-header $(DOMAIN).1po > $(DOMAIN).po; \
201 rm -f $(DOMAIN).1po; \
203 if test -f $(srcdir)/$(DOMAIN).pot; then \
204 sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
205 sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
206 if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
207 rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
209 rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
210 mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
213 mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
217 # This rule has no dependencies: we don't need to update $(DOMAIN).pot at
218 # every "make" invocation, only create it when it is missing.
219 # Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
220 $(srcdir)/$(DOMAIN).pot:
221 $(MAKE) $(DOMAIN).pot-update
223 # This target rebuilds a PO file if $(DOMAIN).pot has changed.
224 # Note that a PO file is not touched if it doesn't need to be changed.
225 $(POFILES): $(POFILESDEPS)
226 @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
227 if test -f "$(srcdir)/$${lang}.po"; then \
228 test -f $(srcdir)/$(DOMAIN).pot || $(MAKE) $(srcdir)/$(DOMAIN).pot; \
229 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
230 echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot"; \
232 && { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
233 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
234 $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \
236 $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot;; \
240 $(MAKE) $${lang}.po-create; \
244 install: install-exec install-data
246 install-data: install-data-@USE_NLS@
247 if test "$(PACKAGE)" = "gettext-tools"; then \
248 $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
249 for file in $(DISTFILES.common) Makevars.template; do \
250 $(INSTALL_DATA) $(srcdir)/$$file \
251 $(DESTDIR)$(gettextsrcdir)/$$file; \
253 for file in Makevars; do \
254 rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
260 install-data-yes: all
261 @catalogs='$(CATALOGS)'; \
262 for cat in $$catalogs; do \
263 cat=`basename $$cat`; \
264 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
265 dir=$(localedir)/$$lang/LC_MESSAGES; \
266 $(mkdir_p) $(DESTDIR)$$dir; \
267 if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
268 $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
269 echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
270 for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
271 if test -n "$$lc"; then \
272 if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
273 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
274 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
275 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
276 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
278 if test -f $$file; then \
279 ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
282 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
284 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
287 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
288 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
291 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
292 ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
293 ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
294 cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
295 echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
300 install-strip: install
302 installdirs: installdirs-exec installdirs-data
304 installdirs-data: installdirs-data-@USE_NLS@
305 if test "$(PACKAGE)" = "gettext-tools"; then \
306 $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
311 installdirs-data-yes:
312 @catalogs='$(CATALOGS)'; \
313 for cat in $$catalogs; do \
314 cat=`basename $$cat`; \
315 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
316 dir=$(localedir)/$$lang/LC_MESSAGES; \
317 $(mkdir_p) $(DESTDIR)$$dir; \
318 for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
319 if test -n "$$lc"; then \
320 if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
321 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
322 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
323 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
324 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
326 if test -f $$file; then \
327 ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
330 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
332 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
335 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
336 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
343 # Define this as empty until I found a useful application.
346 uninstall: uninstall-exec uninstall-data
348 uninstall-data: uninstall-data-@USE_NLS@
349 if test "$(PACKAGE)" = "gettext-tools"; then \
350 for file in $(DISTFILES.common) Makevars.template; do \
351 rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
358 catalogs='$(CATALOGS)'; \
359 for cat in $$catalogs; do \
360 cat=`basename $$cat`; \
361 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
362 for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
363 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
369 info dvi ps pdf html tags TAGS ctags CTAGS ID:
372 rm -f remove-potcdate.sed
374 rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
380 rm -f Makefile Makefile.in POTFILES *.mo
382 maintainer-clean: distclean
383 @echo "This command is intended for maintainers to use;"
384 @echo "it deletes files that may require special tools to rebuild."
385 rm -f stamp-po $(GMOFILES)
387 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
389 test -z "$(DISTFILESDEPS)" || $(MAKE) $(DISTFILESDEPS)
391 # This is a separate target because 'update-po' must be executed before.
392 dist2: stamp-po $(DISTFILES)
393 dists="$(DISTFILES)"; \
394 if test "$(PACKAGE)" = "gettext-tools"; then \
395 dists="$$dists Makevars.template"; \
397 if test -f $(srcdir)/$(DOMAIN).pot; then \
398 dists="$$dists $(DOMAIN).pot stamp-po"; \
400 if test -f $(srcdir)/ChangeLog; then \
401 dists="$$dists ChangeLog"; \
403 for i in 0 1 2 3 4 5 6 7 8 9; do \
404 if test -f $(srcdir)/ChangeLog.$$i; then \
405 dists="$$dists ChangeLog.$$i"; \
408 if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
409 for file in $$dists; do \
410 if test -f $$file; then \
411 cp -p $$file $(distdir) || exit 1; \
413 cp -p $(srcdir)/$$file $(distdir) || exit 1; \
418 $(MAKE) $(DOMAIN).pot-update
419 test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
422 # General rule for creating PO files.
425 @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
426 echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
429 # General rule for updating PO files.
432 @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
433 if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \
436 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
437 echo "$${cdcmd}$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
439 if { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
440 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
441 $(MSGMERGE) $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
443 $(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
446 if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
447 rm -f $$tmpdir/$$lang.new.po; \
449 if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
452 echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
457 echo "msgmerge for $$lang.po failed!" 1>&2; \
458 rm -f $$tmpdir/$$lang.new.po; \
463 update-gmo: Makefile $(GMOFILES)
466 # Recreate Makefile by invoking config.status. Explicitly invoke the shell,
467 # because execution permission bits may not work on the current file system.
468 # Use @SHELL@, which is the shell determined by autoconf for the use by its
469 # scripts, not $(SHELL) which is hardwired to /bin/sh and may be deficient.
470 Makefile: Makefile.in.in Makevars $(top_builddir)/config.status @POMAKEFILEDEPS@
472 && @SHELL@ ./config.status $(subdir)/$@.in po-directories
476 # Tell versions [3.59,3.63) of GNU make not to export all variables.
477 # Otherwise a system limit (for SysV at least) may be exceeded.