1# Example for use of GNU gettext.
2# Copyright (C) 2003-2006 Free Software Foundation, Inc.
3# This file is in the public domain.
4#
5# Makefile configuration - processed by automake.
6
7# List of files which contain translatable strings.
8POTFILES = \
9  hello.cs
10
11# Usually the message domain is the same as the package name.
12DOMAIN = $(PACKAGE)
13
14# These options get passed to xgettext.
15XGETTEXT_OPTIONS =
16
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
24# their copyright.
25COPYRIGHT_HOLDER = Yoyodyne, Inc.
26
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
32#   understood.
33# - Strings which make invalid assumptions about notation of date, time or
34#   money.
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.
41MSGID_BUGS_ADDRESS = bug-gnu-gettext@gnu.org
42
43pkglibdir = $(libdir)/$(PACKAGE)
44
45MSGMERGE = msgmerge
46MSGMERGE_UPDATE = @MSGMERGE@ --update
47MSGINIT = msginit
48MSGCONV = msgconv
49MSGFILTER = msgfilter
50
51# This is computed as $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
52POTFILES_DEPS = @POTFILES_DEPS@
53
54# This is computed as $(foreach lang, $(LINGUAS), $(srcdir)/$(lang).po)
55POFILES = @POFILES@
56# This is computed as $(foreach lang, $(LINGUAS), $(lang).po-update)
57UPDATEPOFILES = @UPDATEPOFILES@
58# This is computed as $(foreach lang, $(LINGUAS), $(lang).nop)
59DUMMYPOFILES = @DUMMYPOFILES@
60# This is computed as $(foreach lang, $(LINGUAS), $(srcdir)/$(frob $(lang))/$(DOMAIN).resources.dll)
61RESOURCESDLLFILES = @RESOURCESDLLFILES@
62
63# This is computed as
64# $(foreach lang, user-specified subset of $(LINGUAS), $(frob $(lang))/$(DOMAIN).resources.dll)
65CATALOGS = @CSHARPCATALOGS@
66
67SUFFIXES = .sed .sin .nop .po-create .po-update
68
69.sin.sed:
70	sed -e '/^#/d' $< > t-$@
71	mv t-$@ $@
72
73
74all-local: all-local-@USE_NLS@
75
76all-local-yes: stamp-po
77all-local-no:
78
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).
84
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
92# changed.
93stamp-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; \
100	}
101
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.
105
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)'; \
111	else \
112	  msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \
113	fi; \
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" \
118	  $(POTFILES)
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; \
125	    else \
126	      rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
127	      mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
128	    fi; \
129	  else \
130	    mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
131	  fi; \
132	}
133
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
139
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; \
148	else \
149	  $(MAKE) $${lang}.po-create; \
150	fi
151
152
153install-data-local: install-data-local-@USE_NLS@
154install-data-local-no: all-local
155install-data-local-yes: all-local
156	$(mkdir_p) $(DESTDIR)$(pkglibdir)
157	@catalogs='$(CATALOGS)'; \
158	for cat in $$catalogs; do \
159	  $(mkdir_p) $(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"; \
163	done
164
165installdirs-local: installdirs-local-@USE_NLS@
166installdirs-local-no:
167installdirs-local-yes:
168	$(mkdir_p) $(DESTDIR)$(pkglibdir)
169	@catalogs='$(CATALOGS)'; \
170	for cat in $$catalogs; do \
171	  $(mkdir_p) $(DESTDIR)$(pkglibdir)/`echo $$cat | sed -e 's,/[^/]*$$,,'`; \
172	done
173
174uninstall-local: uninstall-local-@USE_NLS@
175uninstall-local-no:
176uninstall-local-yes:
177	catalogs='$(CATALOGS)'; \
178	for cat in $$catalogs; do \
179	  rm -f $(DESTDIR)$(pkglibdir)/$$cat; \
180	done
181
182html ID:
183
184MOSTLYCLEANFILES =
185MOSTLYCLEANFILES += remove-potcdate.sed
186MOSTLYCLEANFILES += stamp-poT
187MOSTLYCLEANFILES += core core.* *.stackdump $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
188
189MAINTAINERCLEANFILES = stamp-po $(RESOURCESDLLFILES)
190
191EXTRA_DIST = remove-potcdate.sin LINGUAS $(POFILES) $(RESOURCESDLLFILES)
192
193# Hidden from automake, but really activated. Works around an automake-1.5 bug.
194#distdir: distdir1
195distdir1:
196	$(MAKE) update-po
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; \
201	  done; \
202	fi
203
204update-po: Makefile
205	$(MAKE) $(DOMAIN).pot-update
206	test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
207	$(MAKE) update-resourcesdll
208
209# General rule for creating PO files.
210
211.nop.po-create:
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; \
214	exit 1
215
216# General rule for updating PO files.
217
218.nop.po-update:
219	@lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
220	tmpdir=`pwd`; \
221	echo "$$lang:"; \
222	test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
223	echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
224	cd $(srcdir); \
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; \
228	  else \
229	    if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
230	      :; \
231	    else \
232	      echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
233	      exit 1; \
234	    fi; \
235	  fi; \
236	else \
237	  echo "msgmerge for $$lang.po failed!" 1>&2; \
238	  rm -f $$tmpdir/$$lang.new.po; \
239	fi
240
241$(DUMMYPOFILES):
242
243update-resourcesdll: Makefile $(RESOURCESDLLFILES)
244	@:
245