1 # Example for use of GNU gettext.
2 # This file is in the public domain.
4 # Makefile configuration - processed by automake.
6 # List of files which contain translatable strings.
10 # Usually the message domain is the same as the package name.
13 # These options get passed to xgettext.
16 # This is the copyright holder that gets inserted into the header of the
17 # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
18 # package. (Note that the msgstr strings, extracted from the package's
19 # sources, belong to the copyright holder of the package.) Translators are
20 # expected to transfer the copyright for their translations to this person
21 # or entity, or to disclaim their copyright. The empty string stands for
22 # the public domain; in this case the translators are expected to disclaim
24 COPYRIGHT_HOLDER = Yoyodyne, Inc.
26 # This is the email address or URL to which the translators shall report
27 # bugs in the untranslated strings:
28 # - Strings which are not entire sentences, see the maintainer guidelines
29 # in the GNU gettext documentation, section 'Preparing Strings'.
30 # - Strings which use unclear terms or require additional context to be
32 # - Strings which make invalid assumptions about notation of date, time or
34 # - Pluralisation problems.
35 # - Incorrect English spelling.
36 # - Incorrect formatting.
37 # It can be your email address, or a mailing list address where translators
38 # can write to without being subscribed, or the URL of a web page through
39 # which the translators can contact you.
40 MSGID_BUGS_ADDRESS = bug-gnu-gettext@gnu.org
42 # These options get passed to msgmerge.
43 # Useful options are in particular:
44 # --previous to keep previous msgids of translated messages,
45 # --quiet to reduce the verbosity.
46 MSGMERGE_OPTIONS = --quiet
48 pkglibdir = $(libdir)/$(PACKAGE)
51 MSGMERGE_UPDATE = @MSGMERGE@ --update
56 # This is computed as $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
57 POTFILES_DEPS = @POTFILES_DEPS@
59 # This is computed as $(foreach lang, $(LINGUAS), $(srcdir)/$(lang).po)
61 # This is computed as $(foreach lang, $(LINGUAS), $(lang).po-update)
62 UPDATEPOFILES = @UPDATEPOFILES@
63 # This is computed as $(foreach lang, $(LINGUAS), $(lang).nop)
64 DUMMYPOFILES = @DUMMYPOFILES@
65 # This is computed as $(foreach lang, $(LINGUAS), $(srcdir)/$(frob $(lang))/$(DOMAIN).resources.dll)
66 RESOURCESDLLFILES = @RESOURCESDLLFILES@
69 # $(foreach lang, user-specified subset of $(LINGUAS), $(frob $(lang))/$(DOMAIN).resources.dll)
70 CATALOGS = @CSHARPCATALOGS@
72 SUFFIXES = .sed .sin .nop .po-create .po-update
75 sed -e '/^#/d' $< > t-$@
79 all-local: all-local-@USE_NLS@
81 all-local-yes: stamp-po
84 # $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no
85 # internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
86 # we don't want to bother translators with empty POT files). We assume that
87 # LINGUAS is empty in this case, i.e. $(POFILES) and $(RESOURCESDLLFILES) are
88 # empty. In this case, stamp-po is a nop (i.e. a phony target).
90 # stamp-po is a timestamp denoting the last time at which the CATALOGS have
91 # been loosely updated. Its purpose is that when a developer or translator
92 # checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
93 # "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
94 # invocations of "make" will do nothing. This timestamp would not be necessary
95 # if updating the $(CATALOGS) would always touch them; however, the rule for
96 # $(POFILES) has been designed to not touch files that don't need to be
98 stamp-po: $(srcdir)/$(DOMAIN).pot
99 test ! -f $(srcdir)/$(DOMAIN).pot || \
100 test -z "$(RESOURCESDLLFILES)" || $(MAKE) $(RESOURCESDLLFILES)
101 @test ! -f $(srcdir)/$(DOMAIN).pot || { \
102 echo "touch stamp-po" && \
103 echo timestamp > stamp-poT && \
104 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 if LC_ALL=C grep 'GNU $(PACKAGE)' $(top_srcdir)/* 2>/dev/null | grep -v 'libtool:' >/dev/null; then \
115 package_gnu='GNU '; \
119 if test -n '$(MSGID_BUGS_ADDRESS)'; then \
120 msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
122 msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \
124 case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
125 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \
126 $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
127 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
128 --copyright-holder='$(COPYRIGHT_HOLDER)' \
129 --msgid-bugs-address="$$msgid_bugs_address" \
133 $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
134 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
135 --copyright-holder='$(COPYRIGHT_HOLDER)' \
136 --package-name="$${package_gnu}$(PACKAGE)" \
137 --package-version='$(VERSION)' \
138 --msgid-bugs-address="$$msgid_bugs_address" \
142 test ! -f $(DOMAIN).po || { \
143 if test -f $(srcdir)/$(DOMAIN).pot; then \
144 sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
145 sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
146 if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
147 rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
149 rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
150 mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
153 mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
157 # This rule has no dependencies: we don't need to update $(DOMAIN).pot at
158 # every "make" invocation, only create it when it is missing.
159 # Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
160 $(srcdir)/$(DOMAIN).pot:
161 $(MAKE) $(DOMAIN).pot-update
163 # This target rebuilds a PO file if $(DOMAIN).pot has changed.
164 # Note that a PO file is not touched if it doesn't need to be changed.
165 $(POFILES): $(srcdir)/$(DOMAIN).pot
166 @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
167 if test -f "$(srcdir)/$${lang}.po"; then \
168 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
169 echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot"; \
171 && { case `$(MSGMERGE_UPDATE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
172 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
173 $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \
175 $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot;; \
179 $(MAKE) $${lang}.po-create; \
183 install-data-local: install-data-local-@USE_NLS@
184 install-data-local-no: all-local
185 install-data-local-yes: all-local
186 $(MKDIR_P) $(DESTDIR)$(pkglibdir)
187 @catalogs='$(CATALOGS)'; \
188 for cat in $$catalogs; do \
189 $(MKDIR_P) $(DESTDIR)$(pkglibdir)/`echo $$cat | sed -e 's,/[^/]*$$,,'`; \
190 if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
191 $(INSTALL_DATA) $$realcat $(DESTDIR)$(pkglibdir)/$$cat; \
192 echo "installing $$realcat as $(DESTDIR)$(pkglibdir)/$$cat"; \
195 installdirs-local: installdirs-local-@USE_NLS@
196 installdirs-local-no:
197 installdirs-local-yes:
198 $(MKDIR_P) $(DESTDIR)$(pkglibdir)
199 @catalogs='$(CATALOGS)'; \
200 for cat in $$catalogs; do \
201 $(MKDIR_P) $(DESTDIR)$(pkglibdir)/`echo $$cat | sed -e 's,/[^/]*$$,,'`; \
204 uninstall-local: uninstall-local-@USE_NLS@
207 catalogs='$(CATALOGS)'; \
208 for cat in $$catalogs; do \
209 rm -f $(DESTDIR)$(pkglibdir)/$$cat; \
215 MOSTLYCLEANFILES += remove-potcdate.sed
216 MOSTLYCLEANFILES += stamp-poT
217 MOSTLYCLEANFILES += core core.* *.stackdump $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
219 MAINTAINERCLEANFILES = stamp-po $(RESOURCESDLLFILES)
221 EXTRA_DIST = remove-potcdate.sin LINGUAS $(POFILES) $(RESOURCESDLLFILES)
223 # Hidden from automake, but really activated. Works around an automake-1.5 bug.
227 if test -f $(srcdir)/$(DOMAIN).pot; then \
228 for file in $(DOMAIN).pot stamp-po; do \
229 if test -f $$file; then d=.; else d=$(srcdir); fi; \
230 cp -p $$d/$$file $(distdir)/$$file || exit 1; \
235 $(MAKE) $(DOMAIN).pot-update
236 test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
237 $(MAKE) update-resourcesdll
239 # General rule for creating PO files.
242 @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
243 echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
246 # General rule for updating PO files.
249 @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
252 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
253 echo "$${cdcmd}$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
255 if { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
256 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
257 $(MSGMERGE) $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
259 $(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
262 if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
263 rm -f $$tmpdir/$$lang.new.po; \
265 if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
268 echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
273 echo "msgmerge for $$lang.po failed!" 1>&2; \
274 rm -f $$tmpdir/$$lang.new.po; \
279 update-resourcesdll: Makefile $(RESOURCESDLLFILES)