Enhance build system so that "make V=1" works like the Linux Kernel

If gmake is available, the developer can use "make V=1" instead of
using a configure-time switch, --enable-verbose-makecmds, to see all
of the commands executed by the Makefile.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
bitmap-optimize
Theodore Ts'o 2009-07-02 18:19:10 -04:00
parent 3a4d9869d4
commit bcb915b0d0
4 changed files with 125 additions and 9 deletions

View File

@ -32,16 +32,19 @@ datadir = @datadir@
@SET_MAKE@
E = @E@
Q = @Q@
@ifGNUmake@ V =
@ifGNUmake@ ifeq ($(strip $(V)),)
@ifGNUmake@ # E = @echo
@ifGNUmake@ # Q = @
@ifGNUmake@ E = @E@
@ifGNUmake@ Q = @Q@
@ifGNUmake@ else
@ifGNUmake@ E = @\#
@ifGNUmake@ Q =
@ifGNUmake@ endif
# Uncomment to pretty-print the makefile commands
# E = @echo
# Q = @
#
# Uncomment to show the full makefile commands
# E = @\#
# Q =
@ifNotGNUmake@ E = @E@
@ifNotGNUmake@ Q = @Q@
CC = @CC@
BUILD_CC = @BUILD_CC@

81
aclocal.m4 vendored
View File

@ -2694,3 +2694,84 @@ if test -n "$PKG_CONFIG"; then
fi[]dnl
])# PKG_PROG_PKG_CONFIG
# ===========================================================================
# http://www.nongnu.org/autoconf-archive/check_gnu_make.html
# ===========================================================================
#
# SYNOPSIS
#
# CHECK_GNU_MAKE()
#
# DESCRIPTION
#
# This macro searches for a GNU version of make. If a match is found, the
# makefile variable `ifGNUmake' is set to the empty string, otherwise it
# is set to "#". This is useful for including a special features in a
# Makefile, which cannot be handled by other versions of make. The
# variable _cv_gnu_make_command is set to the command to invoke GNU make
# if it exists, the empty string otherwise.
#
# Here is an example of its use:
#
# Makefile.in might contain:
#
# # A failsafe way of putting a dependency rule into a makefile
# $(DEPEND):
# $(CC) -MM $(srcdir)/*.c > $(DEPEND)
#
# @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
# @ifGNUmake@ include $(DEPEND)
# @ifGNUmake@ endif
#
# Then configure.in would normally contain:
#
# CHECK_GNU_MAKE()
# AC_OUTPUT(Makefile)
#
# Then perhaps to cause gnu make to override any other make, we could do
# something like this (note that GNU make always looks for GNUmakefile
# first):
#
# if ! test x$_cv_gnu_make_command = x ; then
# mv Makefile GNUmakefile
# echo .DEFAULT: > Makefile ;
# echo \ $_cv_gnu_make_command \$@ >> Makefile;
# fi
#
# Then, if any (well almost any) other make is called, and GNU make also
# exists, then the other make wraps the GNU make.
#
# LICENSE
#
# Copyright (c) 2008 John Darrington <j.darrington@elvis.murdoch.edu.au>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved.
#
# Note: Modified by Ted Ts'o to add @ifNotGNUMake@
AC_DEFUN(
[CHECK_GNU_MAKE], [ AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
_cv_gnu_make_command='' ;
dnl Search all the common names for GNU make
for a in "$MAKE" make gmake gnumake ; do
if test -z "$a" ; then continue ; fi ;
if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then
_cv_gnu_make_command=$a ;
break;
fi
done ;
) ;
dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise
if test "x$_cv_gnu_make_command" != "x" ; then
ifGNUmake='' ;
ifNotGNUmake='#' ;
else
ifGNUmake='#' ;
ifNotGNUmake='' ;
AC_MSG_RESULT("Not found");
fi
AC_SUBST(ifGNUmake)
AC_SUBST(ifNotGNUmake)
] )

31
configure vendored
View File

@ -674,6 +674,8 @@ CP
MV
LN_S
LN
ifNotGNUmake
ifGNUmake
BINARY_TYPE
POSUB
LTLIBINTL
@ -11628,6 +11630,35 @@ $as_echo "no" >&6; }
SET_MAKE="MAKE=${MAKE-make}"
fi
{ $as_echo "$as_me:$LINENO: checking for GNU make" >&5
$as_echo_n "checking for GNU make... " >&6; }
if test "${_cv_gnu_make_command+set}" = set; then
$as_echo_n "(cached) " >&6
else
_cv_gnu_make_command='' ;
for a in "$MAKE" make gmake gnumake ; do
if test -z "$a" ; then continue ; fi ;
if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then
_cv_gnu_make_command=$a ;
break;
fi
done ;
fi
{ $as_echo "$as_me:$LINENO: result: $_cv_gnu_make_command" >&5
$as_echo "$_cv_gnu_make_command" >&6; } ;
if test "x$_cv_gnu_make_command" != "x" ; then
ifGNUmake='' ;
ifNotGNUmake='#' ;
else
ifGNUmake='#' ;
ifNotGNUmake='' ;
{ $as_echo "$as_me:$LINENO: result: \"Not found\"" >&5
$as_echo "\"Not found\"" >&6; };
fi
# Extract the first word of "ln", so it can be a program name with args.
set dummy ln; ac_word=$2
{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5

View File

@ -674,6 +674,7 @@ dnl End of configuration options
dnl
AC_SUBST(BINARY_TYPE)
AC_PROG_MAKE_SET
CHECK_GNU_MAKE
AC_PATH_PROG(LN, ln, ln)
AC_PROG_LN_S
AC_PATH_PROG(MV, mv, mv)