xref: /netbsd-src/external/gpl2/gettext/dist/gettext-tools/examples/po/Makefile.am (revision cef8759bd76c1b621f8eab8faa6f208faabc2e15)
1## Makefile for the gettext-tools/examples/po subdirectory of GNU gettext
2## Copyright (C) 1995-1998, 2000-2006 Free Software Foundation, Inc.
3##
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2, or (at your option)
7## any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software Foundation,
16## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
18## Process this file with automake to produce Makefile.in.
19
20AUTOMAKE_OPTIONS = 1.5 gnits
21
22# List of files which contain translatable strings.
23POTFILES = \
24  hello-c/hello.c \
25  hello-c-gnome/hello.c \
26  hello-c++/hello.cc \
27  hello-c++-qt/hello.cc \
28  hello-c++-kde/hello.cc \
29  hello-c++-kde/hellowindow.h \
30  hello-c++-kde/hellowindow.cc \
31  hello-c++-gnome/hello.cc \
32  hello-c++-wxwidgets/hello.cc \
33  hello-objc/hello.m \
34  hello-objc-gnustep/main.m \
35  hello-objc-gnustep/AppController.h \
36  hello-objc-gnustep/AppController.m \
37  hello-objc-gnustep/Hello.h \
38  hello-objc-gnustep/Hello.m \
39  hello-objc-gnome/hello.m \
40  hello-sh/hello.sh \
41  hello-python/hello.py.in \
42  hello-clisp/hello.lisp.in \
43  hello-librep/hello.jl.in \
44  hello-guile/hello.scm \
45  hello-smalltalk/hello.st.in \
46  hello-java/Hello.java \
47  hello-java-awt/Hello.java \
48  hello-java-swing/Hello.java \
49  hello-csharp/hello.cs \
50  hello-csharp-forms/hello.cs \
51  hello-gawk/hello.awk \
52  hello-pascal/hello.pas \
53  hello-ycp/hello.ycp \
54  hello-tcl/hello.tcl \
55  hello-tcl-tk/hello.tcl \
56  hello-perl/hello-1.pl.in \
57  hello-perl/hello-2.pl.in \
58  hello-php/hello.php
59
60# List of small POT files.
61SMALLPOTS = \
62  hello-c.pot \
63  hello-c-gnome.pot \
64  hello-c++.pot \
65  hello-c++-qt.pot \
66  hello-c++-kde.pot \
67  hello-c++-gnome.pot \
68  hello-c++-wxwidgets.pot \
69  hello-objc.pot \
70  hello-objc-gnustep.pot \
71  hello-objc-gnome.pot \
72  hello-sh.pot \
73  hello-python.pot \
74  hello-clisp.pot \
75  hello-librep.pot \
76  hello-guile.pot \
77  hello-smalltalk.pot \
78  hello-java.pot \
79  hello-java-awt.pot \
80  hello-java-swing.pot \
81  hello-csharp.pot \
82  hello-csharp-forms.pot \
83  hello-gawk.pot \
84  hello-pascal.pot \
85  hello-ycp.pot \
86  hello-tcl.pot \
87  hello-tcl-tk.pot \
88  hello-perl.pot \
89  hello-php.pot
90
91# This is a synthetic domain name.
92DOMAIN = gettext-examples
93
94# This is the copyright holder that gets inserted into the header of the
95# $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding
96# package.  (Note that the msgstr strings, extracted from the package's
97# sources, belong to the copyright holder of the package.)  Translators are
98# expected to transfer the copyright for their translations to this person
99# or entity, or to disclaim their copyright.  The empty string stands for
100# the public domain; in this case the translators are expected to disclaim
101# their copyright.
102COPYRIGHT_HOLDER = Yoyodyne, Inc.
103
104# This is the email address or URL to which the translators shall report
105# bugs in the untranslated strings:
106# - Strings which are not entire sentences, see the maintainer guidelines
107#   in the GNU gettext documentation, section 'Preparing Strings'.
108# - Strings which use unclear terms or require additional context to be
109#   understood.
110# - Strings which make invalid assumptions about notation of date, time or
111#   money.
112# - Pluralisation problems.
113# - Incorrect English spelling.
114# - Incorrect formatting.
115# It can be your email address, or a mailing list address where translators
116# can write to without being subscribed, or the URL of a web page through
117# which the translators can contact you.
118MSGID_BUGS_ADDRESS = bug-gnu-gettext@gnu.org
119
120# This is the list of locale categories, beyond LC_MESSAGES, for which the
121# message catalogs shall be used.  It is usually empty.
122EXTRA_LOCALE_CATEGORIES =
123
124MSGMERGE = msgmerge
125MSGMERGE_UPDATE = @MSGMERGE@ --update
126MSGINIT = msginit
127MSGCONV = msgconv
128MSGFILTER = msgfilter
129
130# This is computed as $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
131POTFILES_DEPS = @POTFILES_DEPS@
132
133# This is computed as $(foreach lang, $(LINGUAS), $(srcdir)/$(lang).po)
134POFILES = @POFILES@
135# This is computed as $(foreach lang, $(LINGUAS), $(lang).po-update)
136UPDATEPOFILES = @UPDATEPOFILES@
137# This is computed as $(foreach lang, $(LINGUAS), $(lang).nop)
138DUMMYPOFILES = @DUMMYPOFILES@
139
140SUFFIXES = .po .sed .sin .nop .po-update
141
142.sin.sed:
143	sed -e '/^#/d' $< > t-$@
144	mv t-$@ $@
145
146
147all-local: all-local-@USE_NLS@
148
149all-local-yes: stamp-po
150all-local-no:
151
152# $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no
153# internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
154# we don't want to bother translators with empty POT files). We assume that
155# LINGUAS is empty in this case, i.e. $(POFILES) is empty. In this case,
156# stamp-po is a nop (i.e. a phony target).
157
158# stamp-po is a timestamp denoting the last time at which the CATALOGS have
159# been loosely updated. Its purpose is that when a developer or translator
160# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
161# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
162# invocations of "make" will do nothing. This timestamp would not be necessary
163# if updating the $(CATALOGS) would always touch them; however, the rule for
164# $(POFILES) has been designed to not touch files that don't need to be
165# changed.
166stamp-po: $(srcdir)/$(DOMAIN).pot
167	@test ! -f $(srcdir)/$(DOMAIN).pot || { \
168	  echo "touch stamp-po" && \
169	  echo timestamp > stamp-poT && \
170	  mv stamp-poT stamp-po; \
171	}
172
173# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
174# otherwise packages like GCC can not be built if only parts of the source
175# have been downloaded.
176
177# This target rebuilds $(DOMAIN).pot; it is an expensive operation.
178# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
179$(DOMAIN).pot-update: $(POTFILES_DEPS) $(SMALLPOTS) remove-potcdate.sed
180	if test -n '$(MSGID_BUGS_ADDRESS)'; then \
181	  msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
182	else \
183	  msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \
184	fi; \
185	$(XGETTEXT) --default-domain=$(DOMAIN) \
186	  --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
187	  --copyright-holder='$(COPYRIGHT_HOLDER)' \
188	  --msgid-bugs-address="$$msgid_bugs_address" \
189	  $(SMALLPOTS)
190	test ! -f $(DOMAIN).po || { \
191	  if test -f $(srcdir)/$(DOMAIN).pot; then \
192	    sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
193	    sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
194	    if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
195	      rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
196	    else \
197	      rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
198	      mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
199	    fi; \
200	  else \
201	    mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
202	  fi; \
203	}
204
205
206hello-c.pot : $(POTFILES_DEPS)
207	$(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-c
208
209hello-c-gnome.pot : $(POTFILES_DEPS)
210	$(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-c-gnome
211
212hello-c++.pot : $(POTFILES_DEPS)
213	$(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-c++
214
215hello-c++-qt.pot : $(POTFILES_DEPS)
216	$(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-c++-qt
217
218hello-c++-kde.pot : $(POTFILES_DEPS)
219	$(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-c++-kde
220
221hello-c++-gnome.pot : $(POTFILES_DEPS)
222	$(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-c++-gnome
223
224hello-c++-wxwidgets.pot : $(POTFILES_DEPS)
225	$(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-c++-wxwidgets
226
227hello-objc.pot : $(POTFILES_DEPS)
228	$(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-objc
229
230hello-objc-gnustep.pot : $(POTFILES_DEPS)
231	$(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-objc-gnustep
232
233hello-objc-gnome.pot : $(POTFILES_DEPS)
234	$(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-objc-gnome
235
236hello-sh.pot : $(POTFILES_DEPS)
237	$(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-sh
238
239hello-python.pot : $(POTFILES_DEPS)
240	$(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-python
241
242hello-clisp.pot : $(POTFILES_DEPS)
243	$(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-clisp
244
245hello-librep.pot : $(POTFILES_DEPS)
246	$(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-librep
247
248hello-guile.pot : $(POTFILES_DEPS)
249	$(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-guile
250
251hello-smalltalk.pot : $(POTFILES_DEPS)
252	$(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-smalltalk
253
254hello-java.pot : $(POTFILES_DEPS)
255	$(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-java
256
257hello-java-awt.pot : $(POTFILES_DEPS)
258	$(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-java-awt
259
260hello-java-swing.pot : $(POTFILES_DEPS)
261	$(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-java-swing
262
263hello-csharp.pot : $(POTFILES_DEPS)
264	$(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-csharp
265
266hello-csharp-forms.pot : $(POTFILES_DEPS)
267	$(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-csharp-forms
268
269hello-gawk.pot : $(POTFILES_DEPS)
270	$(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-gawk
271
272hello-pascal.pot : $(POTFILES_DEPS)
273	$(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-pascal
274
275hello-ycp.pot : $(POTFILES_DEPS)
276	$(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-ycp
277
278hello-tcl.pot : $(POTFILES_DEPS)
279	$(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-tcl
280
281hello-tcl-tk.pot : $(POTFILES_DEPS)
282	$(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-tcl-tk
283
284hello-perl.pot : $(POTFILES_DEPS)
285	$(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-perl
286
287hello-php.pot : $(POTFILES_DEPS)
288	$(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-php
289
290
291# This rule has no dependencies: we don't need to update $(DOMAIN).pot at
292# every "make" invocation, only create it when it is missing.
293# Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
294$(srcdir)/$(DOMAIN).pot:
295	$(MAKE) $(DOMAIN).pot-update
296
297# This target rebuilds a PO file if $(DOMAIN).pot has changed.
298# Note that a PO file is not touched if it doesn't need to be changed.
299$(POFILES): $(srcdir)/$(DOMAIN).pot
300	@lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
301	test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
302	echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
303	cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot
304
305
306html ID:
307
308MOSTLYCLEANFILES =
309MOSTLYCLEANFILES += remove-potcdate.sed
310MOSTLYCLEANFILES += stamp-poT
311MOSTLYCLEANFILES += core core.* *.stackdump $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
312MOSTLYCLEANFILES += *.o
313
314DISTCLEANFILES = $(SMALLPOTS)
315
316MAINTAINERCLEANFILES = stamp-po
317
318EXTRA_DIST = remove-potcdate.sin xsmallpot.sh mmsmallpo.sh LINGUAS \
319  $(POFILES)
320
321# Hidden from automake, but really activated. Works around an automake-1.5 bug.
322#distdir: distdir1
323distdir1:
324	$(MAKE) update-po
325	if test -f $(srcdir)/$(DOMAIN).pot; then \
326	  for file in $(DOMAIN).pot stamp-po; do \
327	    if test -f $$file; then d=.; else d=$(srcdir); fi; \
328	    cp -p $$d/$$file $(distdir)/$$file || exit 1; \
329	  done; \
330	fi
331
332update-po: Makefile
333	$(MAKE) $(DOMAIN).pot-update
334	test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
335
336# General rule for updating PO files.
337
338.nop.po-update:
339	@lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
340	tmpdir=`pwd`; \
341	echo "$$lang:"; \
342	test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
343	echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
344	cd $(srcdir); \
345	if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
346	  if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
347	    rm -f $$tmpdir/$$lang.new.po; \
348	  else \
349	    if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
350	      :; \
351	    else \
352	      echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
353	      exit 1; \
354	    fi; \
355	  fi; \
356	  $(MAKE) $(SMALLPOFILES_FOR_lang) LL=$$lang; \
357	else \
358	  echo "msgmerge for $$lang.po failed!" 1>&2; \
359	  rm -f $$tmpdir/$$lang.new.po; \
360	fi
361
362$(DUMMYPOFILES):
363
364
365# Rules for updating small PO files in the other directories.
366# Depend on LL being set.
367
368SMALLPOFILES_FOR_lang = \
369  ../hello-c/po/$$lang.po \
370  ../hello-c-gnome/po/$$lang.po \
371  ../hello-c++/po/$$lang.po \
372  ../hello-c++-qt/po/$$lang.po \
373  ../hello-c++-kde/po/$$lang.po \
374  ../hello-c++-gnome/po/$$lang.po \
375  ../hello-c++-wxwidgets/po/$$lang.po \
376  ../hello-objc/po/$$lang.po \
377  ../hello-objc-gnustep/po/$$lang.po \
378  ../hello-objc-gnome/po/$$lang.po \
379  ../hello-sh/po/$$lang.po \
380  ../hello-python/po/$$lang.po \
381  ../hello-clisp/po/$$lang.po \
382  ../hello-librep/po/$$lang.po \
383  ../hello-guile/po/$$lang.po \
384  ../hello-smalltalk/po/$$lang.po \
385  ../hello-java/po/$$lang.po \
386  ../hello-java-awt/po/$$lang.po \
387  ../hello-java-swing/po/$$lang.po \
388  ../hello-csharp/po/$$lang.po \
389  ../hello-csharp-forms/po/$$lang.po \
390  ../hello-gawk/po/$$lang.po \
391  ../hello-pascal/po/$$lang.po \
392  ../hello-ycp/po/$$lang.po \
393  ../hello-tcl/po/$$lang.po \
394  ../hello-tcl-tk/po/$$lang.po \
395  ../hello-perl/po/$$lang.po \
396  ../hello-php/po/$$lang.po
397
398../hello-c/po/$(LL).po: hello-c.pot $(LL).po
399	$(SHELL) mmsmallpo.sh hello-c $(LL)
400
401../hello-c-gnome/po/$(LL).po: hello-c-gnome.pot $(LL).po
402	$(SHELL) mmsmallpo.sh hello-c-gnome $(LL)
403
404../hello-c++/po/$(LL).po: hello-c++.pot $(LL).po
405	$(SHELL) mmsmallpo.sh hello-c++ $(LL)
406
407../hello-c++-qt/po/$(LL).po: hello-c++-qt.pot $(LL).po
408	$(SHELL) mmsmallpo.sh hello-c++-qt $(LL)
409
410../hello-c++-kde/po/$(LL).po: hello-c++-kde.pot $(LL).po
411	$(SHELL) mmsmallpo.sh hello-c++-kde $(LL)
412
413../hello-c++-gnome/po/$(LL).po: hello-c++-gnome.pot $(LL).po
414	$(SHELL) mmsmallpo.sh hello-c++-gnome $(LL)
415
416../hello-c++-wxwidgets/po/$(LL).po: hello-c++-wxwidgets.pot $(LL).po
417	$(SHELL) mmsmallpo.sh hello-c++-wxwidgets $(LL)
418
419../hello-objc/po/$(LL).po: hello-objc.pot $(LL).po
420	$(SHELL) mmsmallpo.sh hello-objc $(LL)
421
422../hello-objc-gnustep/po/$(LL).po: hello-objc-gnustep.pot $(LL).po
423	$(SHELL) mmsmallpo.sh hello-objc-gnustep $(LL)
424
425../hello-objc-gnome/po/$(LL).po: hello-objc-gnome.pot $(LL).po
426	$(SHELL) mmsmallpo.sh hello-objc-gnome $(LL)
427
428../hello-sh/po/$(LL).po: hello-sh.pot $(LL).po
429	$(SHELL) mmsmallpo.sh hello-sh $(LL)
430
431../hello-python/po/$(LL).po: hello-python.pot $(LL).po
432	$(SHELL) mmsmallpo.sh hello-python $(LL)
433
434../hello-clisp/po/$(LL).po: hello-clisp.pot $(LL).po
435	$(SHELL) mmsmallpo.sh hello-clisp $(LL)
436
437../hello-librep/po/$(LL).po: hello-librep.pot $(LL).po
438	$(SHELL) mmsmallpo.sh hello-librep $(LL)
439
440../hello-guile/po/$(LL).po: hello-guile.pot $(LL).po
441	$(SHELL) mmsmallpo.sh hello-guile $(LL)
442
443../hello-smalltalk/po/$(LL).po: hello-smalltalk.pot $(LL).po
444	$(SHELL) mmsmallpo.sh hello-smalltalk $(LL)
445
446../hello-java/po/$(LL).po: hello-java.pot $(LL).po
447	$(SHELL) mmsmallpo.sh hello-java $(LL)
448
449../hello-java-awt/po/$(LL).po: hello-java-awt.pot $(LL).po
450	$(SHELL) mmsmallpo.sh hello-java-awt $(LL)
451
452../hello-java-swing/po/$(LL).po: hello-java-swing.pot $(LL).po
453	$(SHELL) mmsmallpo.sh hello-java-swing $(LL)
454
455../hello-csharp/po/$(LL).po: hello-csharp.pot $(LL).po
456	$(SHELL) mmsmallpo.sh hello-csharp $(LL)
457
458../hello-csharp-forms/po/$(LL).po: hello-csharp-forms.pot $(LL).po
459	$(SHELL) mmsmallpo.sh hello-csharp-forms $(LL)
460
461../hello-gawk/po/$(LL).po: hello-gawk.pot $(LL).po
462	$(SHELL) mmsmallpo.sh hello-gawk $(LL)
463
464../hello-pascal/po/$(LL).po: hello-pascal.pot $(LL).po
465	$(SHELL) mmsmallpo.sh hello-pascal $(LL)
466
467../hello-ycp/po/$(LL).po: hello-ycp.pot $(LL).po
468	$(SHELL) mmsmallpo.sh hello-ycp $(LL)
469
470../hello-tcl/po/$(LL).po: hello-tcl.pot $(LL).po
471	$(SHELL) mmsmallpo.sh hello-tcl $(LL)
472
473../hello-tcl-tk/po/$(LL).po: hello-tcl-tk.pot $(LL).po
474	$(SHELL) mmsmallpo.sh hello-tcl-tk $(LL)
475
476../hello-perl/po/$(LL).po: hello-perl.pot $(LL).po
477	$(SHELL) mmsmallpo.sh hello-perl $(LL)
478
479../hello-php/po/$(LL).po: hello-php.pot $(LL).po
480	$(SHELL) mmsmallpo.sh hello-php $(LL)
481