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)
80 # Makevars gets inserted here. (Don't remove this line!)
81 # Makefile variables for PO directory in any package using GNU gettext.
83 # Usually the message domain is the same as the package name.
86 # These two variables depend on the location of this directory.
90 # These options get passed to xgettext.
91 XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
93 # This is the copyright holder that gets inserted into the header of the
94 # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
95 # package. (Note that the msgstr strings, extracted from the package's
96 # sources, belong to the copyright holder of the package.) Translators are
97 # expected to transfer the copyright for their translations to this person
98 # or entity, or to disclaim their copyright. The empty string stands for
99 # the public domain; in this case the translators are expected to disclaim
101 COPYRIGHT_HOLDER = Free Software Foundation, Inc.
103 # This is the email address or URL to which the translators shall report
104 # bugs in the untranslated strings:
105 # - Strings which are not entire sentences, see the maintainer guidelines
106 # in the GNU gettext documentation, section 'Preparing Strings'.
107 # - Strings which use unclear terms or require additional context to be
109 # - Strings which make invalid assumptions about notation of date, time or
111 # - Pluralisation problems.
112 # - Incorrect English spelling.
113 # - Incorrect formatting.
114 # It can be your email address, or a mailing list address where translators
115 # can write to without being subscribed, or the URL of a web page through
116 # which the translators can contact you.
119 # This is the list of locale categories, beyond LC_MESSAGES, for which the
120 # message catalogs shall be used. It is usually empty.
121 EXTRA_LOCALE_CATEGORIES =
124 .SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update
127 @echo "$(MSGFMT) -c -o $@ $<"; \
128 $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
131 @lang=`echo $* | sed -e 's,.*/,,'`; \
132 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
133 echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o $${lang}.gmo $${lang}.po"; \
134 cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
137 sed -e '/^#/d' $< > t-$@
141 all: check-macro-version all-yes
146 # Ensure that the gettext macros and this Makefile.in.in are in sync.
148 @test "$(GETTEXT_MACRO_VERSION)" = "0.18" \
149 || { 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; \
153 # $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no
154 # internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
155 # we don't want to bother translators with empty POT files). We assume that
156 # LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty.
157 # In this case, stamp-po is a nop (i.e. a phony target).
159 # stamp-po is a timestamp denoting the last time at which the CATALOGS have
160 # been loosely updated. Its purpose is that when a developer or translator
161 # checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
162 # "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
163 # invocations of "make" will do nothing. This timestamp would not be necessary
164 # if updating the $(CATALOGS) would always touch them; however, the rule for
165 # $(POFILES) has been designed to not touch files that don't need to be
167 stamp-po: $(srcdir)/$(DOMAIN).pot
168 test ! -f $(srcdir)/$(DOMAIN).pot || \
169 test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
170 @test ! -f $(srcdir)/$(DOMAIN).pot || { \
171 echo "touch stamp-po" && \
172 echo timestamp > stamp-poT && \
173 mv stamp-poT stamp-po; \
176 # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
177 # otherwise packages like GCC can not be built if only parts of the source
178 # have been downloaded.
180 # This target rebuilds $(DOMAIN).pot; it is an expensive operation.
181 # Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
182 $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
183 if LC_ALL=C grep 'GNU ppastats' $(top_srcdir)/* 2>/dev/null | grep -v 'libtool:' >/dev/null; then \
184 package_gnu='GNU '; \
188 if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \
189 msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
191 msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \
193 case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
194 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \
195 $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
196 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
197 --files-from=$(srcdir)/POTFILES.in \
198 --copyright-holder='$(COPYRIGHT_HOLDER)' \
199 --msgid-bugs-address="$$msgid_bugs_address" \
202 $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
203 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
204 --files-from=$(srcdir)/POTFILES.in \
205 --copyright-holder='$(COPYRIGHT_HOLDER)' \
206 --package-name="$${package_gnu}ppastats" \
207 --package-version='0.0.x' \
208 --msgid-bugs-address="$$msgid_bugs_address" \
211 test ! -f $(DOMAIN).po || { \
212 if test -f $(srcdir)/$(DOMAIN).pot; then \
213 sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
214 sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
215 if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
216 rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
218 rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
219 mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
222 mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
226 # This rule has no dependencies: we don't need to update $(DOMAIN).pot at
227 # every "make" invocation, only create it when it is missing.
228 # Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
229 $(srcdir)/$(DOMAIN).pot:
230 $(MAKE) $(DOMAIN).pot-update
232 # This target rebuilds a PO file if $(DOMAIN).pot has changed.
233 # Note that a PO file is not touched if it doesn't need to be changed.
234 $(POFILES): $(srcdir)/$(DOMAIN).pot
235 @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
236 if test -f "$(srcdir)/$${lang}.po"; then \
237 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
238 echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot"; \
240 && { case `$(MSGMERGE_UPDATE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
241 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
242 $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \
244 $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot;; \
248 $(MAKE) $${lang}.po-create; \
252 install: install-exec install-data
254 install-data: install-data-yes
255 if test "$(PACKAGE)" = "gettext-tools"; then \
256 $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
257 for file in $(DISTFILES.common) Makevars.template; do \
258 $(INSTALL_DATA) $(srcdir)/$$file \
259 $(DESTDIR)$(gettextsrcdir)/$$file; \
261 for file in Makevars; do \
262 rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
268 install-data-yes: all
269 @catalogs='$(CATALOGS)'; \
270 for cat in $$catalogs; do \
271 cat=`basename $$cat`; \
272 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
273 dir=$(localedir)/$$lang/LC_MESSAGES; \
274 $(mkdir_p) $(DESTDIR)$$dir; \
275 if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
276 $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
277 echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
278 for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
279 if test -n "$$lc"; then \
280 if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
281 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
282 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
283 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
284 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
286 if test -f $$file; then \
287 ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
290 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
292 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
295 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
296 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
299 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
300 ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
301 ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
302 cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
303 echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
308 install-strip: install
310 installdirs: installdirs-exec installdirs-data
312 installdirs-data: installdirs-data-yes
313 if test "$(PACKAGE)" = "gettext-tools"; then \
314 $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
319 installdirs-data-yes:
320 @catalogs='$(CATALOGS)'; \
321 for cat in $$catalogs; do \
322 cat=`basename $$cat`; \
323 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
324 dir=$(localedir)/$$lang/LC_MESSAGES; \
325 $(mkdir_p) $(DESTDIR)$$dir; \
326 for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
327 if test -n "$$lc"; then \
328 if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
329 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
330 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
331 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
332 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
334 if test -f $$file; then \
335 ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
338 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
340 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
343 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
344 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
351 # Define this as empty until I found a useful application.
354 uninstall: uninstall-exec uninstall-data
356 uninstall-data: uninstall-data-yes
357 if test "$(PACKAGE)" = "gettext-tools"; then \
358 for file in $(DISTFILES.common) Makevars.template; do \
359 rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
366 catalogs='$(CATALOGS)'; \
367 for cat in $$catalogs; do \
368 cat=`basename $$cat`; \
369 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
370 for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
371 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
377 info dvi ps pdf html tags TAGS ctags CTAGS ID:
380 rm -f remove-potcdate.sed
382 rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
388 rm -f Makefile Makefile.in POTFILES *.mo
390 maintainer-clean: distclean
391 @echo "This command is intended for maintainers to use;"
392 @echo "it deletes files that may require special tools to rebuild."
393 rm -f stamp-po $(GMOFILES)
395 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
399 # This is a separate target because 'update-po' must be executed before.
400 dist2: stamp-po $(DISTFILES)
401 dists="$(DISTFILES)"; \
402 if test "$(PACKAGE)" = "gettext-tools"; then \
403 dists="$$dists Makevars.template"; \
405 if test -f $(srcdir)/$(DOMAIN).pot; then \
406 dists="$$dists $(DOMAIN).pot stamp-po"; \
408 if test -f $(srcdir)/ChangeLog; then \
409 dists="$$dists ChangeLog"; \
411 for i in 0 1 2 3 4 5 6 7 8 9; do \
412 if test -f $(srcdir)/ChangeLog.$$i; then \
413 dists="$$dists ChangeLog.$$i"; \
416 if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
417 for file in $$dists; do \
418 if test -f $$file; then \
419 cp -p $$file $(distdir) || exit 1; \
421 cp -p $(srcdir)/$$file $(distdir) || exit 1; \
426 $(MAKE) $(DOMAIN).pot-update
427 test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
430 # General rule for creating PO files.
433 @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
434 echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
437 # General rule for updating PO files.
440 @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
441 if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \
444 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
445 echo "$${cdcmd}$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
447 if { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
448 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
449 $(MSGMERGE) $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
451 $(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
454 if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
455 rm -f $$tmpdir/$$lang.new.po; \
457 if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
460 echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
465 echo "msgmerge for $$lang.po failed!" 1>&2; \
466 rm -f $$tmpdir/$$lang.new.po; \
471 update-gmo: Makefile $(GMOFILES)
474 # Recreate Makefile by invoking config.status. Explicitly invoke the shell,
475 # because execution permission bits may not work on the current file system.
476 # Use /bin/bash, which is the shell determined by autoconf for the use by its
477 # scripts, not $(SHELL) which is hardwired to /bin/sh and may be deficient.
478 Makefile: Makefile.in.in Makevars $(top_builddir)/config.status POTFILES.in LINGUAS
480 && /bin/bash ./config.status $(subdir)/$@.in po-directories
484 # Tell versions [3.59,3.63) of GNU make not to export all variables.
485 # Otherwise a system limit (for SysV at least) may be exceeded.
487 # Special Makefile rules for English message catalogs with quotation marks.
489 DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot
491 .SUFFIXES: .insert-header .po-update-en
494 $(MAKE) en@quot.po-update
495 en@boldquot.po-create:
496 $(MAKE) en@boldquot.po-update
498 en@quot.po-update: en@quot.po-update-en
499 en@boldquot.po-update: en@boldquot.po-update-en
501 .insert-header.po-update-en:
502 @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \
503 if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \
506 ll=`echo $$lang | sed -e 's/@.*//'`; \
507 LC_ALL=C; export LC_ALL; \
509 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 \
510 if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
511 rm -f $$tmpdir/$$lang.new.po; \
513 if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
516 echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
521 echo "creation of $$lang.po failed!" 1>&2; \
522 rm -f $$tmpdir/$$lang.new.po; \
525 en@quot.insert-header: insert-header.sin
526 sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header
528 en@boldquot.insert-header: insert-header.sin
529 sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header
531 mostlyclean: mostlyclean-quot
533 rm -f *.insert-header