If this looks okay, I'll push it tomorrow.

--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA
If we're using GNU Make, the FORCE target allows automatically
updating the version number after each commit.

See commit 22c6df82
---
 Makefile.am  | 12 ++++++++++++
 configure.ac |  8 ++++++++
 2 files changed, 20 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 229e1037..14bf141d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -136,8 +136,20 @@ keymap_alldefs.h: $(srcdir)/OPS $(srcdir)/OPS.SIDEBAR $(srcdir)/OPS.PGP $(srcdir
 		$(srcdir)/OPS.MIX $(srcdir)/OPS.CRYPT $(srcdir)/OPS.SMIME \
 			> keymap_alldefs.h
 
+# If we have GNU make, we can use the FORCE target to enable
+# automatic rebuilding of version.h after a commit.
+if GNU_MAKE
+version.h: FORCE
+	echo '#define MUTT_VERSION "'`sh "$(srcdir)/version.sh"`'"' > $@.tmp
+	cmp -s $@ $@.tmp && rm -f $@.tmp || mv $@.tmp $@
+FORCE:
+# On some other versions of make, such as OpenBSD, invoking the
+# version.h target always retriggers targets with that prerequisite, which
+# causes installation issues.
+else
 version.h: $(srcdir)/version.sh
 	echo '#define MUTT_VERSION "'`sh "$(srcdir)/version.sh"`'"' > version.h
+endif
 
 reldate.h: $(srcdir)/mkreldate.sh $(srcdir)/ChangeLog
 	echo 'const char *ReleaseDate = "'`(cd $(srcdir) && ./mkreldate.sh)`'";' > reldate.h
diff --git a/configure.ac b/configure.ac
index 397cec9c..a38ae6fd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,6 +37,14 @@ AC_PROG_MKDIR_P
 AC_PROG_RANLIB
 AC_CHECK_TOOL(AR, ar, ar)
 
+AC_CACHE_CHECK([for GNU make],
+        [mutt_cv_gnu_make_command],
+        [mutt_cv_gnu_make_command="no"
+  if ${MAKE:-make} --version 2> /dev/null | grep "GNU Make" 2>&1 > /dev/null ; then
+          mutt_cv_gnu_make_command="yes"
+  fi])
+AM_CONDITIONAL(GNU_MAKE, test x$mutt_cv_gnu_make_command = xyes)
+
 AC_C_INLINE
 AC_C_CONST
 AC_C_BIGENDIAN
-- 
2.20.1

Attachment: signature.asc
Description: PGP signature

Reply via email to