#-*- Makefile -*-

# Makefile for PO directory in any package using GNU gettext.
# Copyright (C) 1995-1997, 2000-2006 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
#
# This file can be copied and used freely without restrictions.  It can
# be used in projects which are not available under the GNU General Public
# License but which still want to provide support for the GNU gettext
# functionality.
# Please note that the actual code of GNU gettext is covered by the GNU
# General Public License and is *not* in the public domain.
#
# Origin: gettext-0.16
## Much modified by the R-core team for use in the R project.

## add other languages for the R domain to LINGUAS
## add both RGui-ll.po and RGui-ll.gmo files to RGUI_CATALOGS
RGUI_CATALOGS = \
  RGui-de.po RGui-de.gmo \
  RGui-es.po RGui-es.gmo \
  RGui-fr.po RGui-fr.gmo \
  RGui-it.po RGui-it.gmo \
  RGui-ja.po RGui-ja.gmo \
  RGui-pt_BR.po RGui-pt_BR.gmo \
  RGui-ru.po RGui-ru.gmo \
  RGui-zh_CN.po RGui-zh_CN.gmo \
  RGui-zh_TW.po RGui-zh_TW.gmo

VPATH = @srcdir@
srcdir = @srcdir@
top_srcdir = @top_srcdir@

top_builddir = ..

include $(top_builddir)/Makeconf

Rsharedir = $(DESTDIR)${rsharedir}
Rlocaledir = $(Rsharedir)/locale

mkinstalldirs = $(MKINSTALLDIRS)

GMSGFMT = @GMSGFMT@
MSGFMT = @MSGFMT@
XGETTEXT = @XGETTEXT@
MSGMERGE = msgmerge
MSGMERGE_UPDATE = @MSGMERGE@ --update
MSGINIT = msginit
MSGCONV = msgconv
MSGFILTER = msgfilter

POFILES = @POFILES@
GMOFILES = @GMOFILES@
UPDATEPOFILES = @UPDATEPOFILES@
DUMMYPOFILES = @DUMMYPOFILES@
DISTFILES.common = README RGui.pot THANKS Makefile.in.in Makefile.win remove-potcdate.sin \
$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
DISTFILES = $(DISTFILES.common) Makevars POTFILES.in $(DOMAIN).pot \
$(POFILES) $(GMOFILES) $(RGUI_CATALOGS) \
$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)

POTFILES = \

CATALOGS = @CATALOGS@

# Makevars gets inserted here. (Don't remove this line!)

.SUFFIXES:
.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update .pkg-update

.po.mo:
	@echo "$(MSGFMT) -c -o $@ $<"; \
	$(MSGFMT) -c -o t-$@ $< && mv t-$@ $@

.po.gmo:
	@lang=`echo $* | sed -e 's,.*/,,'`; \
	test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
	echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
	cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo

.sin.sed:
	@sed -e '/^#/d' $< > t-$@
	@mv t-$@ $@

all: all-@USE_NLS@


R: 
	@$(MAKE) install Rsharedir=${top_builddir}/share

all-yes: stamp-po
all-no:

# stamp-po is a timestamp denoting the last time at which the CATALOGS have
# been loosely updated. Its purpose is that when a developer or translator
# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
# invocations of "make" will do nothing. This timestamp would not be necessary
# if updating the $(CATALOGS) would always touch them; however, the rule for
# $(POFILES) has been designed to not touch files that don't need to be
# changed.
stamp-po: $(srcdir)/$(DOMAIN).pot
	@test ! -f $(srcdir)/$(DOMAIN).pot || \
	  test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
	@test ! -f $(srcdir)/$(DOMAIN).pot || { \
	  echo "touch stamp-po" && \
	  echo timestamp > stamp-poT && \
	  mv stamp-poT stamp-po; \
	}

# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
# otherwise packages like GCC can not be built if only parts of the source
# have been downloaded.

# This target rebuilds $(DOMAIN).pot; it is an expensive operation.
# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
	if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \
	  msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
	else \
	  msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \
	fi; \
	$(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
	  --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
	  --files-from=$(srcdir)/POTFILES.in \
	  --copyright-holder='$(COPYRIGHT_HOLDER)' \
	  --msgid-bugs-address="$$msgid_bugs_address"
	test ! -f $(DOMAIN).po || { \
	  if test -f $(srcdir)/$(DOMAIN).pot; then \
	    sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
	    sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
	    if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
	      rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
	    else \
	      rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
	      mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
	    fi; \
	  else \
	    mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
	  fi; \
	}

RGui.pot-update: remove-potcdate.sed
	(cd $(top_srcdir)/src/gnuwin32; $(XGETTEXT) --default-domain=RGui \
	  --keyword= --keyword=G_ --keyword=GN_ \
	  --add-comments=TRANSLATORS: \
	  --copyright-holder='$(COPYRIGHT_HOLDER)' \
	  --msgid-bugs-address='$(MSGID_BUGS_ADDRESS)' \
	   -o - console.c dataentry.c editor.c extra.c pager.c preferences.c rui.c \
	    system.c \
	    ../extra/graphapp/clipboard.c ../extra/graphapp/dialogs.c \
	    ../extra/graphapp/gmenus.c \
	    ../extra/graphapp/metafile.c ../extra/graphapp/printer.c \
	    ../library/grDevices/src/devWindows.c) \
	  > RGui.po
	test ! -f RGui.po || { \
	  if test -f $(srcdir)/RGui.pot; then \
	    sed -f remove-potcdate.sed < $(srcdir)/RGui.pot > RGui.1po && \
	    sed -f remove-potcdate.sed < RGui.po > RGui.2po && \
	    if cmp RGui.1po RGui.2po >/dev/null 2>&1; then \
	      rm -f RGui.1po RGui.2po RGui.po; \
	    else \
	      rm -f RGui.1po RGui.2po $(srcdir)/RGui.pot && \
	      mv RGui.po $(srcdir)/RGui.pot; \
	    fi; \
	  else \
	    mv RGui.po $(srcdir)/RGui.pot; \
	  fi; \
	}

# This rule has no dependencies: we don't need to update $(DOMAIN).pot at
# every "make" invocation, only create it when it is missing.
# Only "make $(DOMAIN).pot-update" or "make update-po" will force an update.
$(srcdir)/$(DOMAIN).pot:
	$(MAKE) $(DOMAIN).pot-update

# This target rebuilds a PO file if $(DOMAIN).pot has changed.
# Note that a PO file is not touched if it doesn't need to be changed.
$(POFILES): $(srcdir)/$(DOMAIN).pot
	@lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
	if test -f "$(srcdir)/$${lang}.po"; then \
	  test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
	  echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
	  cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \
	else \
	  $(MAKE) $${lang}.po-create; \
	fi


install: install-exec install-data
install-exec:
install-data: install-data-@USE_NLS@
install-data-no:
install-data-yes:
	@$(mkinstalldirs) $(Rsharedir)
	@catalogs='$(CATALOGS)'; \
	echo "installing translations:"; \
	for cat in $$catalogs; do \
	  cat=`basename $$cat`; \
	  lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
	  dir=$(Rlocaledir)/$$lang/LC_MESSAGES; \
	  $(mkinstalldirs) $$dir; \
	  if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
	  $(INSTALL_DATA) $$realcat $$dir/$(DOMAIN).mo; \
	  echo "  $$lang"; \
	  for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
	    if test -n "$$lc"; then \
	      if (cd $(Rlocaledir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
	        link=`cd $(Rlocaledir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
	        mv $(Rlocaledir)/$$lang/$$lc $(Rlocaledir)/$$lang/$$lc.old; \
	        mkdir $(Rlocaledir)/$$lang/$$lc; \
	        (cd $(Rlocaledir)/$$lang/$$lc.old && \
	         for file in *; do \
	           if test -f $$file; then \
	             ln -s ../$$link/$$file $(Rlocaledir)/$$lang/$$lc/$$file; \
	           fi; \
	         done); \
	        rm -f $(Rlocaledir)/$$lang/$$lc.old; \
	      else \
	        if test -d $(Rlocaledir)/$$lang/$$lc; then \
	          :; \
	        else \
	          rm -f $(Rlocaledir)/$$lang/$$lc; \
	          mkdir $(Rlocaledir)/$$lang/$$lc; \
	        fi; \
	      fi; \
	      rm -f $(Rlocaledir)/$$lang/$$lc/$(DOMAIN).mo; \
	      ln -s ../LC_MESSAGES/$(DOMAIN).mo $(Rlocaledir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
	      ln $(Rlocaledir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(Rlocaledir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
	      cp -p $(Rlocaledir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(Rlocaledir)/$$lang/$$lc/$(DOMAIN).mo; \
	      echo "  $$lang"; \
	    fi; \
	  done; \
	done

install-strip: install

installdirs: installdirs-exec installdirs-data
installdirs-exec:
installdirs-data: installdirs-data-@USE_NLS@
installdirs-data-no:
installdirs-data-yes:
	$(mkinstalldirs) $(Rsharedir)
	@catalogs='$(CATALOGS)'; \
	for cat in $$catalogs; do \
	  cat=`basename $$cat`; \
	  lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
	  dir=$(Rlocaledir)/$$lang/LC_MESSAGES; \
	  $(mkinstalldirs) $$dir; \
	  for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
	    if test -n "$$lc"; then \
	      if (cd $(Rlocaledir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
	        link=`cd $(Rlocaledir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
	        mv $(Rlocaledir)/$$lang/$$lc $(Rlocaledir)/$$lang/$$lc.old; \
	        mkdir $(Rlocaledir)/$$lang/$$lc; \
	        (cd $(Rlocaledir)/$$lang/$$lc.old && \
	         for file in *; do \
	           if test -f $$file; then \
	             ln -s ../$$link/$$file $(Rlocaledir)/$$lang/$$lc/$$file; \
	           fi; \
	         done); \
	        rm -f $(Rlocaledir)/$$lang/$$lc.old; \
	      else \
	        if test -d $(Rlocaledir)/$$lang/$$lc; then \
	          :; \
	        else \
	          rm -f $(Rlocaledir)/$$lang/$$lc; \
	          mkdir $(Rlocaledir)/$$lang/$$lc; \
	        fi; \
	      fi; \
	    fi; \
	  done; \
	done

# Define this as empty until I found a useful application.
installcheck:

uninstall: uninstall-exec uninstall-data
uninstall-exec:
uninstall-data: uninstall-data-@USE_NLS@
uninstall-data-no:
uninstall-data-yes:
	@catalogs='$(CATALOGS)'; \
	for cat in $$catalogs; do \
	  cat=`basename $$cat`; \
	  lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
	  for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
	    rm -f $(Rlocaledir)/$$lang/$$lc/$(DOMAIN).mo; \
	  done; \
	done

check: all

info dvi ps pdf html tags TAGS ctags CTAGS ID:

mostlyclean:
	@rm -f remove-potcdate.sed
	@rm -f stamp-poT
	@rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
	@rm -fr *.o

clean: mostlyclean

distclean: clean
	@rm -f Makefile Makefile.in POTFILES *.mo

maintainer-clean: distclean
	@echo "This command is intended for maintainers to use;"
	@echo "it deletes files that may require special tools to rebuild."
	rm -f stamp-po $(GMOFILES)

distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
dist distdir:
#	$(MAKE) update-po
	@$(MAKE) dist2
# This is a separate target because 'update-po' must be executed before.
dist2: # $(DISTFILES)
	@dists="$(DISTFILES)"; \
	if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
	for file in $$dists; do \
	  if test -f $$file; then \
	    cp -p $$file $(distdir) || exit 1; \
	  else \
	    cp -p $(srcdir)/$$file $(distdir) || exit 1; \
	  fi; \
	done

update-po: Makefile
	$(MAKE) $(DOMAIN).pot-update
	test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
	$(MAKE) update-gmo

## NB datasets does not have any po, tcltk has src but no tcltk.pot
R_PKGS_PO = base grDevices graphics grid methods splines stats stats4 tcltk tools utils
DUMMYPKGFILES= $(R_PKGS_PO:=.nop)
UPDATEPKGFILES=$(R_PKGS_PO:=.pkg-update)
$(DUMMYPKGFILES):

update-pkg-po: Makefile remove-potcdate.sed en@quot.insert-header $(UPDATEPKGFILES)

R_EXE = $(top_builddir)/bin/R --vanilla

.nop.pkg-update: remove-potcdate.sed en@quot.insert-header
	@pkg=`echo $@ | sed -e 's/\.pkg-update$$//'`; \
	tmpdir=`pwd`; \
	src=$(top_srcdir)/src/library/$${pkg}; \
	test "$(srcdir)" = . && cdcmd="cd ../src/library/$${pkg}/po" || cdcmd="cd $(top_srcdir)/src/library/$${pkg}/po && "; \
	if test -f $${src}/po/$${pkg}.pot; then \
	  echo $(ECHO_N) "updating $${pkg}.pot "$(ECHO_C); \
	  (cd $${src}/src; $(XGETTEXT) \
	   --keyword=_ --keyword=N_ \
	   --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
	   --copyright-holder='$(COPYRIGHT_HOLDER)' \
	   --msgid-bugs-address='$(MSGID_BUGS_ADDRESS)' \
	   -o - `LC_COLLATE=C ls *.c`) > $${pkg}.po ; \
	    sed -f remove-potcdate.sed < $${src}/po/$${pkg}.pot > $${pkg}.1po && \
	    sed -f remove-potcdate.sed < $${pkg}.po > $${pkg}.2po && \
	    if cmp $${pkg}.1po $${pkg}.2po >/dev/null 2>&1; then \
	      rm -f $${pkg}.1po $${pkg}.2po $${pkg}.po; \
	    else \
	      rm -f $${pkg}.1po $${pkg}.2po $${src}/po/$${pkg}.pot && \
	      mv $${pkg}.po $${src}/po/$${pkg}.pot; \
	    fi; \
	  echo "and translations"; \
	  trs=`$${cdcmd} && ls *.po 2> /dev/null`; \
	  trs=`echo $${trs} | sed -e 's/R-[^.]*\.po//g' -e s/en@quot.po//`; \
	  if test -n "$${trs}"; then \
	    for tr in $${trs}; do \
	      lang=`echo $${tr} | sed -e 's/^R-//' -e 's/.po$$//'`; \
	      echo $(ECHO_N) "  $$lang:$(ECHO_C)"; \
	      ($${cdcmd} && $(MSGMERGE_UPDATE) $${tr} $${pkg}.pot); \
	      mkdir -p $(srcdir)/../src/library/$${pkg}/inst/po/$$lang/LC_MESSAGES; \
	      ($${cdcmd} && $(MSGFMT) -c --statistics -o ../inst/po/$$lang/LC_MESSAGES/$${pkg}.mo $${tr}) ; \
	    done; \
	  fi ; \
	  lang=en@quot; \
	  echo $(ECHO_N) "  $$lang:"$(ECHO_C); \
	  psrc=$(top_srcdir)/src/library/$${pkg}/po; \
	  LC_ALL=C; export LC_ALL; \
	  cd $(srcdir); \
	  if $(MSGINIT) -i $${psrc}/$${pkg}.pot --no-translator -l en -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | sed -e s/PACKAGE/R/ -e s/VERSION/$(VERSION)/ | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f $(srcdir)/quot.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \
	    if cmp $${psrc}/$$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
	      rm -f $$tmpdir/$$lang.new.po; \
	    else \
	      if mv -f $$tmpdir/$$lang.new.po $${psrc}/$$lang.po; then \
		:; \
	      else \
		echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
		exit 1; \
	      fi; \
	    fi; \
	    mkdir -p $(srcdir)/../src/library/$${pkg}/inst/po/$$lang/LC_MESSAGES; \
	    ($${cdcmd} && $(MSGFMT) -c -o ../inst/po/$$lang/LC_MESSAGES/$${pkg}.mo $$lang.po) ; \
	    echo " done."; \
	  else \
	    echo "creation of $$lang.po failed!" 1>&2; \
	    rm -f $$tmpdir/$$lang.new.po; \
	  fi ; \
	fi ; \
	cd $$tmpdir; \
	echo $(ECHO_N) "updating R-$${pkg}.pot "$(ECHO_C); \
	src=$(top_srcdir)/src/library/$${pkg}; \
	echo "tools::xgettext2pot('$${src}', 'R-$${pkg}.po')" \
	  | R_DEFAULT_PACKAGES= LC_COLLATE=C $(R_EXE) --slave > /dev/null; \
	sed -f remove-potcdate.sed < $${src}/po/R-$${pkg}.pot > R-$${pkg}.1po && \
	sed -f remove-potcdate.sed < R-$${pkg}.po > R-$${pkg}.2po && \
	if cmp R-$${pkg}.1po R-$${pkg}.2po >/dev/null 2>&1; then \
	  rm -f R-$${pkg}.1po R-$${pkg}.2po R-$${pkg}.po; \
	else \
	  rm -f R-$${pkg}.1po R-$${pkg}.2po $${src}/po/R-$${pkg}.pot && \
	  mv R-$${pkg}.po $${src}/po/R-$${pkg}.pot; \
	fi ; \
	echo "and translations"; \
	trs=`$${cdcmd} && ls R-*.po 2> /dev/null`; \
	trs=`echo $${trs} | sed -e s/R-en@quot.po//`; \
	if test -n "$${trs}"; then \
	  for tr in $${trs}; do \
	    lang=`echo $${tr} | sed -e 's/^R-//' -e 's/.po$$//'`; \
	    echo $(ECHO_N) "  $$lang:$(ECHO_C)"; \
	    ($${cdcmd} && $(MSGMERGE_UPDATE) $${tr} R-$${pkg}.pot); \
	    mkdir -p $(srcdir)/../src/library/$${pkg}/inst/po/$$lang/LC_MESSAGES; \
	    ($${cdcmd} && $(MSGFMT) -c --statistics -o ../inst/po/$$lang/LC_MESSAGES/R-$${pkg}.mo $${tr}) ; \
	  done; \
	fi ; \
	lang=en@quot; \
	echo $(ECHO_N) "  $$lang:$(ECHO_C)"; \
	psrc=$(top_srcdir)/src/library/$${pkg}/po; \
	LC_ALL=C; export LC_ALL; \
	cd $(srcdir); \
	if $(MSGINIT) -i $${psrc}/R-$${pkg}.pot --no-translator -l en -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | sed -e s/PACKAGE/R/ -e s/VERSION/$(VERSION)/ | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f $(srcdir)/quot.sed 2>/dev/null > $$tmpdir/R-$$lang.new.po; then \
	  if cmp $${psrc}/R-$$lang.po $$tmpdir/R-$$lang.new.po >/dev/null 2>&1; then \
	    rm -f $$tmpdir/R-$$lang.new.po; \
	  else \
	    if mv -f $$tmpdir/R-$$lang.new.po $${psrc}/R-$$lang.po; then \
	      :; \
	    else \
	      echo "creation of R-$$lang.po failed: cannot move $$tmpdir/R-$$lang.new.po to R-$$lang.po" 1>&2; \
	      exit 1; \
	    fi; \
	  fi; \
	  mkdir -p $(srcdir)/../src/library/$${pkg}/inst/po/$$lang/LC_MESSAGES; \
	  ($${cdcmd} && $(MSGFMT) -c -o ../inst/po/$$lang/LC_MESSAGES/R-$${pkg}.mo R-$$lang.po) ; \
	  echo " done."; \
	else \
	  echo "creation of R-$$lang.po failed!" 1>&2; \
	  rm -f $$tmpdir/R-$$lang.new.po; \
	fi

# General rule for creating PO files.

.nop.po-create:
	@lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
	echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
	exit 1

# General rule for updating PO files.

.nop.po-update:
	@lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
	tmpdir=`pwd`; \
	echo "$$lang:"; \
	test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
	echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
	cd $(srcdir); \
	if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
	  if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
	    rm -f $$tmpdir/$$lang.new.po; \
	  else \
	    if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
	      :; \
	    else \
	      echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
	      exit 1; \
	    fi; \
	  fi; \
	else \
	  echo "msgmerge for $$lang.po failed!" 1>&2; \
	  rm -f $$tmpdir/$$lang.new.po; \
	fi

$(DUMMYPOFILES):

update-gmo: Makefile $(GMOFILES)
	@:

Makefile: Makefile.in.in $(top_builddir)/config.status @POMAKEFILEDEPS@
	@cd $(top_builddir) \
	  && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
	       $(SHELL) ./config.status

update-RGui: Makefile remove-potcdate.sed RGui.pot-update
	@trs=`cd $(srcdir) && ls RGui-*.po 2> /dev/null`; \
	if test -n "$${trs}"; then \
	  for tr in $${trs}; do \
	    lang=`echo $${tr} | sed -e 's/^RGui-//' -e 's/\.po$$//'`; \
	    out=`echo $${tr} | sed -e 's/\.po$$/.gmo/'`; \
	    echo $(ECHO_N) "  $$lang:$(ECHO_C)"; \
	    (cd $(srcdir) && $(MSGMERGE_UPDATE) $${tr} RGui.pot); \
	    (cd $(srcdir) && $(MSGFMT) -c --statistics -o $${out} $${tr}) ; \
	  done; \
	fi




force:

# Tell versions [3.59,3.63) of GNU make not to export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT: