1 # Makefile for PO directory in any package using GNU gettext.
2 # Copyright (C) 1995-1997, 2000-2005 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.14.4
15 PACKAGE_BUGREPORT = stsp
25 exec_prefix = ${prefix}
26 datadir = ${prefix}/share
27 localedir = $(datadir)/locale
28 gettextsrcdir = $(datadir)/gettext/po
30 INSTALL = /usr/bin/install -c
31 INSTALL_DATA = ${INSTALL} -m 644
32 MKINSTALLDIRS = $(top_builddir)/./mkinstalldirs
33 mkinstalldirs = $(SHELL) $(MKINSTALLDIRS)
35 GMSGFMT = /usr/bin/msgfmt
36 MSGFMT = /usr/bin/msgfmt
37 XGETTEXT = /usr/bin/xgettext
39 MSGMERGE_UPDATE = /usr/bin/msgmerge --update
48 DISTFILES.common = Makefile.in.in remove-potcdate.sin \
49 $(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
50 DISTFILES = $(DISTFILES.common) Makevars POTFILES.in \
51 $(POFILES) $(GMOFILES) \
52 $(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)
58 # Makevars gets inserted here. (Don't remove this line!)
59 # Makefile variables for PO directory in any package using GNU gettext.
61 # Usually the message domain is the same as the package name.
64 # These two variables depend on the location of this directory.
68 # These options get passed to xgettext.
69 XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
71 # This is the copyright holder that gets inserted into the header of the
72 # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
73 # package. (Note that the msgstr strings, extracted from the package's
74 # sources, belong to the copyright holder of the package.) Translators are
75 # expected to transfer the copyright for their translations to this person
76 # or entity, or to disclaim their copyright. The empty string stands for
77 # the public domain; in this case the translators are expected to disclaim
79 COPYRIGHT_HOLDER = Free Software Foundation, Inc.
81 # This is the email address or URL to which the translators shall report
82 # bugs in the untranslated strings:
83 # - Strings which are not entire sentences, see the maintainer guidelines
84 # in the GNU gettext documentation, section 'Preparing Strings'.
85 # - Strings which use unclear terms or require additional context to be
87 # - Strings which make invalid assumptions about notation of date, time or
89 # - Pluralisation problems.
90 # - Incorrect English spelling.
91 # - Incorrect formatting.
92 # It can be your email address, or a mailing list address where translators
93 # can write to without being subscribed, or the URL of a web page through
94 # which the translators can contact you.
97 # This is the list of locale categories, beyond LC_MESSAGES, for which the
98 # message catalogs shall be used. It is usually empty.
99 EXTRA_LOCALE_CATEGORIES =
102 .SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update
105 @echo "$(MSGFMT) -c -o $@ $<"; \
106 $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
109 @lang=`echo $* | sed -e 's,.*/,,'`; \
110 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
111 echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
112 cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
115 sed -e '/^#/d' $< > t-$@
124 # $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no
125 # internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
126 # we don't want to bother translators with empty POT files). We assume that
127 # LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty.
128 # In this case, stamp-po is a nop (i.e. a phony target).
130 # stamp-po is a timestamp denoting the last time at which the CATALOGS have
131 # been loosely updated. Its purpose is that when a developer or translator
132 # checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
133 # "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
134 # invocations of "make" will do nothing. This timestamp would not be necessary
135 # if updating the $(CATALOGS) would always touch them; however, the rule for
136 # $(POFILES) has been designed to not touch files that don't need to be
138 stamp-po: $(srcdir)/$(DOMAIN).pot
139 test ! -f $(srcdir)/$(DOMAIN).pot || \
140 test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
141 @test ! -f $(srcdir)/$(DOMAIN).pot || { \
142 echo "touch stamp-po" && \
143 echo timestamp > stamp-poT && \
144 mv stamp-poT stamp-po; \
147 # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
148 # otherwise packages like GCC can not be built if only parts of the source
149 # have been downloaded.
151 # This target rebuilds $(DOMAIN).pot; it is an expensive operation.
152 # Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
153 $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
154 if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \
155 msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
157 msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \
159 $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
160 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
161 --files-from=$(srcdir)/POTFILES.in \
162 --copyright-holder='$(COPYRIGHT_HOLDER)' \
163 --msgid-bugs-address="$$msgid_bugs_address"
164 test ! -f $(DOMAIN).po || { \
165 if test -f $(srcdir)/$(DOMAIN).pot; then \
166 sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
167 sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
168 if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
169 rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
171 rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
172 mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
175 mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
179 # This rule has no dependencies: we don't need to update $(DOMAIN).pot at
180 # every "make" invocation, only create it when it is missing.
181 # Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
182 $(srcdir)/$(DOMAIN).pot:
183 $(MAKE) $(DOMAIN).pot-update
185 # This target rebuilds a PO file if $(DOMAIN).pot has changed.
186 # Note that a PO file is not touched if it doesn't need to be changed.
187 $(POFILES): $(srcdir)/$(DOMAIN).pot
188 @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
189 if test -f "$(srcdir)/$${lang}.po"; then \
190 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
191 echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
192 cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \
194 $(MAKE) $${lang}.po-create; \
198 install: install-exec install-data
200 install-data: install-data-yes
201 if test "$(PACKAGE)" = "gettext-tools"; then \
202 $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
203 for file in $(DISTFILES.common) Makevars.template; do \
204 $(INSTALL_DATA) $(srcdir)/$$file \
205 $(DESTDIR)$(gettextsrcdir)/$$file; \
207 for file in Makevars; do \
208 rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
214 install-data-yes: all
215 $(mkinstalldirs) $(DESTDIR)$(datadir)
216 @catalogs='$(CATALOGS)'; \
217 for cat in $$catalogs; do \
218 cat=`basename $$cat`; \
219 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
220 dir=$(localedir)/$$lang/LC_MESSAGES; \
221 $(mkinstalldirs) $(DESTDIR)$$dir; \
222 if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
223 $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
224 echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
225 for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
226 if test -n "$$lc"; then \
227 if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
228 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
229 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
230 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
231 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
233 if test -f $$file; then \
234 ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
237 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
239 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
242 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
243 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
246 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
247 ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
248 ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
249 cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
250 echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
255 install-strip: install
257 installdirs: installdirs-exec installdirs-data
259 installdirs-data: installdirs-data-yes
260 if test "$(PACKAGE)" = "gettext-tools"; then \
261 $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
266 installdirs-data-yes:
267 $(mkinstalldirs) $(DESTDIR)$(datadir)
268 @catalogs='$(CATALOGS)'; \
269 for cat in $$catalogs; do \
270 cat=`basename $$cat`; \
271 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
272 dir=$(localedir)/$$lang/LC_MESSAGES; \
273 $(mkinstalldirs) $(DESTDIR)$$dir; \
274 for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
275 if test -n "$$lc"; then \
276 if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
277 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
278 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
279 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
280 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
282 if test -f $$file; then \
283 ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
286 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
288 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
291 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
292 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
299 # Define this as empty until I found a useful application.
302 uninstall: uninstall-exec uninstall-data
304 uninstall-data: uninstall-data-yes
305 if test "$(PACKAGE)" = "gettext-tools"; then \
306 for file in $(DISTFILES.common) Makevars.template; do \
307 rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
314 catalogs='$(CATALOGS)'; \
315 for cat in $$catalogs; do \
316 cat=`basename $$cat`; \
317 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
318 for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
319 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
325 info dvi ps pdf html tags TAGS ctags CTAGS ID:
328 rm -f remove-potcdate.sed
330 rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
336 rm -f Makefile Makefile.in POTFILES *.mo
338 maintainer-clean: distclean
339 @echo "This command is intended for maintainers to use;"
340 @echo "it deletes files that may require special tools to rebuild."
341 rm -f stamp-po $(GMOFILES)
343 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
347 # This is a separate target because 'update-po' must be executed before.
348 dist2: stamp-po $(DISTFILES)
349 dists="$(DISTFILES)"; \
350 if test "$(PACKAGE)" = "gettext-tools"; then \
351 dists="$$dists Makevars.template"; \
353 if test -f $(srcdir)/$(DOMAIN).pot; then \
354 dists="$$dists $(DOMAIN).pot stamp-po"; \
356 if test -f $(srcdir)/ChangeLog; then \
357 dists="$$dists ChangeLog"; \
359 for i in 0 1 2 3 4 5 6 7 8 9; do \
360 if test -f $(srcdir)/ChangeLog.$$i; then \
361 dists="$$dists ChangeLog.$$i"; \
364 if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
365 for file in $$dists; do \
366 if test -f $$file; then \
367 cp -p $$file $(distdir) || exit 1; \
369 cp -p $(srcdir)/$$file $(distdir) || exit 1; \
374 $(MAKE) $(DOMAIN).pot-update
375 test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
378 # General rule for creating PO files.
381 @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
382 echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
385 # General rule for updating PO files.
388 @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
389 if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \
392 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
393 echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
395 if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
396 if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
397 rm -f $$tmpdir/$$lang.new.po; \
399 if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
402 echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
407 echo "msgmerge for $$lang.po failed!" 1>&2; \
408 rm -f $$tmpdir/$$lang.new.po; \
413 update-gmo: Makefile $(GMOFILES)
416 Makefile: Makefile.in.in Makevars $(top_builddir)/config.status POTFILES.in
418 && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
419 $(SHELL) ./config.status
423 # Tell versions [3.59,3.63) of GNU make not to export all variables.
424 # Otherwise a system limit (for SysV at least) may be exceeded.
426 # Special Makefile rules for English message catalogs with quotation marks.
428 DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot
430 .SUFFIXES: .insert-header .po-update-en
433 $(MAKE) en@quot.po-update
434 en@boldquot.po-create:
435 $(MAKE) en@boldquot.po-update
437 en@quot.po-update: en@quot.po-update-en
438 en@boldquot.po-update: en@boldquot.po-update-en
440 .insert-header.po-update-en:
441 @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \
442 if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \
445 ll=`echo $$lang | sed -e 's/@.*//'`; \
446 LC_ALL=C; export LC_ALL; \
448 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 \
449 if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
450 rm -f $$tmpdir/$$lang.new.po; \
452 if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
455 echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
460 echo "creation of $$lang.po failed!" 1>&2; \
461 rm -f $$tmpdir/$$lang.new.po; \
464 en@quot.insert-header: insert-header.sin
465 sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header
467 en@boldquot.insert-header: insert-header.sin
468 sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header
470 mostlyclean: mostlyclean-quot
472 rm -f *.insert-header