1# Makefile for PO directory in any package using GNU gettext.
2# Copyright (C) 1995-1997, 2000-2002 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
3#
4# This file can be copied and used freely without restrictions.  It can
5# be used in projects which are not available under the GNU General Public
6# License but which still want to provide support for the GNU gettext
7# functionality.
8# Please note that the actual code of GNU gettext is covered by the GNU
9# General Public License and is *not* in the public domain.
10
11PACKAGE = libiconv
12VERSION = 1.8
13
14SHELL = /bin/sh
15
16
17srcdir = .
18top_srcdir = ..
19
20
21prefix = /usr/local
22exec_prefix = ${prefix}
23datadir = ${prefix}/share
24localedir = $(datadir)/locale
25gettextsrcdir = $(datadir)/gettext/po
26
27INSTALL = /usr/bin/install -c
28INSTALL_DATA = ${INSTALL} -m 644
29MKINSTALLDIRS = ./autoconf/mkinstalldirs
30mkinstalldirs = $(SHELL) `case "$(MKINSTALLDIRS)" in /*) echo "$(MKINSTALLDIRS)" ;; *) echo "$(top_builddir)/$(MKINSTALLDIRS)" ;; esac`
31
32GMSGFMT = /usr/bin/msgfmt
33MSGFMT = /usr/bin/msgfmt
34XGETTEXT = :
35MSGMERGE = msgmerge
36MSGMERGE_UPDATE = : --update
37MSGINIT = msginit
38MSGCONV = msgconv
39MSGFILTER = msgfilter
40
41POFILES =  de.po
42GMOFILES =  de.gmo
43UPDATEPOFILES =  de.po-update
44DUMMYPOFILES =  de.nop
45DISTFILES.common = Makefile.in.in Makevars remove-potcdate.sin \
46$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
47DISTFILES = $(DISTFILES.common) POTFILES.in $(DOMAIN).pot \
48$(POFILES) $(GMOFILES) \
49$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)
50
51POTFILES = \
52     ../src/iconv.c
53
54CATALOGS =  de.gmo
55
56# Makevars gets inserted here. (Don't remove this line!)
57# Makefile variables for libiconv/po.
58
59# Usually the message domain is the same as the package name.
60DOMAIN = $(PACKAGE)
61
62# These two variables depend on the location of this directory.
63subdir = po
64top_builddir = ..
65
66# These options get passed to xgettext.
67XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
68
69# This is the copyright holder that gets inserted into the header of the
70# $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding
71# package.  (Note that the msgstr strings, extracted from the package's
72# sources, belong to the copyright holder of the package.)  Translators are
73# expected to transfer the copyright for their translations to this person
74# or entity, or to disclaim their copyright.  The empty string stands for
75# the public domain; in this case the translators are expected to disclaim
76# their copyright.
77COPYRIGHT_HOLDER = Free Software Foundation, Inc.
78
79# This is the list of locale categories, beyond LC_MESSAGES, for which the
80# message catalogs shall be used.  It is usually empty.
81EXTRA_LOCALE_CATEGORIES =
82
83.SUFFIXES:
84.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-update
85
86.po.mo:
87	@echo "$(MSGFMT) -c -o $@ $<"; \
88	$(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
89
90.po.gmo:
91	@lang=`echo $* | sed -e 's,.*/,,'`; \
92	test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
93	echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
94	cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
95
96.sin.sed:
97	sed -e '/^#/d' $< > t-$@
98	mv t-$@ $@
99
100
101all: all-yes
102
103all-yes: $(CATALOGS)
104all-no:
105
106# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
107# otherwise packages like GCC can not be built if only parts of the source
108# have been downloaded.
109
110$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
111	$(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
112	  --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
113	  --files-from=$(srcdir)/POTFILES.in \
114	  --copyright-holder='$(COPYRIGHT_HOLDER)'
115	test ! -f $(DOMAIN).po || { \
116	  if test -f $(srcdir)/$(DOMAIN).pot; then \
117	    sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
118	    sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
119	    if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
120	      rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
121	    else \
122	      rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
123	      mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
124	    fi; \
125	  else \
126	    mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
127	  fi; \
128	}
129
130$(srcdir)/$(DOMAIN).pot:
131	$(MAKE) $(DOMAIN).pot-update
132
133$(POFILES): $(srcdir)/$(DOMAIN).pot
134	@lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
135	test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
136	echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
137	cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot
138
139
140install: install-exec install-data
141install-exec:
142install-data: install-data-yes
143	if test "$(PACKAGE)" = "gettext"; then \
144	  $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
145	  for file in $(DISTFILES.common); do \
146	    $(INSTALL_DATA) $(srcdir)/$$file \
147			    $(DESTDIR)$(gettextsrcdir)/$$file; \
148	  done; \
149	else \
150	  : ; \
151	fi
152install-data-no: all
153install-data-yes: all
154	$(mkinstalldirs) $(DESTDIR)$(datadir)
155	@catalogs='$(CATALOGS)'; \
156	for cat in $$catalogs; do \
157	  cat=`basename $$cat`; \
158	  lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
159	  dir=$(localedir)/$$lang/LC_MESSAGES; \
160	  $(mkinstalldirs) $(DESTDIR)$$dir; \
161	  if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
162	  $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
163	  echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
164	  for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
165	    if test -n "$$lc"; then \
166	      if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
167	        link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
168	        mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
169	        mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
170	        (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
171	         for file in *; do \
172	           if test -f $$file; then \
173	             ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
174	           fi; \
175	         done); \
176	        rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
177	      else \
178	        if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
179	          :; \
180	        else \
181	          rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
182	          mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
183	        fi; \
184	      fi; \
185	      rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
186	      ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
187	      ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
188	      cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
189	      echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
190	    fi; \
191	  done; \
192	done
193
194install-strip: install
195
196installdirs: installdirs-exec installdirs-data
197installdirs-exec:
198installdirs-data: installdirs-data-yes
199	if test "$(PACKAGE)" = "gettext"; then \
200	  $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
201	else \
202	  : ; \
203	fi
204installdirs-data-no:
205installdirs-data-yes:
206	$(mkinstalldirs) $(DESTDIR)$(datadir)
207	@catalogs='$(CATALOGS)'; \
208	for cat in $$catalogs; do \
209	  cat=`basename $$cat`; \
210	  lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
211	  dir=$(localedir)/$$lang/LC_MESSAGES; \
212	  $(mkinstalldirs) $(DESTDIR)$$dir; \
213	  for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
214	    if test -n "$$lc"; then \
215	      if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
216	        link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
217	        mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
218	        mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
219	        (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
220	         for file in *; do \
221	           if test -f $$file; then \
222	             ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
223	           fi; \
224	         done); \
225	        rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
226	      else \
227	        if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
228	          :; \
229	        else \
230	          rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
231	          mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
232	        fi; \
233	      fi; \
234	    fi; \
235	  done; \
236	done
237
238# Define this as empty until I found a useful application.
239installcheck:
240
241uninstall: uninstall-exec uninstall-data
242uninstall-exec:
243uninstall-data: uninstall-data-yes
244	if test "$(PACKAGE)" = "gettext"; then \
245	  for file in $(DISTFILES.common); do \
246	    rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
247	  done; \
248	else \
249	  : ; \
250	fi
251uninstall-data-no:
252uninstall-data-yes:
253	catalogs='$(CATALOGS)'; \
254	for cat in $$catalogs; do \
255	  cat=`basename $$cat`; \
256	  lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
257	  for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
258	    rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
259	  done; \
260	done
261
262check: all
263
264dvi info tags TAGS ID:
265
266mostlyclean:
267	rm -f remove-potcdate.sed
268	rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
269	rm -fr *.o
270
271clean: mostlyclean
272
273distclean: clean
274	rm -f Makefile Makefile.in POTFILES *.mo
275
276maintainer-clean: distclean
277	@echo "This command is intended for maintainers to use;"
278	@echo "it deletes files that may require special tools to rebuild."
279	rm -f $(GMOFILES)
280
281distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
282dist distdir:
283	$(MAKE) update-po
284	@$(MAKE) dist2
285# This is a separate target because 'update-po' must be executed before.
286dist2: $(DISTFILES)
287	dists="$(DISTFILES)"; \
288	if test -f $(srcdir)/ChangeLog; then dists="$$dists ChangeLog"; fi; \
289	if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
290	for file in $$dists; do \
291	  if test -f $$file; then \
292	    cp -p $$file $(distdir); \
293	  else \
294	    cp -p $(srcdir)/$$file $(distdir); \
295	  fi; \
296	done
297
298update-po: Makefile
299	$(MAKE) $(DOMAIN).pot-update
300	$(MAKE) $(UPDATEPOFILES)
301	$(MAKE) update-gmo
302
303# General rule for updating PO files.
304
305.nop.po-update:
306	@lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
307	if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; fi; \
308	tmpdir=`pwd`; \
309	echo "$$lang:"; \
310	test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
311	echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
312	cd $(srcdir); \
313	if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
314	  if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
315	    rm -f $$tmpdir/$$lang.new.po; \
316	  else \
317	    if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
318	      :; \
319	    else \
320	      echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
321	      exit 1; \
322	    fi; \
323	  fi; \
324	else \
325	  echo "msgmerge for $$lang.po failed!" 1>&2; \
326	  rm -f $$tmpdir/$$lang.new.po; \
327	fi
328
329$(DUMMYPOFILES):
330
331update-gmo: Makefile $(GMOFILES)
332	@:
333
334Makefile: Makefile.in.in $(top_builddir)/config.status POTFILES.in
335	cd $(top_builddir) \
336	  && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
337	       $(SHELL) ./config.status
338
339force:
340
341# Tell versions [3.59,3.63) of GNU make not to export all variables.
342# Otherwise a system limit (for SysV at least) may be exceeded.
343.NOEXPORT:
344# Special Makefile rules for English message catalogs with quotation marks.
345
346DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot
347
348.SUFFIXES: .insert-header .po-update-en
349
350en@quot.po-update: en@quot.po-update-en
351en@boldquot.po-update: en@boldquot.po-update-en
352
353.insert-header.po-update-en:
354	@lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \
355	if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \
356	tmpdir=`pwd`; \
357	echo "$$lang:"; \
358	ll=`echo $$lang | sed -e 's/@.*//'`; \
359	LC_ALL=C; export LC_ALL; \
360	cd $(srcdir); \
361	if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$ll -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \
362	  if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
363	    rm -f $$tmpdir/$$lang.new.po; \
364	  else \
365	    if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
366	      :; \
367	    else \
368	      echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
369	      exit 1; \
370	    fi; \
371	  fi; \
372	else \
373	  echo "creation of $$lang.po failed!" 1>&2; \
374	  rm -f $$tmpdir/$$lang.new.po; \
375	fi
376
377en@quot.insert-header: insert-header.sin
378	sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header
379
380en@boldquot.insert-header: insert-header.sin
381	sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header
382
383mostlyclean: mostlyclean-quot
384mostlyclean-quot:
385	rm -f *.insert-header
386