]> granicus.if.org Git - mutt/commitdiff
Check for GNU Make to allow version.h FORCE target.
authorKevin McCarthy <kevin@8t8.us>
Tue, 4 Jun 2019 22:47:57 +0000 (15:47 -0700)
committerKevin McCarthy <kevin@8t8.us>
Thu, 6 Jun 2019 17:38:32 +0000 (10:38 -0700)
If we're using GNU Make, the FORCE target allows automatically
updating the version number after each commit.

See commit 22c6df82

Makefile.am
configure.ac

index 229e10375db7d2d7057a4c76e1208e6a24b56730..14bf141df2c97374629e451196e8b87a27c8da7a 100644 (file)
@@ -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
index 397cec9c5be1b52e0ba00e3c1248b03c22f353e6..a38ae6fd86fdaaa25725f6bb78c307fba7dcefc4 100644 (file)
@@ -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