From e043e9e76d6953676ed870a6f47be9723363b7cb Mon Sep 17 00:00:00 2001 From: Eric Blake 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 --- 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 07301739..e82fcb7e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2008-03-04 Eric Blake + + 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 More maintainer build adjustments. diff --git a/GNUmakefile b/GNUmakefile index 7423843c..1477e089 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 1d6ab39a..b12f7100 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 df89fdba..2e808451 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 5a616913..a8d92002 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 -- 2.11.4.GIT