1 # Makefile for PO directory in any package using GNU gettext.
2 # Copyright (C) 1995-1997, 2000-2006 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.16
15 PACKAGE_BUGREPORT = jeanfi@gmail.com
25 exec_prefix = ${prefix}
26 datarootdir = ${prefix}/share
27 datadir = ${datarootdir}
28 localedir = ${datarootdir}/locale
29 gettextsrcdir = $(datadir)/gettext/po
31 INSTALL = /usr/bin/install -c
32 INSTALL_DATA = ${INSTALL} -m 644
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 # ${SHELL} /home/jporsini/work/wpitchoune/svnpub/prss/trunk/install-sh does not start with $(SHELL), so we add it.
38 # In automake >= 1.10, /bin/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) ${SHELL} /home/jporsini/work/wpitchoune/svnpub/prss/trunk/install-sh -d
42 install_sh = $(SHELL) ${SHELL} /home/jporsini/work/wpitchoune/svnpub/prss/trunk/install-sh
43 MKDIR_P = /bin/mkdir -p
44 mkdir_p = /bin/mkdir -p
46 GMSGFMT_ = /usr/bin/msgfmt
47 GMSGFMT_no = /usr/bin/msgfmt
48 GMSGFMT_yes = /usr/bin/msgfmt
49 GMSGFMT = $(GMSGFMT_$(USE_MSGCTXT))
50 MSGFMT_ = /usr/bin/msgfmt
51 MSGFMT_no = /usr/bin/msgfmt
52 MSGFMT_yes = /usr/bin/msgfmt
53 MSGFMT = $(MSGFMT_$(USE_MSGCTXT))
54 XGETTEXT_ = /usr/bin/xgettext
55 XGETTEXT_no = /usr/bin/xgettext
56 XGETTEXT_yes = /usr/bin/xgettext
57 XGETTEXT = $(XGETTEXT_$(USE_MSGCTXT))
59 MSGMERGE_UPDATE = /usr/bin/msgmerge --update
66 UPDATEPOFILES = fr.po-update
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)
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 -o $${lang}.gmo $${lang}.po"; \
134 cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
137 sed -e '/^#/d' $< > t-$@
146 # $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no
147 # internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
148 # we don't want to bother translators with empty POT files). We assume that
149 # LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty.
150 # In this case, stamp-po is a nop (i.e. a phony target).
152 # stamp-po is a timestamp denoting the last time at which the CATALOGS have
153 # been loosely updated. Its purpose is that when a developer or translator
154 # checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
155 # "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
156 # invocations of "make" will do nothing. This timestamp would not be necessary
157 # if updating the $(CATALOGS) would always touch them; however, the rule for
158 # $(POFILES) has been designed to not touch files that don't need to be
160 stamp-po: $(srcdir)/$(DOMAIN).pot
161 test ! -f $(srcdir)/$(DOMAIN).pot || \
162 test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
163 @test ! -f $(srcdir)/$(DOMAIN).pot || { \
164 echo "touch stamp-po" && \
165 echo timestamp > stamp-poT && \
166 mv stamp-poT stamp-po; \
169 # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
170 # otherwise packages like GCC can not be built if only parts of the source
171 # have been downloaded.
173 # This target rebuilds $(DOMAIN).pot; it is an expensive operation.
174 # Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
175 $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
176 if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \
177 msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
179 msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \
181 $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
182 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
183 --files-from=$(srcdir)/POTFILES.in \
184 --copyright-holder='$(COPYRIGHT_HOLDER)' \
185 --msgid-bugs-address="$$msgid_bugs_address"
186 test ! -f $(DOMAIN).po || { \
187 if test -f $(srcdir)/$(DOMAIN).pot; then \
188 sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
189 sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
190 if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
191 rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
193 rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
194 mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
197 mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
201 # This rule has no dependencies: we don't need to update $(DOMAIN).pot at
202 # every "make" invocation, only create it when it is missing.
203 # Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
204 $(srcdir)/$(DOMAIN).pot:
205 $(MAKE) $(DOMAIN).pot-update
207 # This target rebuilds a PO file if $(DOMAIN).pot has changed.
208 # Note that a PO file is not touched if it doesn't need to be changed.
209 $(POFILES): $(srcdir)/$(DOMAIN).pot
210 @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
211 if test -f "$(srcdir)/$${lang}.po"; then \
212 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
213 echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
214 cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \
216 $(MAKE) $${lang}.po-create; \
220 install: install-exec install-data
222 install-data: install-data-yes
223 if test "$(PACKAGE)" = "gettext-tools"; then \
224 $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
225 for file in $(DISTFILES.common) Makevars.template; do \
226 $(INSTALL_DATA) $(srcdir)/$$file \
227 $(DESTDIR)$(gettextsrcdir)/$$file; \
229 for file in Makevars; do \
230 rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
236 install-data-yes: all
237 $(mkdir_p) $(DESTDIR)$(datadir)
238 @catalogs='$(CATALOGS)'; \
239 for cat in $$catalogs; do \
240 cat=`basename $$cat`; \
241 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
242 dir=$(localedir)/$$lang/LC_MESSAGES; \
243 $(mkdir_p) $(DESTDIR)$$dir; \
244 if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
245 $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
246 echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
247 for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
248 if test -n "$$lc"; then \
249 if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
250 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
251 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
252 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
253 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
255 if test -f $$file; then \
256 ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
259 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
261 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
264 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
265 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
268 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
269 ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
270 ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
271 cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
272 echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
277 install-strip: install
279 installdirs: installdirs-exec installdirs-data
281 installdirs-data: installdirs-data-yes
282 if test "$(PACKAGE)" = "gettext-tools"; then \
283 $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
288 installdirs-data-yes:
289 $(mkdir_p) $(DESTDIR)$(datadir)
290 @catalogs='$(CATALOGS)'; \
291 for cat in $$catalogs; do \
292 cat=`basename $$cat`; \
293 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
294 dir=$(localedir)/$$lang/LC_MESSAGES; \
295 $(mkdir_p) $(DESTDIR)$$dir; \
296 for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
297 if test -n "$$lc"; then \
298 if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
299 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
300 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
301 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
302 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
304 if test -f $$file; then \
305 ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
308 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
310 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
313 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
314 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
321 # Define this as empty until I found a useful application.
324 uninstall: uninstall-exec uninstall-data
326 uninstall-data: uninstall-data-yes
327 if test "$(PACKAGE)" = "gettext-tools"; then \
328 for file in $(DISTFILES.common) Makevars.template; do \
329 rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
336 catalogs='$(CATALOGS)'; \
337 for cat in $$catalogs; do \
338 cat=`basename $$cat`; \
339 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
340 for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
341 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
347 info dvi ps pdf html tags TAGS ctags CTAGS ID:
350 rm -f remove-potcdate.sed
352 rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
358 rm -f Makefile Makefile.in POTFILES *.mo
360 maintainer-clean: distclean
361 @echo "This command is intended for maintainers to use;"
362 @echo "it deletes files that may require special tools to rebuild."
363 rm -f stamp-po $(GMOFILES)
365 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
369 # This is a separate target because 'update-po' must be executed before.
370 dist2: stamp-po $(DISTFILES)
371 dists="$(DISTFILES)"; \
372 if test "$(PACKAGE)" = "gettext-tools"; then \
373 dists="$$dists Makevars.template"; \
375 if test -f $(srcdir)/$(DOMAIN).pot; then \
376 dists="$$dists $(DOMAIN).pot stamp-po"; \
378 if test -f $(srcdir)/ChangeLog; then \
379 dists="$$dists ChangeLog"; \
381 for i in 0 1 2 3 4 5 6 7 8 9; do \
382 if test -f $(srcdir)/ChangeLog.$$i; then \
383 dists="$$dists ChangeLog.$$i"; \
386 if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
387 for file in $$dists; do \
388 if test -f $$file; then \
389 cp -p $$file $(distdir) || exit 1; \
391 cp -p $(srcdir)/$$file $(distdir) || exit 1; \
396 $(MAKE) $(DOMAIN).pot-update
397 test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
400 # General rule for creating PO files.
403 @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
404 echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
407 # General rule for updating PO files.
410 @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
411 if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \
414 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
415 echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
417 if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
418 if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
419 rm -f $$tmpdir/$$lang.new.po; \
421 if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
424 echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
429 echo "msgmerge for $$lang.po failed!" 1>&2; \
430 rm -f $$tmpdir/$$lang.new.po; \
435 update-gmo: Makefile $(GMOFILES)
438 Makefile: Makefile.in.in Makevars $(top_builddir)/config.status POTFILES.in LINGUAS
440 && $(SHELL) ./config.status $(subdir)/$@.in po-directories
444 # Tell versions [3.59,3.63) of GNU make not to export all variables.
445 # Otherwise a system limit (for SysV at least) may be exceeded.
447 # Special Makefile rules for English message catalogs with quotation marks.
449 DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot
451 .SUFFIXES: .insert-header .po-update-en
454 $(MAKE) en@quot.po-update
455 en@boldquot.po-create:
456 $(MAKE) en@boldquot.po-update
458 en@quot.po-update: en@quot.po-update-en
459 en@boldquot.po-update: en@boldquot.po-update-en
461 .insert-header.po-update-en:
462 @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \
463 if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \
466 ll=`echo $$lang | sed -e 's/@.*//'`; \
467 LC_ALL=C; export LC_ALL; \
469 if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$ll -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 \
470 if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
471 rm -f $$tmpdir/$$lang.new.po; \
473 if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
476 echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
481 echo "creation of $$lang.po failed!" 1>&2; \
482 rm -f $$tmpdir/$$lang.new.po; \
485 en@quot.insert-header: insert-header.sin
486 sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header
488 en@boldquot.insert-header: insert-header.sin
489 sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header
491 mostlyclean: mostlyclean-quot
493 rm -f *.insert-header