[Top][All Lists]

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

New module gnu-make

From: Paul Eggert
Subject: New module gnu-make
Date: Thu, 15 Nov 2007 16:03:33 -0800
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

I am starting to port coreutils to Solaris.  Currently "make check"
doesn't work there, due to changes added in August to support parellel
"make check".

A couple of new gnulib modules will make this job easier.

The first module, "gnu-make", addresses the problem that coreutils
currently relies on a GNU Make extension that isn't defined in POSIX.
Adding this feature will make it easy to write Makefiles that can take
advantage of this, by putting something like this into Makefile.am:

        if GNU_MAKE
                [nicer features that work only with GNU Make]
                [fallback features that work in any 'make' implementation]

Automake will turn the "if-else" into either the if-part or the
else-part, so it'll work even on non-GNU make.

For coreutils, the fallback code is kinda crufty and slower; it relies
on "make" invoking itself recursively to get the job done with a funny
flag to prevent undue recursion, which is why I'd prefer taking
advantage of GNU Make if possible here.

The Autoconf Way says that we should split this into individual
features and this can be done if there is a need.  If we go this route, I
suppose the gnu-make module would then test for the union of all GNU
Make features that anybody needs.  For now, there's only one feature
(using % in inference rules) so it's a bit overkill to do that.

2007-11-15  Paul Eggert  <address@hidden>

        New module gnu-make, for determining whether we're using GNU Make.
        * m4/gnu-make.m4: New file.
        * modules/gnu-make: New file.
        * MODULES.html.sh: Mention new module.

diff --git a/MODULES.html.sh b/MODULES.html.sh
index 3f353a7..43f4395 100755
--- a/MODULES.html.sh
+++ b/MODULES.html.sh
@@ -2728,6 +2728,7 @@ func_all_modules ()
   func_echo "$element"

+  func_module gnu-make
   func_module host-os
   func_module perl
   func_module uptime
diff --git a/m4/gnu-make.m4 b/m4/gnu-make.m4
new file mode 100644
index 0000000..472429d
--- /dev/null
+++ b/m4/gnu-make.m4
@@ -0,0 +1,19 @@
+# Determine whether recent-enough GNU Make is being used.
+# Copyright (C) 2007 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+# Written by Paul Eggert.
+# Set GNU_MAKE if we are using a recent-enough version of GNU make.
+# Use --version AND trailing junk, because SGI Make doesn't fail on --version.
+    [${MAKE-make} --version /cannot/make/this >/dev/null 2>&1])
diff --git a/modules/gnu-make b/modules/gnu-make
new file mode 100644
index 0000000..bfbbb1f
--- /dev/null
+++ b/modules/gnu-make
@@ -0,0 +1,28 @@
+Determine whether recent-enough GNU Make is being used.
+##Sample usage of gnu-make module:
+#      [nicer features that work only with GNU Make]
+#      [fallback features that work in any 'make' implementation; see
+#      http://www.opengroup.org/susv3/utilities/make.html
+#      for the 2004 POSIX specification]
+Paul Eggert

reply via email to

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