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 = jeanfi@gmail.com
26 exec_prefix = ${prefix}
27 datarootdir = ${prefix}/share
28 datadir = ${datarootdir}
29 localedir = ${datarootdir}/locale
30 gettextsrcdir = $(datadir)/gettext/po
32 INSTALL = /usr/bin/install -c
33 INSTALL_DATA = ${INSTALL} -m 644
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 # ${SHELL} /home/jporsini/work/wpitchoune.net/svnpub/ppastats/trunk/install-sh does not start with $(SHELL), so we add it.
39 # In automake >= 1.10, /bin/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) ${SHELL} /home/jporsini/work/wpitchoune.net/svnpub/ppastats/trunk/install-sh -d
43 install_sh = $(SHELL) ${SHELL} /home/jporsini/work/wpitchoune.net/svnpub/ppastats/trunk/install-sh
44 MKDIR_P = /bin/mkdir -p
45 mkdir_p = /bin/mkdir -p
47 GMSGFMT_ = /usr/bin/msgfmt
48 GMSGFMT_no = /usr/bin/msgfmt
49 GMSGFMT_yes = /usr/bin/msgfmt
50 GMSGFMT = $(GMSGFMT_$(USE_MSGCTXT))
51 MSGFMT_ = /usr/bin/msgfmt
52 MSGFMT_no = /usr/bin/msgfmt
53 MSGFMT_yes = /usr/bin/msgfmt
54 MSGFMT = $(MSGFMT_$(USE_MSGCTXT))
55 XGETTEXT_ = /usr/bin/xgettext
56 XGETTEXT_no = /usr/bin/xgettext
57 XGETTEXT_yes = /usr/bin/xgettext
58 XGETTEXT = $(XGETTEXT_$(USE_MSGCTXT))
60 MSGMERGE_UPDATE = /usr/bin/msgmerge --update
67 UPDATEPOFILES = fr.po-update
69 DISTFILES.common = Makefile.in.in remove-potcdate.sin \
70 $(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
71 DISTFILES = $(DISTFILES.common) Makevars POTFILES.in \
72 $(POFILES) $(GMOFILES) \
73 $(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)
85 # Makevars gets inserted here. (Don't remove this line!)
86 # Makefile variables for PO directory in any package using GNU gettext.
88 # Usually the message domain is the same as the package name.
91 # These two variables depend on the location of this directory.
95 # These options get passed to xgettext.
96 XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
98 # This is the copyright holder that gets inserted into the header of the
99 # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
100 # package. (Note that the msgstr strings, extracted from the package's
101 # sources, belong to the copyright holder of the package.) Translators are
102 # expected to transfer the copyright for their translations to this person
103 # or entity, or to disclaim their copyright. The empty string stands for
104 # the public domain; in this case the translators are expected to disclaim
106 COPYRIGHT_HOLDER = Free Software Foundation, Inc.
108 # This is the email address or URL to which the translators shall report
109 # bugs in the untranslated strings:
110 # - Strings which are not entire sentences, see the maintainer guidelines
111 # in the GNU gettext documentation, section 'Preparing Strings'.
112 # - Strings which use unclear terms or require additional context to be
114 # - Strings which make invalid assumptions about notation of date, time or
116 # - Pluralisation problems.
117 # - Incorrect English spelling.
118 # - Incorrect formatting.
119 # It can be your email address, or a mailing list address where translators
120 # can write to without being subscribed, or the URL of a web page through
121 # which the translators can contact you.
124 # This is the list of locale categories, beyond LC_MESSAGES, for which the
125 # message catalogs shall be used. It is usually empty.
126 EXTRA_LOCALE_CATEGORIES =
129 .SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update
132 @echo "$(MSGFMT) -c -o $@ $<"; \
133 $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
136 @lang=`echo $* | sed -e 's,.*/,,'`; \
137 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
138 echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o $${lang}.gmo $${lang}.po"; \
139 cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
142 sed -e '/^#/d' $< > t-$@
146 all: check-macro-version all-yes
151 # Ensure that the gettext macros and this Makefile.in.in are in sync.
153 @test "$(GETTEXT_MACRO_VERSION)" = "0.18" \
154 || { echo "*** error: gettext infrastructure mismatch: using a Makefile.in.in from gettext version $(GETTEXT_MACRO_VERSION) but the autoconf macros are from gettext version 0.18" 1>&2; \
158 # $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no
159 # internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
160 # we don't want to bother translators with empty POT files). We assume that
161 # LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty.
162 # In this case, stamp-po is a nop (i.e. a phony target).
164 # stamp-po is a timestamp denoting the last time at which the CATALOGS have
165 # been loosely updated. Its purpose is that when a developer or translator
166 # checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
167 # "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
168 # invocations of "make" will do nothing. This timestamp would not be necessary
169 # if updating the $(CATALOGS) would always touch them; however, the rule for
170 # $(POFILES) has been designed to not touch files that don't need to be
172 stamp-po: $(srcdir)/$(DOMAIN).pot
173 test ! -f $(srcdir)/$(DOMAIN).pot || \
174 test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
175 @test ! -f $(srcdir)/$(DOMAIN).pot || { \
176 echo "touch stamp-po" && \
177 echo timestamp > stamp-poT && \
178 mv stamp-poT stamp-po; \
181 # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
182 # otherwise packages like GCC can not be built if only parts of the source
183 # have been downloaded.
185 # This target rebuilds $(DOMAIN).pot; it is an expensive operation.
186 # Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
187 $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
188 if LC_ALL=C grep 'GNU ppastats' $(top_srcdir)/* 2>/dev/null | grep -v 'libtool:' >/dev/null; then \
189 package_gnu='GNU '; \
193 if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \
194 msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
196 msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \
198 case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
199 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \
200 $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
201 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
202 --files-from=$(srcdir)/POTFILES.in \
203 --copyright-holder='$(COPYRIGHT_HOLDER)' \
204 --msgid-bugs-address="$$msgid_bugs_address" \
207 $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
208 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
209 --files-from=$(srcdir)/POTFILES.in \
210 --copyright-holder='$(COPYRIGHT_HOLDER)' \
211 --package-name="$${package_gnu}ppastats" \
212 --package-version='0.0.x' \
213 --msgid-bugs-address="$$msgid_bugs_address" \
216 test ! -f $(DOMAIN).po || { \
217 if test -f $(srcdir)/$(DOMAIN).pot; then \
218 sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
219 sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
220 if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
221 rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
223 rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
224 mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
227 mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
231 # This rule has no dependencies: we don't need to update $(DOMAIN).pot at
232 # every "make" invocation, only create it when it is missing.
233 # Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
234 $(srcdir)/$(DOMAIN).pot:
235 $(MAKE) $(DOMAIN).pot-update
237 # This target rebuilds a PO file if $(DOMAIN).pot has changed.
238 # Note that a PO file is not touched if it doesn't need to be changed.
239 $(POFILES): $(srcdir)/$(DOMAIN).pot
240 @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
241 if test -f "$(srcdir)/$${lang}.po"; then \
242 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
243 echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot"; \
245 && { case `$(MSGMERGE_UPDATE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
246 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
247 $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \
249 $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot;; \
253 $(MAKE) $${lang}.po-create; \
257 install: install-exec install-data
259 install-data: install-data-yes
260 if test "$(PACKAGE)" = "gettext-tools"; then \
261 $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
262 for file in $(DISTFILES.common) Makevars.template; do \
263 $(INSTALL_DATA) $(srcdir)/$$file \
264 $(DESTDIR)$(gettextsrcdir)/$$file; \
266 for file in Makevars; do \
267 rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
273 install-data-yes: all
274 @catalogs='$(CATALOGS)'; \
275 for cat in $$catalogs; do \
276 cat=`basename $$cat`; \
277 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
278 dir=$(localedir)/$$lang/LC_MESSAGES; \
279 $(mkdir_p) $(DESTDIR)$$dir; \
280 if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
281 $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
282 echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
283 for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
284 if test -n "$$lc"; then \
285 if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
286 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
287 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
288 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
289 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
291 if test -f $$file; then \
292 ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
295 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
297 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
300 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
301 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
304 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
305 ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
306 ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
307 cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
308 echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
313 install-strip: install
315 installdirs: installdirs-exec installdirs-data
317 installdirs-data: installdirs-data-yes
318 if test "$(PACKAGE)" = "gettext-tools"; then \
319 $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
324 installdirs-data-yes:
325 @catalogs='$(CATALOGS)'; \
326 for cat in $$catalogs; do \
327 cat=`basename $$cat`; \
328 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
329 dir=$(localedir)/$$lang/LC_MESSAGES; \
330 $(mkdir_p) $(DESTDIR)$$dir; \
331 for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
332 if test -n "$$lc"; then \
333 if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
334 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
335 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
336 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
337 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
339 if test -f $$file; then \
340 ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
343 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
345 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
348 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
349 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
356 # Define this as empty until I found a useful application.
359 uninstall: uninstall-exec uninstall-data
361 uninstall-data: uninstall-data-yes
362 if test "$(PACKAGE)" = "gettext-tools"; then \
363 for file in $(DISTFILES.common) Makevars.template; do \
364 rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
371 catalogs='$(CATALOGS)'; \
372 for cat in $$catalogs; do \
373 cat=`basename $$cat`; \
374 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
375 for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
376 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
382 info dvi ps pdf html tags TAGS ctags CTAGS ID:
385 rm -f remove-potcdate.sed
387 rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
393 rm -f Makefile Makefile.in POTFILES *.mo
395 maintainer-clean: distclean
396 @echo "This command is intended for maintainers to use;"
397 @echo "it deletes files that may require special tools to rebuild."
398 rm -f stamp-po $(GMOFILES)
400 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
404 # This is a separate target because 'update-po' must be executed before.
405 dist2: stamp-po $(DISTFILES)
406 dists="$(DISTFILES)"; \
407 if test "$(PACKAGE)" = "gettext-tools"; then \
408 dists="$$dists Makevars.template"; \
410 if test -f $(srcdir)/$(DOMAIN).pot; then \
411 dists="$$dists $(DOMAIN).pot stamp-po"; \
413 if test -f $(srcdir)/ChangeLog; then \
414 dists="$$dists ChangeLog"; \
416 for i in 0 1 2 3 4 5 6 7 8 9; do \
417 if test -f $(srcdir)/ChangeLog.$$i; then \
418 dists="$$dists ChangeLog.$$i"; \
421 if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
422 for file in $$dists; do \
423 if test -f $$file; then \
424 cp -p $$file $(distdir) || exit 1; \
426 cp -p $(srcdir)/$$file $(distdir) || exit 1; \
431 $(MAKE) $(DOMAIN).pot-update
432 test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
435 # General rule for creating PO files.
438 @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
439 echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
442 # General rule for updating PO files.
445 @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
446 if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \
449 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
450 echo "$${cdcmd}$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
452 if { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
453 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
454 $(MSGMERGE) $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
456 $(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
459 if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
460 rm -f $$tmpdir/$$lang.new.po; \
462 if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
465 echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
470 echo "msgmerge for $$lang.po failed!" 1>&2; \
471 rm -f $$tmpdir/$$lang.new.po; \
476 update-gmo: Makefile $(GMOFILES)
479 # Recreate Makefile by invoking config.status. Explicitly invoke the shell,
480 # because execution permission bits may not work on the current file system.
481 # Use /bin/bash, which is the shell determined by autoconf for the use by its
482 # scripts, not $(SHELL) which is hardwired to /bin/sh and may be deficient.
483 Makefile: Makefile.in.in Makevars $(top_builddir)/config.status POTFILES.in LINGUAS
485 && /bin/bash ./config.status $(subdir)/$@.in po-directories
489 # Tell versions [3.59,3.63) of GNU make not to export all variables.
490 # Otherwise a system limit (for SysV at least) may be exceeded.
492 # Special Makefile rules for English message catalogs with quotation marks.
494 DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot
496 .SUFFIXES: .insert-header .po-update-en
499 $(MAKE) en@quot.po-update
500 en@boldquot.po-create:
501 $(MAKE) en@boldquot.po-update
503 en@quot.po-update: en@quot.po-update-en
504 en@boldquot.po-update: en@boldquot.po-update-en
506 .insert-header.po-update-en:
507 @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \
508 if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \
511 ll=`echo $$lang | sed -e 's/@.*//'`; \
512 LC_ALL=C; export LC_ALL; \
514 if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$lang -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \
515 if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
516 rm -f $$tmpdir/$$lang.new.po; \
518 if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
521 echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
526 echo "creation of $$lang.po failed!" 1>&2; \
527 rm -f $$tmpdir/$$lang.new.po; \
530 en@quot.insert-header: insert-header.sin
531 sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header
533 en@boldquot.insert-header: insert-header.sin
534 sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header
536 mostlyclean: mostlyclean-quot
538 rm -f *.insert-header