m4-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GNUmakefile and VPATH


From: Eric Blake
Subject: GNUmakefile and VPATH
Date: Mon, 3 Mar 2008 19:23:05 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

I'm checking this in on the branch: it allows nicer use of GNUmakefile even in 
a VPATH build, getting one step closer to not requiring an in-path build just 
for making a release.  The master branch needs more work to get GNUmakefile 
copied over (more than just this patch); I'll get to it eventually, at least by 
the time we plan on releasing from the master branch.  But in the meantime, we 
can test whether this patch is stable or needs further tweaks; after all, 
coreutils and autoconf use GNUmakefile as well, so it will be nice to settle 
any churn from porting this patch to other projects before porting it to the 
master branch.

From: Eric Blake <address@hidden>
Date: Mon, 3 Mar 2008 10:02:15 -0700
Subject: [PATCH] More maintainer build adjustments.

* configure.ac (AC_CONFIG_LINKS): Link GNUMakefile into VPATH
build tree, but only if autoconf is new enough.
* GNUmakefile (_have-Makefile, _dummy): Don't pollute Makefile.am
namespace.
(_is-dist-target): Support out-of-tree VPATH build.
[!_have-Makefile]: Forward common build targets on to all to get
nicer error messages.
* m4/gnulib-cache.m4: Remove obsolete free module.  Import memchr2
for later use.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog          |   13 +++++++++++++
 GNUmakefile        |   19 +++++++++++++------
 configure.ac       |    7 +++++++
 m4/gnulib-cache.m4 |    4 ++--
 4 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ee2208a..82c830a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2008-03-03  Eric Blake  <address@hidden>
+
+       More maintainer build adjustments.
+       * configure.ac (AC_CONFIG_LINKS): Link GNUMakefile into VPATH
+       build tree, but only if autoconf is new enough.
+       * GNUmakefile (_have-Makefile, _dummy): Don't pollute Makefile.am
+       namespace.
+       (_is-dist-target): Support out-of-tree VPATH build.
+       [!_have-Makefile]: Forward common build targets on to all to get
+       nicer error messages.
+       * m4/gnulib-cache.m4: Remove obsolete free module.  Import memchr2
+       for later use.
+
 2008-02-26  Eric Blake  <address@hidden>
 
        * NEWS: Fix typos.
diff --git a/GNUmakefile b/GNUmakefile
index 4fc9393..7423843 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -32,16 +32,17 @@ else
 SHELL = sh
 endif
 
-have-Makefile := $(shell test -f Makefile && echo yes)
+_have-Makefile := $(shell test -f Makefile && echo yes)
 
 # If the user runs GNU make but has not yet run ./configure,
 # give them a diagnostic.
-ifeq ($(have-Makefile),yes)
+ifeq ($(_have-Makefile),yes)
 
 # Make tar archive easier to reproduce.
 export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner
 
 include Makefile
+
 _curr-ver := $(VERSION)
 
 # Ensure that $(VERSION) is up to date for dist-related targets, but not
@@ -49,21 +50,22 @@ _curr-ver := $(VERSION)
 ifeq (0,$(MAKELEVEL))
   _is-dist-target = $(filter dist% alpha beta major,$(MAKECMDGOALS))
   ifneq (,$(_is-dist-target))
-    _curr-ver := $(shell build-aux/git-version-gen .tarball-version)
+    _curr-ver := $(shell cd $(srcdir) && build-aux/git-version-gen \
+                  $(srcdir)/.tarball-version)
     ifneq ($(_curr-ver),$(VERSION))
       $(info INFO: running autoreconf for new version string: $(_curr-ver))
-      dummy := $(shell rm -rf autom4te.cache; autoreconf)
+      _dummy := $(shell rm -rf autom4te.cache; (cd $(srcdir) && autoreconf))
       _created_version_file = 1
     endif
   endif
 endif
 
 ifneq ($(_curr-ver),$(VERSION))
-  dummy := $(shell echo $(_curr-ver) > .version)
+  _dummy := $(shell echo $(_curr-ver) > .version)
 endif
 
 ifneq ($(_created_version_file),1)
-  dummy := $(shell test -f .version || echo $(VERSION) > .version)
+  _dummy := $(shell test -f .version || echo $(VERSION) > .version)
 endif
 
 include $(srcdir)/Makefile.cfg
@@ -76,6 +78,11 @@ all:
        @echo "You must run ./configure before running \`make'." 1>&2
        @exit 1
 
+check: all
+install: all
+dist: all
+distcheck: all
+
 endif
 
 # Tell version 3.79 and up of GNU make to not build goals in this
diff --git a/configure.ac b/configure.ac
index 2eb699c..5a61691 100644
--- a/configure.ac
+++ b/configure.ac
@@ -162,6 +162,13 @@ M4_WITH_DMALLOC
 
 AC_CONFIG_COMMANDS([stamp-h], [[test -z "$CONFIG_HEADERS" || date > stamp-h]])
 
+dnl Allow maintainer rules under GNU make even in VPATH builds.  This does
+dnl not work in autoconf 2.61 or earlier, but we don't want to require
+dnl non-maintainers to use unreleased autoconf, hence the version test.
+dnl TODO remove the version check once autoconf 2.62 is released.
+m4_if(m4_version_compare([2.61a.100], m4_defn([AC_AUTOCONF_VERSION])), [1], [],
+      [AC_CONFIG_LINKS([GNUmakefile:GNUmakefile])])
+
 AC_CONFIG_FILES([Makefile
                 doc/Makefile
                 lib/Makefile
diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4
index 0dbf39c..eb05868 100644
--- a/m4/gnulib-cache.m4
+++ b/m4/gnulib-cache.m4
@@ -15,11 +15,11 @@
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --local-dir=local --lib=libm4 --source-
base=lib --m4-base=m4 --doc-base=doc --aux-dir=build-aux --with-tests --no-
libtool --macro-prefix=M4 announce-gen assert avltree-oset binary-io clean-temp 
cloexec close-stream closein config-h error fdl fflush flexmember fopen-safer 
free fseeko gendocs getopt git-version-gen gnupload gpl-3.0 intprops memmem 
mkstemp obstack quote regex stdbool stdint stdlib-safer strtod strtol unlocked-
io vasnprintf-posix verror version-etc version-etc-fsf xalloc xprintf 
xvasprintf-posix
+#   gnulib-tool --import --dir=. --local-dir=local --lib=libm4 --source-
base=lib --m4-base=m4 --doc-base=doc --aux-dir=build-aux --with-tests --no-
libtool --macro-prefix=M4 announce-gen assert avltree-oset binary-io clean-temp 
cloexec close-stream closein config-h error fdl fflush flexmember fopen-safer 
fseeko gendocs getopt git-version-gen gnupload gpl-3.0 intprops memchr2 memmem 
mkstemp obstack quote regex stdbool stdint stdlib-safer strtod strtol unlocked-
io vasnprintf-posix verror version-etc version-etc-fsf xalloc xprintf 
xvasprintf-posix
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([local])
-gl_MODULES([announce-gen assert avltree-oset binary-io clean-temp cloexec 
close-stream closein config-h error fdl fflush flexmember fopen-safer free 
fseeko gendocs getopt git-version-gen gnupload gpl-3.0 intprops memmem mkstemp 
obstack quote regex stdbool stdint stdlib-safer strtod strtol unlocked-io 
vasnprintf-posix verror version-etc version-etc-fsf xalloc xprintf xvasprintf-
posix])
+gl_MODULES([announce-gen assert avltree-oset binary-io clean-temp cloexec 
close-stream closein config-h error fdl fflush flexmember fopen-safer fseeko 
gendocs getopt git-version-gen gnupload gpl-3.0 intprops memchr2 memmem mkstemp 
obstack quote regex stdbool stdint stdlib-safer strtod strtol unlocked-io 
vasnprintf-posix verror version-etc version-etc-fsf xalloc xprintf xvasprintf-
posix])
 gl_AVOID([])
 gl_SOURCE_BASE([lib])
 gl_M4_BASE([m4])
-- 
1.5.4







reply via email to

[Prev in Thread] Current Thread [Next in Thread]