1 # Example for use of GNU gettext.
2 # Copyright (C) 2003-2005 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 pkglibdir = $(libdir)/$(PACKAGE)
46 MSGMERGE_UPDATE = @MSGMERGE@ --update
51 # This is computed as $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
52 POTFILES_DEPS = @POTFILES_DEPS@
54 # This is computed as $(foreach lang, $(LINGUAS), $(srcdir)/$(lang).po)
56 # This is computed as $(foreach lang, $(LINGUAS), $(lang).po-update)
57 UPDATEPOFILES = @UPDATEPOFILES@
58 # This is computed as $(foreach lang, $(LINGUAS), $(lang).nop)
59 DUMMYPOFILES = @DUMMYPOFILES@
60 # This is computed as $(foreach lang, $(LINGUAS), $(srcdir)/$(frob $(lang))/$(DOMAIN).resources.dll)
61 RESOURCESDLLFILES = @RESOURCESDLLFILES@
64 # $(foreach lang, user-specified subset of $(LINGUAS), $(frob $(lang))/$(DOMAIN).resources.dll)
65 CATALOGS = @CSHARPCATALOGS@
67 SUFFIXES = .sed .sin .nop .po-create .po-update
70 sed -e '/^#/d' $< > t-$@
74 all-local: all-local-@USE_NLS@
76 all-local-yes: stamp-po
79 # $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no
80 # internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
81 # we don't want to bother translators with empty POT files). We assume that
82 # LINGUAS is empty in this case, i.e. $(POFILES) and $(RESOURCESDLLFILES) are
83 # empty. In this case, stamp-po is a nop (i.e. a phony target).
85 # stamp-po is a timestamp denoting the last time at which the CATALOGS have
86 # been loosely updated. Its purpose is that when a developer or translator
87 # checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
88 # "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
89 # invocations of "make" will do nothing. This timestamp would not be necessary
90 # if updating the $(CATALOGS) would always touch them; however, the rule for
91 # $(POFILES) has been designed to not touch files that don't need to be
93 stamp-po: $(srcdir)/$(DOMAIN).pot
94 test ! -f $(srcdir)/$(DOMAIN).pot || \
95 test -z "$(RESOURCESDLLFILES)" || $(MAKE) $(RESOURCESDLLFILES)
96 @test ! -f $(srcdir)/$(DOMAIN).pot || { \
97 echo "touch stamp-po" && \
98 echo timestamp > stamp-poT && \
99 mv stamp-poT stamp-po; \
102 # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
103 # otherwise packages like GCC can not be built if only parts of the source
104 # have been downloaded.
106 # This target rebuilds $(DOMAIN).pot; it is an expensive operation.
107 # Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
108 $(DOMAIN).pot-update: $(POTFILES_DEPS) remove-potcdate.sed
109 if test -n '$(MSGID_BUGS_ADDRESS)'; then \
110 msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
112 msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \
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)$(pkglibdir)
157 @catalogs='$(CATALOGS)'; \
158 for cat in $$catalogs; do \
159 $(mkinstalldirs) $(DESTDIR)$(pkglibdir)/`echo $$cat | sed -e 's,/[^/]*$$,,'`; \
160 if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
161 $(INSTALL_DATA) $$realcat $(DESTDIR)$(pkglibdir)/$$cat; \
162 echo "installing $$realcat as $(DESTDIR)$(pkglibdir)/$$cat"; \
165 installdirs-local: installdirs-local-@USE_NLS@
166 installdirs-local-no:
167 installdirs-local-yes:
168 $(mkinstalldirs) $(DESTDIR)$(pkglibdir)
169 @catalogs='$(CATALOGS)'; \
170 for cat in $$catalogs; do \
171 $(mkinstalldirs) $(DESTDIR)$(pkglibdir)/`echo $$cat | sed -e 's,/[^/]*$$,,'`; \
174 uninstall-local: uninstall-local-@USE_NLS@
177 catalogs='$(CATALOGS)'; \
178 for cat in $$catalogs; do \
179 rm -f $(DESTDIR)$(pkglibdir)/$$cat; \
185 MOSTLYCLEANFILES += remove-potcdate.sed
186 MOSTLYCLEANFILES += stamp-poT
187 MOSTLYCLEANFILES += core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
189 MAINTAINERCLEANFILES = stamp-po $(RESOURCESDLLFILES)
191 EXTRA_DIST = remove-potcdate.sin LINGUAS $(POFILES) $(RESOURCESDLLFILES)
193 # Hidden from automake, but really activated. Works around an automake-1.5 bug.
197 if test -f $(srcdir)/$(DOMAIN).pot; then \
198 for file in $(DOMAIN).pot stamp-po; do \
199 if test -f $$file; then d=.; else d=$(srcdir); fi; \
200 cp -p $$d/$$file $(distdir)/$$file || exit 1; \
205 $(MAKE) $(DOMAIN).pot-update
206 test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
207 $(MAKE) update-resourcesdll
209 # General rule for creating PO files.
212 @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
213 echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
216 # General rule for updating PO files.
219 @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
222 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
223 echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
225 if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
226 if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
227 rm -f $$tmpdir/$$lang.new.po; \
229 if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
232 echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
237 echo "msgmerge for $$lang.po failed!" 1>&2; \
238 rm -f $$tmpdir/$$lang.new.po; \
243 update-resourcesdll: Makefile $(RESOURCESDLLFILES)