Index: Makefile.in.in
===================================================================
RCS file: /home/noa/cvsroot/melker/po/Makefile.in.in,v
retrieving revision 1.1
diff -u -r1.1 Makefile.in.in
--- Makefile.in.in	13 Oct 2002 10:47:32 -0000	1.1
+++ Makefile.in.in	13 Oct 2002 13:46:15 -0000
@@ -80,7 +80,7 @@
 	$(MSGFMT) -o $@ $<
 
 .po.gmo:
-	file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
+	file=`echo $* | sed 's,.*/,,'`.gmo \
 	  && rm -f $$file && $(GMSGFMT) -o $$file $<
 
 .po.cat:
@@ -179,8 +179,14 @@
 
 clean: mostlyclean
 
+# If $srcdir != $builddir then some files gets copied to builddir for the
+# intltools to find them. The distcheck target from recent automake
+# doesn't tolerate leftover files in builddir so we remove them in this case.
 distclean: clean
 	rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
+	if test "$(srcdir)" != "."; then\
+	  rm -f *.po *.pot *.gmo; \
+	fi;
 
 maintainer-clean: distclean
 	@echo "This command is intended for maintainers to use;"
@@ -197,14 +203,19 @@
 
 update-po: Makefile
 	$(MAKE) $(GETTEXT_PACKAGE).pot
+	if test ! -r $(GETTEXT_PACKAGE).pot; then \
+	  cp $(srcdir)/$(GETTEXT_PACKAGE).pot $(GETTEXT_PACKAGE).pot; \
+	fi; \
 	PATH=`pwd`/../src:$$PATH; \
-	cd $(srcdir); \
 	catalogs='$(CATALOGS)'; \
 	for cat in $$catalogs; do \
 	  cat=`basename $$cat`; \
 	  lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
-	  cp $$lang.po $$lang.old.po; \
+	  cp -f $(srcdir)/$$lang.po $$lang.old.po; \
 	  echo "$$lang:"; \
+          if test -f $$lang.po -a ! -w $$lang.po; then \
+	    chmod u+w $$lang.po; \
+	  fi; \
 	  if $(MSGMERGE) $$lang; then \
 	    rm -f $$lang.old.po; \
 	  else \
