From: Kevin McCarthy Date: Tue, 4 Jun 2019 22:47:57 +0000 (-0700) Subject: Check for GNU Make to allow version.h FORCE target. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=16bbafe6d569d65c1481990d703c0c7c8a0ac82b;p=mutt Check for GNU Make to allow version.h FORCE target. If we're using GNU Make, the FORCE target allows automatically updating the version number after each commit. See commit 22c6df82 --- 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