m4-patches
[Top][All Lists]
Advanced

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

Re: GNUmakefile and VPATH


From: Eric Blake
Subject: Re: GNUmakefile and VPATH
Date: Tue, 4 Mar 2008 16:51:15 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Eric Blake <ebb9 <at> byu.net> writes:

> However, the automake manual states that "parts of the specification using
> shell variables will be ignored as far as cleaning and distributing is
> concerned".  So how about this workaround?
> 

I'm committing this:

From: Eric Blake <address@hidden>
Date: Tue, 4 Mar 2008 09:17:48 -0700
Subject: [PATCH] Make GNUmakefile work with in-place builds.

* configure.ac (AC_CONFIG_LINKS): Use m4_PACKAGE_VERSION to work
with older autoconf.  Use shell variable to bypass older automake
distclean rules.
* Makefile.am (distclean-local): Remove GNUmakefile link in VPATH
builds, since we bypassed automake.
* GNUmakefile: Collapse redundant lines.
(_is-dist-target): 'distclean' is not a dist target.
* Makefile.maint (vc-diff-check): Support out-of-tree VPATH build.
Reported by Ralf Wildenhues.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog      |   13 +++++++++++++
 GNUmakefile    |   10 ++++------
 Makefile.am    |    5 +++++
 Makefile.maint |    2 +-
 configure.ac   |   11 +++++++++--
 5 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0730173..e82fcb7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2008-03-04  Eric Blake  <address@hidden>
+
+       Make GNUmakefile work with in-place builds.
+       * configure.ac (AC_CONFIG_LINKS): Use m4_PACKAGE_VERSION to work
+       with older autoconf.  Use shell variable to bypass older automake
+       distclean rules.
+       * Makefile.am (distclean-local): Remove GNUmakefile link in VPATH
+       builds, since we bypassed automake.
+       * GNUmakefile: Collapse redundant lines.
+       (_is-dist-target): 'distclean' is not a dist target.
+       * Makefile.maint (vc-diff-check): Support out-of-tree VPATH build.
+       Reported by Ralf Wildenhues.
+
 2008-03-03  Eric Blake  <address@hidden>
 
        More maintainer build adjustments.
diff --git a/GNUmakefile b/GNUmakefile
index 7423843..1477e08 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -48,13 +48,14 @@ _curr-ver := $(VERSION)
 # Ensure that $(VERSION) is up to date for dist-related targets, but not
 # for others: running autoreconf and recompiling everything isn't cheap.
 ifeq (0,$(MAKELEVEL))
-  _is-dist-target = $(filter dist% alpha beta major,$(MAKECMDGOALS))
+  _is-dist-target = $(filter-out %clean, \
+    $(filter dist% alpha beta major,$(MAKECMDGOALS)))
   ifneq (,$(_is-dist-target))
     _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; (cd $(srcdir) && autoreconf))
+      _dummy := $(shell (cd $(srcdir) && rm -rf autom4te.cache && autoreconf))
       _created_version_file = 1
     endif
   endif
@@ -78,10 +79,7 @@ all:
        @echo "You must run ./configure before running \`make'." 1>&2
        @exit 1
 
-check: all
-install: all
-dist: all
-distcheck: all
+check dist distcheck install: all
 
 endif
 
diff --git a/Makefile.am b/Makefile.am
index 1d6ab39..b12f710 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -42,3 +42,8 @@ BUILT_SOURCES = .version
 # tarball, and never in a checked-out repository.
 dist-hook:
        echo $(VERSION) > $(distdir)/.tarball-version
+
+# Arrange to remove the symlink to GNUmakefile in VPATH builds.
+# TODO remove this once automake vs. AC_CONFIG_LINKS issue is fixed.
+distclean-local:
+       if test x"$(VPATH)" != x ; then rm -f GNUmakefile ; fi
diff --git a/Makefile.maint b/Makefile.maint
index df89fdb..2e80845 100644
--- a/Makefile.maint
+++ b/Makefile.maint
@@ -70,7 +70,7 @@ m4-check:
               exit 1; } || :
 
 vc-diff-check:
-       $(VC) diff -- $(srcdir) > vc-diffs || :
+       (CDPATH=; cd $(srcdir) && $(VC) diff) > vc-diffs || :
        if test -s vc-diffs; then                               \
          cat vc-diffs;                                         \
          echo "Some files are locally modified:" 1>&2;         \
diff --git a/configure.ac b/configure.ac
index 5a61691..a8d9200 100644
--- a/configure.ac
+++ b/configure.ac
@@ -166,8 +166,15 @@ 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])])
+dnl Meanwhile, we must use a shell variable so that we bypass automake's
+dnl attempts to remove the sole copy of GNUmakefile in a non-VPATH build
+dnl during 'make distclean'.
+dnl TODO avoid the shell variable once automake is fixed.
+GNUmakefile=GNUmakefile
+m4_if(m4_version_compare([2.61a.100],
+       m4_defn([m4_PACKAGE_VERSION])), [1], [],
+      [AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [],
+       [GNUmakefile=$GNUmakefile])])
 
 AC_CONFIG_FILES([Makefile
                 doc/Makefile
-- 
1.5.4







reply via email to

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