gnumakefile: don't squelch _version output
authorEric Blake <eblake@redhat.com>
Tue, 30 Mar 2010 21:56:17 +0000 (15:56 -0600)
committerEric Blake <eblake@redhat.com>
Wed, 31 Mar 2010 20:39:13 +0000 (14:39 -0600)
Borrowing from a trick I discovered on the libvirt list.
More details about how this trick works:

GNU make parses all Makefiles, then checks whether they are
up-to-date, all before making anything else; if any Makefile
timestamps change, then it restarts with the original arguments and
repeats the check for up-to-date Makefiles (assuming that this time
the check will pass).  Since all the rules are parsed before Makefile
is updated, proceeding without reloading Makefiles would result in the
use of the stale $(VERSION) string that was in effect when we first
started, so we must update a timestamp to force the reload.  However,
if we made Makefile depend on _version, we would end up running
_version twice.  So instead, we make _version run a recursive make to
update Makefile (the recursive make skips the rules for checking
whether the version string needs an update, avoiding any extra runs of
_version), then ensure that GNUmakefile has an updated timestamp to
force the reload of the updated Makefile.

* top/GNUmakefile (GNUmakefile): Create one-shot dependency rather
than using $(shell) to run _version target.
(_autoreconf): Run verbosely, by default.

Signed-off-by: Eric Blake <eblake@redhat.com>
ChangeLog
top/GNUmakefile

index 23db960..03d99e7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-03-31  Eric Blake  <eblake@redhat.com>
 
+       gnumakefile: don't squelch _version output
+       * top/GNUmakefile (_version): Create one-shot dependency rather
+       than using $(shell) when version must be regenerated.
+       (_autoreconf): Run verbosely, by default.
+
        sys_time: avoid compiler warnings
        * lib/sys_time.in.h (includes): Ensure gcc pragma is
        unconditional, fixing regression from 2010-03-29.
index 40ccc06..daba47a 100644 (file)
@@ -49,7 +49,7 @@ include $(srcdir)/maint.mk
 
 # Allow cfg.mk to override these.
 _build-aux ?= build-aux
-_autoreconf ?= autoreconf
+_autoreconf ?= autoreconf -v
 
 # Ensure that $(VERSION) is up to date for dist-related targets, but not
 # for others: rerunning autoreconf and recompiling everything isn't cheap.
@@ -78,7 +78,8 @@ ifeq ($(_have-git-version-gen)0,yes$(MAKELEVEL))
           $(info run '$(MAKE) _version' to fix it)
         else
           $(info INFO: running autoreconf for new version string: $(_curr-ver))
-          _dummy := $(shell $(MAKE) $(AM_MAKEFLAGS) _version)
+GNUmakefile: _version
+       touch GNUmakefile
         endif
       endif
     endif
@@ -88,6 +89,7 @@ endif
 .PHONY: _version
 _version:
        cd $(srcdir) && rm -rf autom4te.cache .version && $(_autoreconf)
+       $(MAKE) $(AM_MAKEFLAGS) Makefile
 
 else