Install gettext-0.18.1.1.tar.gz
[msysgit.git] / mingw / share / doc / gettext / examples / hello-php / po / Makefile.am
blobe5db0517fb20f39f1bb1cf9bbf10e128e0c08eb9
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.php
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 =
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
23 # their copyright.
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
31 #   understood.
32 # - Strings which make invalid assumptions about notation of date, time or
33 #   money.
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 # This is the list of locale categories, beyond LC_MESSAGES, for which the
43 # message catalogs shall be used.  It is usually empty.
44 EXTRA_LOCALE_CATEGORIES =
46 # These options get passed to msgmerge.
47 # Useful options are in particular:
48 #   --previous            to keep previous msgids of translated messages,
49 #   --quiet               to reduce the verbosity.
50 MSGMERGE_OPTIONS = --quiet
52 MSGMERGE = msgmerge
53 MSGMERGE_UPDATE = @MSGMERGE@ --update
54 MSGINIT = msginit
55 MSGCONV = msgconv
56 MSGFILTER = msgfilter
58 # This is computed as $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
59 POTFILES_DEPS = @POTFILES_DEPS@
61 # This is computed as $(foreach lang, $(LINGUAS), $(srcdir)/$(lang).po)
62 POFILES = @POFILES@
63 # This is computed as $(foreach lang, $(LINGUAS), $(srcdir)/$(lang).gmo)
64 GMOFILES = @GMOFILES@
65 # This is computed as $(foreach lang, $(LINGUAS), $(lang).po-update)
66 UPDATEPOFILES = @UPDATEPOFILES@
67 # This is computed as $(foreach lang, $(LINGUAS), $(lang).nop)
68 DUMMYPOFILES = @DUMMYPOFILES@
70 # This is computed as
71 # $(foreach lang, user-specified subset of $(LINGUAS), $(lang).gmo)
72 CATALOGS = @CATALOGS@
74 SUFFIXES = .po .gmo .mo .sed .sin .nop .po-create .po-update
76 .po.mo:
77         @echo "$(MSGFMT) -c -o $@ $<"; \
78         $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
80 .po.gmo:
81         @lang=`echo $* | sed -e 's,.*/,,'`; \
82         test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
83         echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o $${lang}.gmo $${lang}.po"; \
84         cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
86 .sin.sed:
87         sed -e '/^#/d' $< > t-$@
88         mv t-$@ $@
91 all-local: all-local-@USE_NLS@
93 all-local-yes: stamp-po
94 all-local-no:
96 # $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no
97 # internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
98 # we don't want to bother translators with empty POT files). We assume that
99 # LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty.
100 # In this case, stamp-po is a nop (i.e. a phony target).
102 # stamp-po is a timestamp denoting the last time at which the CATALOGS have
103 # been loosely updated. Its purpose is that when a developer or translator
104 # checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
105 # "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
106 # invocations of "make" will do nothing. This timestamp would not be necessary
107 # if updating the $(CATALOGS) would always touch them; however, the rule for
108 # $(POFILES) has been designed to not touch files that don't need to be
109 # changed.
110 stamp-po: $(srcdir)/$(DOMAIN).pot
111         test ! -f $(srcdir)/$(DOMAIN).pot || \
112           test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
113         @test ! -f $(srcdir)/$(DOMAIN).pot || { \
114           echo "touch stamp-po" && \
115           echo timestamp > stamp-poT && \
116           mv stamp-poT stamp-po; \
117         }
119 # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
120 # otherwise packages like GCC can not be built if only parts of the source
121 # have been downloaded.
123 # This target rebuilds $(DOMAIN).pot; it is an expensive operation.
124 # Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
125 $(DOMAIN).pot-update: $(POTFILES_DEPS) remove-potcdate.sed
126         if LC_ALL=C grep 'GNU $(PACKAGE)' $(top_srcdir)/* 2>/dev/null | grep -v 'libtool:' >/dev/null; then \
127           package_gnu='GNU '; \
128         else \
129           package_gnu=''; \
130         fi; \
131         if test -n '$(MSGID_BUGS_ADDRESS)'; then \
132           msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
133         else \
134           msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \
135         fi; \
136         case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
137           '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \
138             $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
139               --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
140               --copyright-holder='$(COPYRIGHT_HOLDER)' \
141               --msgid-bugs-address="$$msgid_bugs_address" \
142               $(POTFILES) \
143             ;; \
144           *) \
145             $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
146               --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
147               --copyright-holder='$(COPYRIGHT_HOLDER)' \
148               --package-name="$${package_gnu}$(PACKAGE)" \
149               --package-version='$(VERSION)' \
150               --msgid-bugs-address="$$msgid_bugs_address" \
151               $(POTFILES) \
152             ;; \
153         esac
154         test ! -f $(DOMAIN).po || { \
155           if test -f $(srcdir)/$(DOMAIN).pot; then \
156             sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
157             sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
158             if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
159               rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
160             else \
161               rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
162               mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
163             fi; \
164           else \
165             mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
166           fi; \
167         }
169 # This rule has no dependencies: we don't need to update $(DOMAIN).pot at
170 # every "make" invocation, only create it when it is missing.
171 # Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
172 $(srcdir)/$(DOMAIN).pot:
173         $(MAKE) $(DOMAIN).pot-update
175 # This target rebuilds a PO file if $(DOMAIN).pot has changed.
176 # Note that a PO file is not touched if it doesn't need to be changed.
177 $(POFILES): $(srcdir)/$(DOMAIN).pot
178         @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
179         if test -f "$(srcdir)/$${lang}.po"; then \
180           test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
181           echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot"; \
182           cd $(srcdir) \
183             && { case `$(MSGMERGE_UPDATE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
184                    '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
185                      $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \
186                    *) \
187                      $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot;; \
188                  esac; \
189                }; \
190         else \
191           $(MAKE) $${lang}.po-create; \
192         fi
195 install-data-local: install-data-local-@USE_NLS@
196 install-data-local-no: all-local
197 install-data-local-yes: all-local
198         $(mkdir_p) $(DESTDIR)$(datadir)
199         @catalogs='$(CATALOGS)'; \
200         for cat in $$catalogs; do \
201           cat=`basename $$cat`; \
202           lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
203           dir=$(localedir)/$$lang/LC_MESSAGES; \
204           $(mkdir_p) $(DESTDIR)$$dir; \
205           if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
206           $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
207           echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
208           for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
209             if test -n "$$lc"; then \
210               if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
211                 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
212                 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
213                 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
214                 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
215                  for file in *; do \
216                    if test -f $$file; then \
217                      ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
218                    fi; \
219                  done); \
220                 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
221               else \
222                 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
223                   :; \
224                 else \
225                   rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
226                   mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
227                 fi; \
228               fi; \
229               rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
230               ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
231               ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
232               cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
233               echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
234             fi; \
235           done; \
236         done
238 installdirs-local: installdirs-local-@USE_NLS@
239 installdirs-local-no:
240 installdirs-local-yes:
241         $(mkdir_p) $(DESTDIR)$(datadir)
242         @catalogs='$(CATALOGS)'; \
243         for cat in $$catalogs; do \
244           cat=`basename $$cat`; \
245           lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
246           dir=$(localedir)/$$lang/LC_MESSAGES; \
247           $(mkdir_p) $(DESTDIR)$$dir; \
248           for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
249             if test -n "$$lc"; then \
250               if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
251                 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
252                 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
253                 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
254                 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
255                  for file in *; do \
256                    if test -f $$file; then \
257                      ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
258                    fi; \
259                  done); \
260                 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
261               else \
262                 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
263                   :; \
264                 else \
265                   rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
266                   mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
267                 fi; \
268               fi; \
269             fi; \
270           done; \
271         done
273 uninstall-local: uninstall-local-@USE_NLS@
274 uninstall-local-no:
275 uninstall-local-yes:
276         catalogs='$(CATALOGS)'; \
277         for cat in $$catalogs; do \
278           cat=`basename $$cat`; \
279           lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
280           for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
281             rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
282           done; \
283         done
285 html ID:
287 MOSTLYCLEANFILES =
288 MOSTLYCLEANFILES += remove-potcdate.sed
289 MOSTLYCLEANFILES += stamp-poT
290 MOSTLYCLEANFILES += core core.* *.stackdump $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
291 MOSTLYCLEANFILES += *.o
293 DISTCLEANFILES = *.mo
295 MAINTAINERCLEANFILES = stamp-po $(GMOFILES)
297 EXTRA_DIST = remove-potcdate.sin LINGUAS $(POFILES) $(GMOFILES)
299 # Hidden from automake, but really activated. Works around an automake-1.5 bug.
300 #distdir: distdir1
301 distdir1:
302         $(MAKE) update-po
303         if test -f $(srcdir)/$(DOMAIN).pot; then \
304           for file in $(DOMAIN).pot stamp-po; do \
305             if test -f $$file; then d=.; else d=$(srcdir); fi; \
306             cp -p $$d/$$file $(distdir)/$$file || exit 1; \
307           done; \
308         fi
310 update-po: Makefile
311         $(MAKE) $(DOMAIN).pot-update
312         test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
313         $(MAKE) update-gmo
315 # General rule for creating PO files.
317 .nop.po-create:
318         @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
319         echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
320         exit 1
322 # General rule for updating PO files.
324 .nop.po-update:
325         @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
326         tmpdir=`pwd`; \
327         echo "$$lang:"; \
328         test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
329         echo "$${cdcmd}$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
330         cd $(srcdir); \
331         if { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
332                '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
333                  $(MSGMERGE) $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
334                *) \
335                  $(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
336              esac; \
337            }; then \
338           if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
339             rm -f $$tmpdir/$$lang.new.po; \
340           else \
341             if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
342               :; \
343             else \
344               echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
345               exit 1; \
346             fi; \
347           fi; \
348         else \
349           echo "msgmerge for $$lang.po failed!" 1>&2; \
350           rm -f $$tmpdir/$$lang.new.po; \
351         fi
353 $(DUMMYPOFILES):
355 update-gmo: Makefile $(GMOFILES)
356         @: