bug-coreutils
[Top][All Lists]
Advanced

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

[PATCH] GNUmakefile build tweaks.


From: Eric Blake
Subject: [PATCH] GNUmakefile build tweaks.
Date: Mon, 3 Mar 2008 17:56:32 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

* GNUmakefile: When Makefile is not present, make common targets depend
on all to trigger nicer error message.
* configure.ac: If autoconf is new enough, link GNUmakefile into VPATH
builds.

Signed-off-by: Eric Blake <address@hidden>
---
 GNUmakefile  |    5 +++++
 configure.ac |    7 +++++++
 2 files changed, 12 insertions(+), 0 deletions(-)

For the first change, the idea here is that in well-formed GNU packages and 
with GNU make, './configure && make check' or './configure && make install' 
generally work out of the box.  But in an un-configured tree, while 'make' 
complains loudly that configure has not been run yet, 'make check' without the 
patch is less-than-helpful:

$ make
There seems to be no Makefile in this directory.
You must run ./configure before running `make'.
make: *** [all] Error 1
$ make check
make: *** No rule to make target `check'.  Stop.

In contrast, non-GNU makes ignore GNUmakefile altogether, so the user gets a 
consistent message implying that Makefile is not present regardless of what GNU 
Coding Standard targets they requested of make (true, they don't get the 
helpful message to run ./configure, but oh well).  It seems odd that GNU make 
users are on the losing end of this scenario, hence the patch.

[At this point, I'm wondering if GNUmakefile should also check whether 
configure is present, in which case it suggests reading the hacking 
instructions and running ./bootstrap; although that only affects unbootstrapped 
trees, rather than unconfigured trees, so it affects a smaller audience.]

For the second change, it is nice to link GNUmakefile into the VPATH build 
tree, so that a VPATH 'make dist' using GNU make picks up all of the maintainer 
bonus rules (including those in Makefile.maint).  Unfortunately, autoconf 2.61 
AC_CONFIG_LINKS does not support this usage; you need 2.61a.100 or greater.  On 
the other hand, coreutils already relies on newer autoconf anyway.

[I really wish the FSF lawyers would come to a resolution on how to license 
autoconf under GPLv3+ with exception; autoconf 2.62 has been held up long 
enough.]

-- 
Eric Blake


diff --git a/GNUmakefile b/GNUmakefile
index 49e41b7..edb03ad 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -75,6 +75,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 5c332db..6608278 100644
--- a/configure.ac
+++ b/configure.ac
@@ -333,6 +333,13 @@ AC_SUBST([CONFIG_STATUS_DEPENDENCIES])
 AM_GNU_GETTEXT([external], [need-formatstring-macros])
 AM_GNU_GETTEXT_VERSION([0.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])])
+
 AC_CONFIG_FILES(
   Makefile
   doc/Makefile
-- 
1.5.4







reply via email to

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