1
# Example for use of GNU gettext.
2
# Copyright (C) 2003-2004 Free Software Foundation, Inc.
3
# This file is in the public domain.
5
# Makefile configuration - processed by automake.
7
# List of files which contain translatable strings.
11
# Usually the message domain is the same as the package name.
14
# These options get passed to xgettext.
17
# This is the copyright holder that gets inserted into the header of the
18
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
19
# package. (Note that the msgstr strings, extracted from the package's
20
# sources, belong to the copyright holder of the package.) Translators are
21
# expected to transfer the copyright for their translations to this person
22
# or entity, or to disclaim their copyright. The empty string stands for
23
# the public domain; in this case the translators are expected to disclaim
25
COPYRIGHT_HOLDER = Yoyodyne, Inc.
27
# This is the email address or URL to which the translators shall report
28
# bugs in the untranslated strings:
29
# - Strings which are not entire sentences, see the maintainer guidelines
30
# in the GNU gettext documentation, section 'Preparing Strings'.
31
# - Strings which use unclear terms or require additional context to be
33
# - Strings which make invalid assumptions about notation of date, time or
35
# - Pluralisation problems.
36
# - Incorrect English spelling.
37
# - Incorrect formatting.
38
# It can be your email address, or a mailing list address where translators
39
# can write to without being subscribed, or the URL of a web page through
40
# which the translators can contact you.
41
MSGID_BUGS_ADDRESS = bug-gnu-gettext@gnu.org
43
# This is the list of locale categories, beyond LC_MESSAGES, for which the
44
# message catalogs shall be used. It is usually empty.
45
EXTRA_LOCALE_CATEGORIES =
47
localedir = $(datadir)/locale
50
MSGMERGE_UPDATE = @MSGMERGE@ --update
55
# This is computed as $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
56
POTFILES_DEPS = @POTFILES_DEPS@
58
# This is computed as $(foreach lang, $(LINGUAS), $(srcdir)/$(lang).po)
60
# This is computed as $(foreach lang, $(LINGUAS), $(srcdir)/$(lang).gmo)
62
# This is computed as $(foreach lang, $(LINGUAS), $(lang).po-update)
63
UPDATEPOFILES = @UPDATEPOFILES@
64
# This is computed as $(foreach lang, $(LINGUAS), $(lang).nop)
65
DUMMYPOFILES = @DUMMYPOFILES@
68
# $(foreach lang, user-specified subset of $(LINGUAS), $(lang).gmo)
71
SUFFIXES = .po .gmo .mo .sed .sin .nop .po-create .po-update
74
@echo "$(MSGFMT) -c -o $@ $<"; \
75
$(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
78
@lang=`echo $* | sed -e 's,.*/,,'`; \
79
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
80
echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
81
cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
84
sed -e '/^#/d' $< > t-$@
88
all-local: all-local-@USE_NLS@
90
all-local-yes: stamp-po
93
# stamp-po is a timestamp denoting the last time at which the CATALOGS have
94
# been loosely updated. Its purpose is that when a developer or translator
95
# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
96
# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
97
# invocations of "make" will do nothing. This timestamp would not be necessary
98
# if updating the $(CATALOGS) would always touch them; however, the rule for
99
# $(POFILES) has been designed to not touch files that don't need to be
101
stamp-po: $(srcdir)/$(DOMAIN).pot
102
test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
103
@echo "touch stamp-po"
104
@echo timestamp > stamp-poT
105
@mv stamp-poT stamp-po
107
# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
108
# otherwise packages like GCC can not be built if only parts of the source
109
# have been downloaded.
111
# This target rebuilds $(DOMAIN).pot; it is an expensive operation.
112
# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
113
$(DOMAIN).pot-update: $(POTFILES_DEPS) remove-potcdate.sed
114
$(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
115
--add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
116
--copyright-holder='$(COPYRIGHT_HOLDER)' \
117
--msgid-bugs-address='$(MSGID_BUGS_ADDRESS)' \
119
test ! -f $(DOMAIN).po || { \
120
if test -f $(srcdir)/$(DOMAIN).pot; then \
121
sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
122
sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
123
if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
124
rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
126
rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
127
mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
130
mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
134
# This rule has no dependencies: we don't need to update $(DOMAIN).pot at
135
# every "make" invocation, only create it when it is missing.
136
# Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
137
$(srcdir)/$(DOMAIN).pot:
138
$(MAKE) $(DOMAIN).pot-update
140
# This target rebuilds a PO file if $(DOMAIN).pot has changed.
141
# Note that a PO file is not touched if it doesn't need to be changed.
142
$(POFILES): $(srcdir)/$(DOMAIN).pot
143
@lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
144
if test -f "$(srcdir)/$${lang}.po"; then \
145
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
146
echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
147
cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \
149
$(MAKE) $${lang}.po-create; \
153
install-data-local: install-data-local-@USE_NLS@
154
install-data-local-no: all-local
155
install-data-local-yes: all-local
156
$(mkinstalldirs) $(DESTDIR)$(datadir)
157
@catalogs='$(CATALOGS)'; \
158
for cat in $$catalogs; do \
159
cat=`basename $$cat`; \
160
lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
161
dir=$(localedir)/$$lang/LC_MESSAGES; \
162
$(mkinstalldirs) $(DESTDIR)$$dir; \
163
if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
164
$(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
165
echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
166
for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
167
if test -n "$$lc"; then \
168
if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
169
link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
170
mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
171
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
172
(cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
174
if test -f $$file; then \
175
ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
178
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
180
if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
183
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
184
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
187
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
188
ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
189
ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
190
cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
191
echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
196
installdirs-local: installdirs-local-@USE_NLS@
197
installdirs-local-no:
198
installdirs-local-yes:
199
$(mkinstalldirs) $(DESTDIR)$(datadir)
200
@catalogs='$(CATALOGS)'; \
201
for cat in $$catalogs; do \
202
cat=`basename $$cat`; \
203
lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
204
dir=$(localedir)/$$lang/LC_MESSAGES; \
205
$(mkinstalldirs) $(DESTDIR)$$dir; \
206
for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
207
if test -n "$$lc"; then \
208
if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
209
link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
210
mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
211
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
212
(cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
214
if test -f $$file; then \
215
ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
218
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
220
if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
223
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
224
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
231
uninstall-local: uninstall-local-@USE_NLS@
234
catalogs='$(CATALOGS)'; \
235
for cat in $$catalogs; do \
236
cat=`basename $$cat`; \
237
lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
238
for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
239
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
246
MOSTLYCLEANFILES += remove-potcdate.sed
247
MOSTLYCLEANFILES += stamp-poT
248
MOSTLYCLEANFILES += core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
249
MOSTLYCLEANFILES += *.o
251
DISTCLEANFILES = *.mo
253
MAINTAINERCLEANFILES = stamp-po $(GMOFILES)
255
EXTRA_DIST = remove-potcdate.sin LINGUAS $(DOMAIN).pot stamp-po $(POFILES) $(GMOFILES)
257
# Hidden from automake, but really activated. Works around an automake-1.5 bug.
263
$(MAKE) $(DOMAIN).pot-update
264
test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
267
# General rule for creating PO files.
270
@lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
271
echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
274
# General rule for updating PO files.
277
@lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
280
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
281
echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
283
if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
284
if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
285
rm -f $$tmpdir/$$lang.new.po; \
287
if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
290
echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
295
echo "msgmerge for $$lang.po failed!" 1>&2; \
296
rm -f $$tmpdir/$$lang.new.po; \
301
update-gmo: Makefile $(GMOFILES)