Install gettext-0.18.1.1.tar.gz
[msysgit.git] / mingw / share / doc / gettext / examples / hello-c++-qt / po / Makefile.am
blob57d18879dec7cc75e11d7d944c3cfbeda6bc5a05
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.
7 POTFILES = \
8   hello.cc
10 # Usually the message domain is the same as the package name.
11 DOMAIN = $(PACKAGE)
13 # These options get passed to xgettext.
14 XGETTEXT_OPTIONS = \
15   --qt \
16   --keyword=tr:1,1t --keyword=tr:1,2c,2t --keyword=tr:1,1,2c,3t --flag=tr:1:pass-c-format --flag=tr:1:pass-qt-format \
17   --keyword=translate:2 --flag=translate:2:pass-c-format --flag=translate:2:pass-qt-format \
18   --keyword=QT_TR_NOOP --flag=QT_TR_NOOP:1:pass-c-format --flag=QT_TR_NOOP:1:pass-qt-format \
19   --keyword=QT_TRANSLATE_NOOP:2 --flag=QT_TRANSLATE_NOOP:2:pass-c-format --flag=QT_TRANSLATE_NOOP:2:pass-qt-format \
20   --keyword=_ --flag=_:1:pass-c-format --flag=_:1:pass-qt-format \
21   --keyword=N_ --flag=N_:1:pass-c-format --flag=N_:1:pass-qt-format
23 # This is the copyright holder that gets inserted into the header of the
24 # $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding
25 # package.  (Note that the msgstr strings, extracted from the package's
26 # sources, belong to the copyright holder of the package.)  Translators are
27 # expected to transfer the copyright for their translations to this person
28 # or entity, or to disclaim their copyright.  The empty string stands for
29 # the public domain; in this case the translators are expected to disclaim
30 # their copyright.
31 COPYRIGHT_HOLDER = Yoyodyne, Inc.
33 # This is the email address or URL to which the translators shall report
34 # bugs in the untranslated strings:
35 # - Strings which are not entire sentences, see the maintainer guidelines
36 #   in the GNU gettext documentation, section 'Preparing Strings'.
37 # - Strings which use unclear terms or require additional context to be
38 #   understood.
39 # - Strings which make invalid assumptions about notation of date, time or
40 #   money.
41 # - Pluralisation problems.
42 # - Incorrect English spelling.
43 # - Incorrect formatting.
44 # It can be your email address, or a mailing list address where translators
45 # can write to without being subscribed, or the URL of a web page through
46 # which the translators can contact you.
47 MSGID_BUGS_ADDRESS = bug-gnu-gettext@gnu.org
49 # These options get passed to msgmerge.
50 # Useful options are in particular:
51 #   --previous            to keep previous msgids of translated messages,
52 #   --quiet               to reduce the verbosity.
53 MSGMERGE_OPTIONS = --quiet
55 MSGMERGE = msgmerge
56 MSGMERGE_UPDATE = @MSGMERGE@ --update
57 MSGINIT = msginit
58 MSGCONV = msgconv
59 MSGFILTER = msgfilter
61 # This is computed as $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
62 POTFILES_DEPS = @POTFILES_DEPS@
64 # This is computed as $(foreach lang, $(LINGUAS), $(srcdir)/$(lang).po)
65 POFILES = @POFILES@
66 # This is computed as $(foreach lang, $(LINGUAS), $(lang).po-update)
67 UPDATEPOFILES = @UPDATEPOFILES@
68 # This is computed as $(foreach lang, $(LINGUAS), $(lang).nop)
69 DUMMYPOFILES = @DUMMYPOFILES@
70 # This is computed as $(foreach lang, $(LINGUAS), $(srcdir)/$(lang).qm)
71 QMFILES = @QMFILES@
73 # This is computed as
74 # $(foreach lang, user-specified subset of $(LINGUAS), $(lang).qm)
75 CATALOGS = @QTCATALOGS@
77 SUFFIXES = .po .qm .sed .sin .nop .po-create .po-update
79 .po.qm:
80         @lang=`echo $* | sed -e 's,.*/,,'`; \
81         test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
82         echo "$${cdcmd}rm -f $${lang}.qm && $(GMSGFMT) -c --qt --statistics --verbose -o $${lang}.qm $${lang}.po"; \
83         cd $(srcdir) && rm -f $${lang}.qm && $(GMSGFMT) -c --qt --statistics --verbose -o t-$${lang}.qm $${lang}.po && mv t-$${lang}.qm $${lang}.qm
85 .sin.sed:
86         sed -e '/^#/d' $< > t-$@
87         mv t-$@ $@
90 all-local: all-local-@USE_NLS@
92 all-local-yes: stamp-po
93 all-local-no:
95 # $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no
96 # internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
97 # we don't want to bother translators with empty POT files). We assume that
98 # LINGUAS is empty in this case, i.e. $(POFILES) and $(QMFILES) are empty.
99 # In this case, stamp-po is a nop (i.e. a phony target).
101 # stamp-po is a timestamp denoting the last time at which the CATALOGS have
102 # been loosely updated. Its purpose is that when a developer or translator
103 # checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
104 # "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
105 # invocations of "make" will do nothing. This timestamp would not be necessary
106 # if updating the $(CATALOGS) would always touch them; however, the rule for
107 # $(POFILES) has been designed to not touch files that don't need to be
108 # changed.
109 stamp-po: $(srcdir)/$(DOMAIN).pot
110         test ! -f $(srcdir)/$(DOMAIN).pot || \
111           test -z "$(QMFILES)" || $(MAKE) $(QMFILES)
112         @test ! -f $(srcdir)/$(DOMAIN).pot || { \
113           echo "touch stamp-po" && \
114           echo timestamp > stamp-poT && \
115           mv stamp-poT stamp-po; \
116         }
118 # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
119 # otherwise packages like GCC can not be built if only parts of the source
120 # have been downloaded.
122 # This target rebuilds $(DOMAIN).pot; it is an expensive operation.
123 # Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
124 $(DOMAIN).pot-update: $(POTFILES_DEPS) remove-potcdate.sed
125         if LC_ALL=C grep 'GNU $(PACKAGE)' $(top_srcdir)/* 2>/dev/null | grep -v 'libtool:' >/dev/null; then \
126           package_gnu='GNU '; \
127         else \
128           package_gnu=''; \
129         fi; \
130         if test -n '$(MSGID_BUGS_ADDRESS)'; then \
131           msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
132         else \
133           msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \
134         fi; \
135         case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
136           '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \
137             $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
138               --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
139               --copyright-holder='$(COPYRIGHT_HOLDER)' \
140               --msgid-bugs-address="$$msgid_bugs_address" \
141               $(POTFILES) \
142             ;; \
143           *) \
144             $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
145               --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
146               --copyright-holder='$(COPYRIGHT_HOLDER)' \
147               --package-name="$${package_gnu}$(PACKAGE)" \
148               --package-version='$(VERSION)' \
149               --msgid-bugs-address="$$msgid_bugs_address" \
150               $(POTFILES) \
151             ;; \
152         esac
153         test ! -f $(DOMAIN).po || { \
154           if test -f $(srcdir)/$(DOMAIN).pot; then \
155             sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
156             sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
157             if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
158               rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
159             else \
160               rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
161               mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
162             fi; \
163           else \
164             mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
165           fi; \
166         }
168 # This rule has no dependencies: we don't need to update $(DOMAIN).pot at
169 # every "make" invocation, only create it when it is missing.
170 # Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
171 $(srcdir)/$(DOMAIN).pot:
172         $(MAKE) $(DOMAIN).pot-update
174 # This target rebuilds a PO file if $(DOMAIN).pot has changed.
175 # Note that a PO file is not touched if it doesn't need to be changed.
176 $(POFILES): $(srcdir)/$(DOMAIN).pot
177         @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
178         if test -f "$(srcdir)/$${lang}.po"; then \
179           test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
180           echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot"; \
181           cd $(srcdir) \
182             && { case `$(MSGMERGE_UPDATE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
183                    '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
184                      $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \
185                    *) \
186                      $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot;; \
187                  esac; \
188                }; \
189         else \
190           $(MAKE) $${lang}.po-create; \
191         fi
194 install-data-local: install-data-local-@USE_NLS@
195 install-data-local-no: all-local
196 install-data-local-yes: all-local
197         $(mkdir_p) $(DESTDIR)$(pkgdatadir)/locale
198         @catalogs='$(CATALOGS)'; \
199         for cat in $$catalogs; do \
200           cat=`basename $$cat`; \
201           if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
202           $(INSTALL_DATA) $$realcat $(DESTDIR)$(pkgdatadir)/locale/$(DOMAIN)_$$cat; \
203           echo "installing $$realcat as $(DESTDIR)$(pkgdatadir)/locale/$(DOMAIN)_$$cat"; \
204         done
206 installdirs-local: installdirs-local-@USE_NLS@
207 installdirs-local-no:
208 installdirs-local-yes:
209         $(mkdir_p) $(DESTDIR)$(pkgdatadir)/locale
211 uninstall-local: uninstall-local-@USE_NLS@
212 uninstall-local-no:
213 uninstall-local-yes:
214         catalogs='$(CATALOGS)'; \
215         for cat in $$catalogs; do \
216           cat=`basename $$cat`; \
217           rm -f $(DESTDIR)$(pkgdatadir)/locale/$(DOMAIN)_$$cat; \
218         done
220 html ID:
222 MOSTLYCLEANFILES =
223 MOSTLYCLEANFILES += remove-potcdate.sed
224 MOSTLYCLEANFILES += stamp-poT
225 MOSTLYCLEANFILES += core core.* *.stackdump $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
226 MOSTLYCLEANFILES += *.o
228 MAINTAINERCLEANFILES = stamp-po $(QMFILES)
230 EXTRA_DIST = remove-potcdate.sin LINGUAS $(POFILES) $(QMFILES)
232 # Hidden from automake, but really activated. Works around an automake-1.5 bug.
233 #distdir: distdir1
234 distdir1:
235         $(MAKE) update-po
236         if test -f $(srcdir)/$(DOMAIN).pot; then \
237           for file in $(DOMAIN).pot stamp-po; do \
238             if test -f $$file; then d=.; else d=$(srcdir); fi; \
239             cp -p $$d/$$file $(distdir)/$$file || exit 1; \
240           done; \
241         fi
243 update-po: Makefile
244         $(MAKE) $(DOMAIN).pot-update
245         test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
246         $(MAKE) update-gmo
248 # General rule for creating PO files.
250 .nop.po-create:
251         @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
252         echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
253         exit 1
255 # General rule for updating PO files.
257 .nop.po-update:
258         @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
259         tmpdir=`pwd`; \
260         echo "$$lang:"; \
261         test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
262         echo "$${cdcmd}$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
263         cd $(srcdir); \
264         if { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
265                '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
266                  $(MSGMERGE) $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
267                *) \
268                  $(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
269              esac; \
270            }; then \
271           if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
272             rm -f $$tmpdir/$$lang.new.po; \
273           else \
274             if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
275               :; \
276             else \
277               echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
278               exit 1; \
279             fi; \
280           fi; \
281         else \
282           echo "msgmerge for $$lang.po failed!" 1>&2; \
283           rm -f $$tmpdir/$$lang.new.po; \
284         fi
286 $(DUMMYPOFILES):
288 update-gmo: Makefile $(QMFILES)
289         @: