[Top][All Lists]
[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:19:28 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Jim Meyering <jim <at> meyering.net> writes:
>
> Nice. I like it.
> I'll wait a few hours before applying it, this time
>
> > (Should we also have a distclean-local rule in Makefile.am that removes
> > the GNUmakefile symlink in VPATH builds, but is a no-op in in-place builds?)
>
> That would be um, clean.
>
Thanks for waiting. Here's the improved patch, tested with both in-place and
VPATH builds. And in the process of testing, I noticed that 'make distclean'
was triggering an autoreconf to update the version stamp - a rather pointless
waste of time, if you ask me, since the tree is about to be nuked.
From: Eric Blake <address@hidden>
Date: Tue, 4 Mar 2008 09:08:59 -0700
Subject: [PATCH] Reinstate GNUmakefile patch, but with workaround for automake.
* configure.ac (AC_CONFIG_LINKS): Use shell variable to bypass
automake distclean rules.
* Makefile.am (distclean-local): Clean GNUmakefile in VPATH builds,
since we are bypassing automake.
* GNUmakefile (_is-dist-target): 'distclean' is not a dist target.
Signed-off-by: Eric Blake <address@hidden>
---
GNUmakefile | 3 ++-
Makefile.am | 5 +++++
configure.ac | 16 +++++++++-------
3 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/GNUmakefile b/GNUmakefile
index 2fce1fd..95758f5 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -45,7 +45,8 @@ _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)
diff --git a/Makefile.am b/Makefile.am
index 67f4934..2862940 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -94,6 +94,11 @@ gen-ChangeLog:
distcheck-hook: check-ls-dircolors
$(MAKE) my-distcheck
+# 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
+
DISTCLEANFILES = VERSION
MAINTAINERCLEANFILES = THANKS-to-translators
THANKS-to-translators: po/LINGUAS THANKStt.in
diff --git a/configure.ac b/configure.ac
index d55b2da..cc4e152 100644
--- a/configure.ac
+++ b/configure.ac
@@ -337,13 +337,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.
-
-dnl Disabled for now, since this would cause "make distclean" to
-dnl remove the sole copy of GNUmakefile in a non-VPATH build.
-dnl TODO restore once automake has been fixed to do the right thing.
-dnl m4_if(m4_version_compare([2.61a.100],
-dnl m4_defn([m4_PACKAGE_VERSION])), [1], [],
-dnl [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
--
1.5.4