1*63eb84d1Schristos# Makefile for PO directory in any package using GNU gettext.
2*63eb84d1Schristos# Copyright (C) 1995-1997, 2000-2006 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
3*63eb84d1Schristos#
4*63eb84d1Schristos# This file can be copied and used freely without restrictions.  It can
5*63eb84d1Schristos# be used in projects which are not available under the GNU General Public
6*63eb84d1Schristos# License but which still want to provide support for the GNU gettext
7*63eb84d1Schristos# functionality.
8*63eb84d1Schristos# Please note that the actual code of GNU gettext is covered by the GNU
9*63eb84d1Schristos# General Public License and is *not* in the public domain.
10*63eb84d1Schristos#
11*63eb84d1Schristos# Origin: gettext-0.16
12*63eb84d1Schristos
13*63eb84d1SchristosPACKAGE = @PACKAGE@
14*63eb84d1SchristosVERSION = @VERSION@
15*63eb84d1SchristosPACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
16*63eb84d1Schristos
17*63eb84d1SchristosSHELL = /bin/sh
18*63eb84d1Schristos@SET_MAKE@
19*63eb84d1Schristos
20*63eb84d1Schristossrcdir = @srcdir@
21*63eb84d1Schristostop_srcdir = @top_srcdir@
22*63eb84d1SchristosVPATH = @srcdir@
23*63eb84d1Schristos
24*63eb84d1Schristosprefix = @prefix@
25*63eb84d1Schristosexec_prefix = @exec_prefix@
26*63eb84d1Schristosdatarootdir = @datarootdir@
27*63eb84d1Schristosdatadir = @datadir@
28*63eb84d1Schristoslocaledir = @localedir@
29*63eb84d1Schristosgettextsrcdir = $(datadir)/gettext/po
30*63eb84d1Schristos
31*63eb84d1SchristosINSTALL = @INSTALL@
32*63eb84d1SchristosINSTALL_DATA = @INSTALL_DATA@
33*63eb84d1Schristos
34*63eb84d1Schristos# We use $(mkdir_p).
35*63eb84d1Schristos# In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as
36*63eb84d1Schristos# "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions,
37*63eb84d1Schristos# @install_sh@ does not start with $(SHELL), so we add it.
38*63eb84d1Schristos# In automake >= 1.10, @mkdir_p@ is derived from ${MKDIR_P}, which is defined
39*63eb84d1Schristos# either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake
40*63eb84d1Schristos# versions, $(mkinstalldirs) and $(install_sh) are unused.
41*63eb84d1Schristosmkinstalldirs = $(SHELL) @install_sh@ -d
42*63eb84d1Schristosinstall_sh = $(SHELL) @install_sh@
43*63eb84d1SchristosMKDIR_P = @MKDIR_P@
44*63eb84d1Schristosmkdir_p = @mkdir_p@
45*63eb84d1Schristos
46*63eb84d1SchristosGMSGFMT_ = @GMSGFMT@
47*63eb84d1SchristosGMSGFMT_no = @GMSGFMT@
48*63eb84d1SchristosGMSGFMT_yes = @GMSGFMT_015@
49*63eb84d1SchristosGMSGFMT = $(GMSGFMT_$(USE_MSGCTXT))
50*63eb84d1SchristosMSGFMT_ = @MSGFMT@
51*63eb84d1SchristosMSGFMT_no = @MSGFMT@
52*63eb84d1SchristosMSGFMT_yes = @MSGFMT_015@
53*63eb84d1SchristosMSGFMT = $(MSGFMT_$(USE_MSGCTXT))
54*63eb84d1SchristosXGETTEXT_ = @XGETTEXT@
55*63eb84d1SchristosXGETTEXT_no = @XGETTEXT@
56*63eb84d1SchristosXGETTEXT_yes = @XGETTEXT_015@
57*63eb84d1SchristosXGETTEXT = $(XGETTEXT_$(USE_MSGCTXT))
58*63eb84d1SchristosMSGMERGE = msgmerge
59*63eb84d1SchristosMSGMERGE_UPDATE = @MSGMERGE@ --update
60*63eb84d1SchristosMSGINIT = msginit
61*63eb84d1SchristosMSGCONV = msgconv
62*63eb84d1SchristosMSGFILTER = msgfilter
63*63eb84d1Schristos
64*63eb84d1SchristosPOFILES = @POFILES@
65*63eb84d1SchristosGMOFILES = @GMOFILES@
66*63eb84d1SchristosUPDATEPOFILES = @UPDATEPOFILES@
67*63eb84d1SchristosDUMMYPOFILES = @DUMMYPOFILES@
68*63eb84d1SchristosDISTFILES.common = Makefile.in.in remove-potcdate.sin \
69*63eb84d1Schristos$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
70*63eb84d1SchristosDISTFILES = $(DISTFILES.common) Makevars POTFILES.in \
71*63eb84d1Schristos$(POFILES) $(GMOFILES) \
72*63eb84d1Schristos$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)
73*63eb84d1Schristos
74*63eb84d1SchristosPOTFILES = \
75*63eb84d1Schristos
76*63eb84d1SchristosCATALOGS = @CATALOGS@
77*63eb84d1Schristos
78*63eb84d1Schristos# Makevars gets inserted here. (Don't remove this line!)
79*63eb84d1Schristos
80*63eb84d1Schristos.SUFFIXES:
81*63eb84d1Schristos.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update
82*63eb84d1Schristos
83*63eb84d1Schristos.po.mo:
84*63eb84d1Schristos	@echo "$(MSGFMT) -c -o $@ $<"; \
85*63eb84d1Schristos	$(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
86*63eb84d1Schristos
87*63eb84d1Schristos.po.gmo:
88*63eb84d1Schristos	@lang=`echo $* | sed -e 's,.*/,,'`; \
89*63eb84d1Schristos	test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
90*63eb84d1Schristos	echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
91*63eb84d1Schristos	cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
92*63eb84d1Schristos
93*63eb84d1Schristos.sin.sed:
94*63eb84d1Schristos	sed -e '/^#/d' $< > t-$@
95*63eb84d1Schristos	mv t-$@ $@
96*63eb84d1Schristos
97*63eb84d1Schristos
98*63eb84d1Schristosall: all-@USE_NLS@
99*63eb84d1Schristos
100*63eb84d1Schristosall-yes: stamp-po
101*63eb84d1Schristosall-no:
102*63eb84d1Schristos
103*63eb84d1Schristos# $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no
104*63eb84d1Schristos# internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
105*63eb84d1Schristos# we don't want to bother translators with empty POT files). We assume that
106*63eb84d1Schristos# LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty.
107*63eb84d1Schristos# In this case, stamp-po is a nop (i.e. a phony target).
108*63eb84d1Schristos
109*63eb84d1Schristos# stamp-po is a timestamp denoting the last time at which the CATALOGS have
110*63eb84d1Schristos# been loosely updated. Its purpose is that when a developer or translator
111*63eb84d1Schristos# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
112*63eb84d1Schristos# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
113*63eb84d1Schristos# invocations of "make" will do nothing. This timestamp would not be necessary
114*63eb84d1Schristos# if updating the $(CATALOGS) would always touch them; however, the rule for
115*63eb84d1Schristos# $(POFILES) has been designed to not touch files that don't need to be
116*63eb84d1Schristos# changed.
117*63eb84d1Schristosstamp-po: $(srcdir)/$(DOMAIN).pot
118*63eb84d1Schristos	test ! -f $(srcdir)/$(DOMAIN).pot || \
119*63eb84d1Schristos	  test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
120*63eb84d1Schristos	@test ! -f $(srcdir)/$(DOMAIN).pot || { \
121*63eb84d1Schristos	  echo "touch stamp-po" && \
122*63eb84d1Schristos	  echo timestamp > stamp-poT && \
123*63eb84d1Schristos	  mv stamp-poT stamp-po; \
124*63eb84d1Schristos	}
125*63eb84d1Schristos
126*63eb84d1Schristos# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
127*63eb84d1Schristos# otherwise packages like GCC can not be built if only parts of the source
128*63eb84d1Schristos# have been downloaded.
129*63eb84d1Schristos
130*63eb84d1Schristos# This target rebuilds $(DOMAIN).pot; it is an expensive operation.
131*63eb84d1Schristos# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
132*63eb84d1Schristos$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
133*63eb84d1Schristos	if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \
134*63eb84d1Schristos	  msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
135*63eb84d1Schristos	else \
136*63eb84d1Schristos	  msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \
137*63eb84d1Schristos	fi; \
138*63eb84d1Schristos	$(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
139*63eb84d1Schristos	  --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
140*63eb84d1Schristos	  --files-from=$(srcdir)/POTFILES.in \
141*63eb84d1Schristos	  --copyright-holder='$(COPYRIGHT_HOLDER)' \
142*63eb84d1Schristos	  --msgid-bugs-address="$$msgid_bugs_address"
143*63eb84d1Schristos	test ! -f $(DOMAIN).po || { \
144*63eb84d1Schristos	  if test -f $(srcdir)/$(DOMAIN).pot; then \
145*63eb84d1Schristos	    sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
146*63eb84d1Schristos	    sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
147*63eb84d1Schristos	    if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
148*63eb84d1Schristos	      rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
149*63eb84d1Schristos	    else \
150*63eb84d1Schristos	      rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
151*63eb84d1Schristos	      mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
152*63eb84d1Schristos	    fi; \
153*63eb84d1Schristos	  else \
154*63eb84d1Schristos	    mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
155*63eb84d1Schristos	  fi; \
156*63eb84d1Schristos	}
157*63eb84d1Schristos
158*63eb84d1Schristos# This rule has no dependencies: we don't need to update $(DOMAIN).pot at
159*63eb84d1Schristos# every "make" invocation, only create it when it is missing.
160*63eb84d1Schristos# Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
161*63eb84d1Schristos$(srcdir)/$(DOMAIN).pot:
162*63eb84d1Schristos	$(MAKE) $(DOMAIN).pot-update
163*63eb84d1Schristos
164*63eb84d1Schristos# This target rebuilds a PO file if $(DOMAIN).pot has changed.
165*63eb84d1Schristos# Note that a PO file is not touched if it doesn't need to be changed.
166*63eb84d1Schristos$(POFILES): $(srcdir)/$(DOMAIN).pot
167*63eb84d1Schristos	@lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
168*63eb84d1Schristos	if test -f "$(srcdir)/$${lang}.po"; then \
169*63eb84d1Schristos	  test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
170*63eb84d1Schristos	  echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
171*63eb84d1Schristos	  cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \
172*63eb84d1Schristos	else \
173*63eb84d1Schristos	  $(MAKE) $${lang}.po-create; \
174*63eb84d1Schristos	fi
175*63eb84d1Schristos
176*63eb84d1Schristos
177*63eb84d1Schristosinstall: install-exec install-data
178*63eb84d1Schristosinstall-exec:
179*63eb84d1Schristosinstall-data: install-data-@USE_NLS@
180*63eb84d1Schristos	if test "$(PACKAGE)" = "gettext-tools"; then \
181*63eb84d1Schristos	  $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
182*63eb84d1Schristos	  for file in $(DISTFILES.common) Makevars.template; do \
183*63eb84d1Schristos	    $(INSTALL_DATA) $(srcdir)/$$file \
184*63eb84d1Schristos			    $(DESTDIR)$(gettextsrcdir)/$$file; \
185*63eb84d1Schristos	  done; \
186*63eb84d1Schristos	  for file in Makevars; do \
187*63eb84d1Schristos	    rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
188*63eb84d1Schristos	  done; \
189*63eb84d1Schristos	else \
190*63eb84d1Schristos	  : ; \
191*63eb84d1Schristos	fi
192*63eb84d1Schristosinstall-data-no: all
193*63eb84d1Schristosinstall-data-yes: all
194*63eb84d1Schristos	$(mkdir_p) $(DESTDIR)$(datadir)
195*63eb84d1Schristos	@catalogs='$(CATALOGS)'; \
196*63eb84d1Schristos	for cat in $$catalogs; do \
197*63eb84d1Schristos	  cat=`basename $$cat`; \
198*63eb84d1Schristos	  lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
199*63eb84d1Schristos	  dir=$(localedir)/$$lang/LC_MESSAGES; \
200*63eb84d1Schristos	  $(mkdir_p) $(DESTDIR)$$dir; \
201*63eb84d1Schristos	  if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
202*63eb84d1Schristos	  $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
203*63eb84d1Schristos	  echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
204*63eb84d1Schristos	  for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
205*63eb84d1Schristos	    if test -n "$$lc"; then \
206*63eb84d1Schristos	      if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
207*63eb84d1Schristos	        link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
208*63eb84d1Schristos	        mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
209*63eb84d1Schristos	        mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
210*63eb84d1Schristos	        (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
211*63eb84d1Schristos	         for file in *; do \
212*63eb84d1Schristos	           if test -f $$file; then \
213*63eb84d1Schristos	             ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
214*63eb84d1Schristos	           fi; \
215*63eb84d1Schristos	         done); \
216*63eb84d1Schristos	        rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
217*63eb84d1Schristos	      else \
218*63eb84d1Schristos	        if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
219*63eb84d1Schristos	          :; \
220*63eb84d1Schristos	        else \
221*63eb84d1Schristos	          rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
222*63eb84d1Schristos	          mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
223*63eb84d1Schristos	        fi; \
224*63eb84d1Schristos	      fi; \
225*63eb84d1Schristos	      rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
226*63eb84d1Schristos	      ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
227*63eb84d1Schristos	      ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
228*63eb84d1Schristos	      cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
229*63eb84d1Schristos	      echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
230*63eb84d1Schristos	    fi; \
231*63eb84d1Schristos	  done; \
232*63eb84d1Schristos	done
233*63eb84d1Schristos
234*63eb84d1Schristosinstall-strip: install
235*63eb84d1Schristos
236*63eb84d1Schristosinstalldirs: installdirs-exec installdirs-data
237*63eb84d1Schristosinstalldirs-exec:
238*63eb84d1Schristosinstalldirs-data: installdirs-data-@USE_NLS@
239*63eb84d1Schristos	if test "$(PACKAGE)" = "gettext-tools"; then \
240*63eb84d1Schristos	  $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
241*63eb84d1Schristos	else \
242*63eb84d1Schristos	  : ; \
243*63eb84d1Schristos	fi
244*63eb84d1Schristosinstalldirs-data-no:
245*63eb84d1Schristosinstalldirs-data-yes:
246*63eb84d1Schristos	$(mkdir_p) $(DESTDIR)$(datadir)
247*63eb84d1Schristos	@catalogs='$(CATALOGS)'; \
248*63eb84d1Schristos	for cat in $$catalogs; do \
249*63eb84d1Schristos	  cat=`basename $$cat`; \
250*63eb84d1Schristos	  lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
251*63eb84d1Schristos	  dir=$(localedir)/$$lang/LC_MESSAGES; \
252*63eb84d1Schristos	  $(mkdir_p) $(DESTDIR)$$dir; \
253*63eb84d1Schristos	  for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
254*63eb84d1Schristos	    if test -n "$$lc"; then \
255*63eb84d1Schristos	      if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
256*63eb84d1Schristos	        link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
257*63eb84d1Schristos	        mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
258*63eb84d1Schristos	        mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
259*63eb84d1Schristos	        (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
260*63eb84d1Schristos	         for file in *; do \
261*63eb84d1Schristos	           if test -f $$file; then \
262*63eb84d1Schristos	             ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
263*63eb84d1Schristos	           fi; \
264*63eb84d1Schristos	         done); \
265*63eb84d1Schristos	        rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
266*63eb84d1Schristos	      else \
267*63eb84d1Schristos	        if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
268*63eb84d1Schristos	          :; \
269*63eb84d1Schristos	        else \
270*63eb84d1Schristos	          rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
271*63eb84d1Schristos	          mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
272*63eb84d1Schristos	        fi; \
273*63eb84d1Schristos	      fi; \
274*63eb84d1Schristos	    fi; \
275*63eb84d1Schristos	  done; \
276*63eb84d1Schristos	done
277*63eb84d1Schristos
278*63eb84d1Schristos# Define this as empty until I found a useful application.
279*63eb84d1Schristosinstallcheck:
280*63eb84d1Schristos
281*63eb84d1Schristosuninstall: uninstall-exec uninstall-data
282*63eb84d1Schristosuninstall-exec:
283*63eb84d1Schristosuninstall-data: uninstall-data-@USE_NLS@
284*63eb84d1Schristos	if test "$(PACKAGE)" = "gettext-tools"; then \
285*63eb84d1Schristos	  for file in $(DISTFILES.common) Makevars.template; do \
286*63eb84d1Schristos	    rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
287*63eb84d1Schristos	  done; \
288*63eb84d1Schristos	else \
289*63eb84d1Schristos	  : ; \
290*63eb84d1Schristos	fi
291*63eb84d1Schristosuninstall-data-no:
292*63eb84d1Schristosuninstall-data-yes:
293*63eb84d1Schristos	catalogs='$(CATALOGS)'; \
294*63eb84d1Schristos	for cat in $$catalogs; do \
295*63eb84d1Schristos	  cat=`basename $$cat`; \
296*63eb84d1Schristos	  lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
297*63eb84d1Schristos	  for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
298*63eb84d1Schristos	    rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
299*63eb84d1Schristos	  done; \
300*63eb84d1Schristos	done
301*63eb84d1Schristos
302*63eb84d1Schristoscheck: all
303*63eb84d1Schristos
304*63eb84d1Schristosinfo dvi ps pdf html tags TAGS ctags CTAGS ID:
305*63eb84d1Schristos
306*63eb84d1Schristosmostlyclean:
307*63eb84d1Schristos	rm -f remove-potcdate.sed
308*63eb84d1Schristos	rm -f stamp-poT
309*63eb84d1Schristos	rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
310*63eb84d1Schristos	rm -fr *.o
311*63eb84d1Schristos
312*63eb84d1Schristosclean: mostlyclean
313*63eb84d1Schristos
314*63eb84d1Schristosdistclean: clean
315*63eb84d1Schristos	rm -f Makefile Makefile.in POTFILES *.mo
316*63eb84d1Schristos
317*63eb84d1Schristosmaintainer-clean: distclean
318*63eb84d1Schristos	@echo "This command is intended for maintainers to use;"
319*63eb84d1Schristos	@echo "it deletes files that may require special tools to rebuild."
320*63eb84d1Schristos	rm -f stamp-po $(GMOFILES)
321*63eb84d1Schristos
322*63eb84d1Schristosdistdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
323*63eb84d1Schristosdist distdir:
324*63eb84d1Schristos	$(MAKE) update-po
325*63eb84d1Schristos	@$(MAKE) dist2
326*63eb84d1Schristos# This is a separate target because 'update-po' must be executed before.
327*63eb84d1Schristosdist2: stamp-po $(DISTFILES)
328*63eb84d1Schristos	dists="$(DISTFILES)"; \
329*63eb84d1Schristos	if test "$(PACKAGE)" = "gettext-tools"; then \
330*63eb84d1Schristos	  dists="$$dists Makevars.template"; \
331*63eb84d1Schristos	fi; \
332*63eb84d1Schristos	if test -f $(srcdir)/$(DOMAIN).pot; then \
333*63eb84d1Schristos	  dists="$$dists $(DOMAIN).pot stamp-po"; \
334*63eb84d1Schristos	fi; \
335*63eb84d1Schristos	if test -f $(srcdir)/ChangeLog; then \
336*63eb84d1Schristos	  dists="$$dists ChangeLog"; \
337*63eb84d1Schristos	fi; \
338*63eb84d1Schristos	for i in 0 1 2 3 4 5 6 7 8 9; do \
339*63eb84d1Schristos	  if test -f $(srcdir)/ChangeLog.$$i; then \
340*63eb84d1Schristos	    dists="$$dists ChangeLog.$$i"; \
341*63eb84d1Schristos	  fi; \
342*63eb84d1Schristos	done; \
343*63eb84d1Schristos	if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
344*63eb84d1Schristos	for file in $$dists; do \
345*63eb84d1Schristos	  if test -f $$file; then \
346*63eb84d1Schristos	    cp -p $$file $(distdir) || exit 1; \
347*63eb84d1Schristos	  else \
348*63eb84d1Schristos	    cp -p $(srcdir)/$$file $(distdir) || exit 1; \
349*63eb84d1Schristos	  fi; \
350*63eb84d1Schristos	done
351*63eb84d1Schristos
352*63eb84d1Schristosupdate-po: Makefile
353*63eb84d1Schristos	$(MAKE) $(DOMAIN).pot-update
354*63eb84d1Schristos	test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
355*63eb84d1Schristos	$(MAKE) update-gmo
356*63eb84d1Schristos
357*63eb84d1Schristos# General rule for creating PO files.
358*63eb84d1Schristos
359*63eb84d1Schristos.nop.po-create:
360*63eb84d1Schristos	@lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
361*63eb84d1Schristos	echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
362*63eb84d1Schristos	exit 1
363*63eb84d1Schristos
364*63eb84d1Schristos# General rule for updating PO files.
365*63eb84d1Schristos
366*63eb84d1Schristos.nop.po-update:
367*63eb84d1Schristos	@lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
368*63eb84d1Schristos	if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \
369*63eb84d1Schristos	tmpdir=`pwd`; \
370*63eb84d1Schristos	echo "$$lang:"; \
371*63eb84d1Schristos	test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
372*63eb84d1Schristos	echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
373*63eb84d1Schristos	cd $(srcdir); \
374*63eb84d1Schristos	if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
375*63eb84d1Schristos	  if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
376*63eb84d1Schristos	    rm -f $$tmpdir/$$lang.new.po; \
377*63eb84d1Schristos	  else \
378*63eb84d1Schristos	    if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
379*63eb84d1Schristos	      :; \
380*63eb84d1Schristos	    else \
381*63eb84d1Schristos	      echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
382*63eb84d1Schristos	      exit 1; \
383*63eb84d1Schristos	    fi; \
384*63eb84d1Schristos	  fi; \
385*63eb84d1Schristos	else \
386*63eb84d1Schristos	  echo "msgmerge for $$lang.po failed!" 1>&2; \
387*63eb84d1Schristos	  rm -f $$tmpdir/$$lang.new.po; \
388*63eb84d1Schristos	fi
389*63eb84d1Schristos
390*63eb84d1Schristos$(DUMMYPOFILES):
391*63eb84d1Schristos
392*63eb84d1Schristosupdate-gmo: Makefile $(GMOFILES)
393*63eb84d1Schristos	@:
394*63eb84d1Schristos
395*63eb84d1SchristosMakefile: Makefile.in.in Makevars $(top_builddir)/config.status @POMAKEFILEDEPS@
396*63eb84d1Schristos	cd $(top_builddir) \
397*63eb84d1Schristos	  && $(SHELL) ./config.status $(subdir)/$@.in po-directories
398*63eb84d1Schristos
399*63eb84d1Schristosforce:
400*63eb84d1Schristos
401*63eb84d1Schristos# Tell versions [3.59,3.63) of GNU make not to export all variables.
402*63eb84d1Schristos# Otherwise a system limit (for SysV at least) may be exceeded.
403*63eb84d1Schristos.NOEXPORT:
404