On Sat, May 30, 2015, at 12:26, Daiki Ueno wrote:
> Benno Schulenberg <bensb...@justemail.net> writes:
> > the content of the file does not need to be changed, and should therefore
> > not be changed, but the timestamp should be touched/updated so that make
> > (and humans) can see that things are up to date.
> 
> If you think so, could you consider providing a patch and maintaining it
> in gettext?

With the following inlined basic patch, things work the way I would
like.  Attached is a first attempt at a more complete patch.

Please shoot holes in it.  :)

Benno


--- a/gettext-runtime/po/Makefile.in.in
+++ b/gettext-runtime/po/Makefile.in.in
@@ -107,7 +107,7 @@
 
 all: all-@USE_NLS@
 
-all-yes: stamp-po
+all-yes: $(GMOFILES)
 all-no:
 
 # Ensure that the gettext macros and this Makefile.in.in are in sync.
@@ -431,6 +431,9 @@
        test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
        echo "$${cdcmd}$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang $$lang.po 
$(DOMAIN).pot -o $$lang.new.po"; \
        cd $(srcdir); \
+       if test $$lang.po -ot $(DOMAIN).pot; then \
+         touch $$lang.po; \
+       fi;
        if { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
               '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
                 $(MSGMERGE) $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po 
$$lang.po $(DOMAIN).pot;; \

-- 
http://www.fastmail.com - A no graphics, no pop-ups email service

From f613f1ad6bbcd977ddf7461b0764b25eb38ff28b Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensb...@justemail.net>
Date: Mon, 1 Jun 2015 17:50:09 +0200
Subject: [PATCH] po: Make sure that GMO files stay in sync with the PO files.

Also allow maintainers to (partially) restore the old behaviour
by setting the Makevar ALLDEPS to "no".

Signed-off-by: Benno Schulenberg <bensb...@justemail.net>
---
 gettext-runtime/po/Makefile.in.in |   44 ++++++++++++++----------------------
 1 files changed, 17 insertions(+), 27 deletions(-)

diff --git a/gettext-runtime/po/Makefile.in.in b/gettext-runtime/po/Makefile.in.in
index d1ca9d7..2f54784 100644
--- a/gettext-runtime/po/Makefile.in.in
+++ b/gettext-runtime/po/Makefile.in.in
@@ -85,6 +85,11 @@ DISTFILESDEPS_yes = $(DISTFILESDEPS_)
 DISTFILESDEPS_no =
 DISTFILESDEPS = $(DISTFILESDEPS_$(DIST_DEPENDS_ON_UPDATE_PO))
 
+ALLDEPS_ = $(GMOFILES)
+ALLDEPS_yes = $(ALLDEPS_)
+ALLDEPS_no =
+ALLDEPS = $(ALLDEPS_$(ALL_DEPENDS_ON_GMO))
+
 # Makevars gets inserted here. (Don't remove this line!)
 
 .SUFFIXES:
@@ -107,7 +112,7 @@ DISTFILESDEPS = $(DISTFILESDEPS_$(DIST_DEPENDS_ON_UPDATE_PO))
 
 all: all-@USE_NLS@
 
-all-yes: stamp-po
+all-yes: $(ALLDEPS)
 all-no:
 
 # Ensure that the gettext macros and this Makefile.in.in are in sync.
@@ -121,29 +126,12 @@ CHECK_MACRO_VERSION = \
 # internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
 # we don't want to bother translators with empty POT files). We assume that
 # LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty.
-# In this case, stamp-po is a nop (i.e. a phony target).
-
-# 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
-	@$(CHECK_MACRO_VERSION)
-	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.
+# have been downloaded.  Also, there is no point in updating the POT file
+# when you don't have the ability to acquire translations for the new or
+# changed strings.  So updating the POT file should be a deliberate act.
 
 # 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.
@@ -365,7 +353,6 @@ 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
 
@@ -377,20 +364,20 @@ distclean: clean
 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)
+	rm -f $(GMOFILES)
 
 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
 dist distdir:
 	test -z "$(DISTFILESDEPS)" || $(MAKE) $(DISTFILESDEPS)
 	@$(MAKE) dist2
 # This is a separate target because 'update-po' must be executed before.
-dist2: stamp-po $(DISTFILES)
+dist2: $(DISTFILES)
 	dists="$(DISTFILES)"; \
 	if test "$(PACKAGE)" = "gettext-tools"; then \
 	  dists="$$dists Makevars.template"; \
 	fi; \
 	if test -f $(srcdir)/$(DOMAIN).pot; then \
-	  dists="$$dists $(DOMAIN).pot stamp-po"; \
+	  dists="$$dists $(DOMAIN).pot"; \
 	fi; \
 	if test -f $(srcdir)/ChangeLog; then \
 	  dists="$$dists ChangeLog"; \
@@ -415,14 +402,12 @@ update-po: Makefile
 	$(MAKE) update-gmo
 
 # 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$$//'`; \
 	if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \
@@ -431,6 +416,11 @@ update-po: Makefile
 	test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
 	echo "$${cdcmd}$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
 	cd $(srcdir); \
+	# When a PO file doesn't change contentwise, nevertheless make sure its
+	# timestamp is newer than the POT file, to prevent unneeded msgmerges.
+	if test $$lang.po -ot $(DOMAIN).pot; then \
+	  touch $$lang.po; \
+	fi; \
 	if { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
 	       '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
 	         $(MSGMERGE) $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
-- 
1.7.0.4

Reply via email to