automake-commit
[Top][All Lists]
Advanced

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

[Automake-commit] [SCM] GNU Automake branch, maint, updated. v1.12.1-35-


From: Stefano Lattarini
Subject: [Automake-commit] [SCM] GNU Automake branch, maint, updated. v1.12.1-35-gdb16f50
Date: Fri, 15 Jun 2012 09:15:38 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Automake".

http://git.sv.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=db16f500f9176e2da49c46302dbf6d44f2cce2fb

The branch, maint has been updated
       via  db16f500f9176e2da49c46302dbf6d44f2cce2fb (commit)
       via  401a2a82c602f24ed82ce95b2a48cf786198e42d (commit)
       via  61dfb4708e858ee557722b99a3122a0b28af6c59 (commit)
       via  825722a190bcc939abcf129cafd896b4b84d0ecd (commit)
       via  5f6e8015727560fc92d613bb7c531c21a03850ab (commit)
       via  1f009dac2de393da1010a02a678131fac40d496d (commit)
      from  9cb6dc889b95c90f443e7ec30b3541d33ca97ef3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 NEWS                                          |    6 ++
 automake.in                                   |   46 ++++++++---
 doc/automake.texi                             |   49 +++++++++---
 t/list-of-tests.mk                            |    1 +
 t/{silent6.sh => silent-obsolescent-warns.sh} |   48 ++----------
 t/silent6.sh                                  |  110 ++++++++++++-------------
 6 files changed, 136 insertions(+), 124 deletions(-)
 copy t/{silent6.sh => silent-obsolescent-warns.sh} (66%)

diff --git a/NEWS b/NEWS
index b61d58a..347287e 100644
--- a/NEWS
+++ b/NEWS
@@ -76,6 +76,12 @@ New in 1.12.2:
     compiled object file that is in the same directory of a subdir
     object.  See automake bug#10697.
 
+* Silent rules support:
+
+  - A new predefined $(AM_V_P) make variable is provided; it expands
+    to a shell conditional that can be used in recipes to know whether
+    make is being run in silent or verbose mode.
+
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 New in 1.12.1:
diff --git a/automake.in b/automake.in
index 6f8ac0c..cfc48bf 100644
--- a/automake.in
+++ b/automake.in
@@ -1138,15 +1138,19 @@ sub verbose_private_var ($)
     return 'am__v_' . $name;
 }
 
-# define_verbose_var (NAME, VAL)
-# ------------------------------
-# For 'silent-rules' mode, setup VAR and dispatcher, to expand to VAL if 
silent.
-sub define_verbose_var ($$)
-{
-    my ($name, $val) = @_;
+# define_verbose_var (NAME, VAL-IF-SILENT, [VAL-IF-VERBOSE])
+# ----------------------------------------------------------
+# For 'silent-rules' mode, setup VAR and dispatcher, to expand to
+# VAL-IF-SILENT if silent, to VAL-IF-VERBOSE (defaulting to empty)
+# if not.
+sub define_verbose_var ($$;$)
+{
+    my ($name, $silent_val, $verbose_val) = @_;
+    $verbose_val = '' unless defined $verbose_val;
     my $var = verbose_var ($name);
     my $pvar = verbose_private_var ($name);
     my $silent_var = $pvar . '_0';
+    my $verbose_var = $pvar . '_1';
     if (option 'silent-rules')
       {
        # For typical 'make's, 'configure' replaces AM_V (inside @@) with $(V)
@@ -1155,10 +1159,13 @@ sub define_verbose_var ($$)
        # See AM_SILENT_RULES in m4/silent.m4.
        define_variable ($var, '$(' . $pvar . '_@'.'AM_V'.'@)', INTERNAL);
        define_variable ($pvar . '_', '$(' . $pvar . '_@'.'AM_DEFAULT_V'.'@)', 
INTERNAL);
-       Automake::Variable::define ($silent_var, VAR_AUTOMAKE, '', TRUE, $val,
-                                   '', INTERNAL, VAR_ASIS)
+        Automake::Variable::define ($silent_var, VAR_AUTOMAKE, '', TRUE,
+                                    $silent_val, '', INTERNAL, VAR_ASIS)
          if (! vardef ($silent_var, TRUE));
-      }
+        Automake::Variable::define ($verbose_var, VAR_AUTOMAKE, '', TRUE,
+                                    $verbose_val, '', INTERNAL, VAR_ASIS)
+         if (! vardef ($verbose_var, TRUE));
+}
 }
 
 # Above should not be needed in the general automake code.
@@ -1199,7 +1206,6 @@ sub define_verbose_tagvar ($)
     if (option 'silent-rules')
       {
        define_verbose_var ($name, '@echo "  '. $name . ' ' x (8 - length 
($name)) . '" $@;');
-       define_verbose_var ('at', '@');
       }
 }
 
@@ -1226,6 +1232,21 @@ sub define_verbose_libtool ()
     return verbose_flag ('lt');
 }
 
+sub handle_silent ()
+{
+    return unless option 'silent-rules';
+    # Define "$(AM_V_P)", expanding to a shell conditional that can be
+    # used in make recipes to determine whether we are being run in
+    # silent mode or not.  The choice of the name derives from the LISP
+    # convention of appending the letter 'P' to denote a predicate (see
+    # also "the '-P' convention" in the Jargon File); we do so for lack
+    # of a better convention.
+    define_verbose_var ('P', 'false', ':');
+    # *Always* provide the user with 'AM_V_GEN' for 'silent-rules' mode.
+    define_verbose_tagvar ('GEN');
+    define_verbose_var ('at', '@');
+}
+
 
 ################################################################
 
@@ -1583,9 +1604,6 @@ sub handle_languages
          unless defined $done{$languages{'c'}};
        define_linker_variable ($languages{'c'});
       }
-
-    # Always provide the user with 'AM_V_GEN' for 'silent-rules' mode.
-    define_verbose_tagvar ('GEN');
 }
 
 
@@ -8150,6 +8168,8 @@ sub generate_makefile ($$)
   handle_programs;
   handle_scripts;
 
+  handle_silent;
+
   # These must be run after all the sources are scanned.  They
   # use variables defined by &handle_libraries, &handle_ltlibraries,
   # or &handle_programs.
diff --git a/doc/automake.texi b/doc/automake.texi
index 1f4d7db..6c83a13 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -4183,13 +4183,25 @@ For simple projects that distribute all files in the 
same directory
 it is enough to have a single @file{Makefile.am} that builds
 everything in place.
 
-In larger projects it is common to organize files in different
-directories, in a tree.  For instance one directory per program, per
-library or per module.  The traditional approach is to build these
-subdirectories recursively: each directory contains its @file{Makefile}
-(generated from @file{Makefile.am}), and when @command{make} is run
-from the top level directory it enters each subdirectory in turn to
-build its contents.
+In larger projects, it is common to organize files in different
+directories, in a tree.  For example, there could be a directory
+for the program's source, one for the testsuite, and one for the
+documentation; or, for very large projects, there could be one
+directory per program, per library or per module.
+
+The traditional approach is to build these subdirectories recursively,
+employing @emph{make recursion}: each directory contains its
+own @file{Makefile}, and when @command{make} is run from the top-level
+directory, it enters each subdirectory in turn, and invokes there a
+new @command{make} instance to build the directory's contents.
+
+Because this approach is very widespread, Automake offers built-in
+support for it.  However, it is worth nothing that the use of make
+recursion has its own serious issues and drawbacks, and that it's
+well possible to have packages with a multi directory layout that
+make little or no use of such recursion (examples of such packages
+are GNU Bison and GNU Automake itself); see also the @ref{Alternative}
+section below.
 
 @menu
 * Subdirectories::              Building subdirectories recursively
@@ -4203,7 +4215,7 @@ build its contents.
 
 @cindex @code{SUBDIRS}, explained
 
-In packages with subdirectories, the top level @file{Makefile.am} must
+In packages using make recursion, the top level @file{Makefile.am} must
 tell Automake which subdirectories are to be built.  This is done via
 the @code{SUBDIRS} variable.
 @vindex SUBDIRS
@@ -4484,7 +4496,7 @@ variables it cannot ensure the corresponding directory 
exists.
 If you've ever read Peter Miller's excellent paper,
 @uref{http://miller.emu.id.au/pmiller/books/rmch/,
 Recursive Make Considered Harmful}, the preceding sections on the use of
-subdirectories will probably come as unwelcome advice.  For those who
+make recursion will probably come as unwelcome advice.  For those who
 haven't read the paper, Miller's main thesis is that recursive
 @command{make} invocations are both slow and error-prone.
 
@@ -4494,7 +4506,6 @@ believe.  This work is new and there are probably warts.
 to write a single @file{Makefile.am} for a complex multi-directory
 package.
 
-
 By default an installable file specified in a subdirectory will have its
 directory name stripped before installation.  For instance, in this
 example, the header file will be installed as
@@ -10964,15 +10975,31 @@ limitation should go away with time.
 @vindex @code{AM_DEFAULT_VERBOSITY}
 @vindex @code{AM_V}
 @vindex @code{AM_DEFAULT_V}
-To extend the silent mode to your own rules, you have two choices:
+To extend the silent mode to your own rules, you have few choices:
 
 @itemize @bullet
+
 @item
 You can use the predefined variable @code{AM_V_GEN} as a prefix to
 commands that should output a status line in silent mode, and
 @code{AM_V_at} as a prefix to commands that should not output anything
 in silent mode.  When output is to be verbose, both of these variables
 will expand to the empty string.
+
address@hidden
+You can silence a recipe unconditionally with @code{@@}, and then use
+the predefined variable @code{AM_V_P} to know whether make is being run
+in silent or verbose mode, adjust the verbose information your recipe
+displays accordingly:
+
address@hidden
+generate-headers:
+        @set -e; \
+        ... [commands defining a shell variable '$headers'] ...; \
+        if $(AM_V_P); then set -x; else echo " GEN   [headers]"; fi; \
+        rm -f $$headers && generate-header --flags $$headers
address@hidden example
+
 @item
 You can add your own variables, so strings of your own choice are shown.
 The following snippet shows how you would define your own equivalent of
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index c73afda..db7d97b 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -979,6 +979,7 @@ t/silent6.sh \
 t/silent7.sh \
 t/silent8.sh \
 t/silent9.sh \
+t/silent-obsolescent-warns.sh \
 t/silentcxx.sh \
 t/silentcxx-gcc.sh \
 t/silentf77.sh \
diff --git a/t/silent6.sh b/t/silent-obsolescent-warns.sh
similarity index 66%
copy from t/silent6.sh
copy to t/silent-obsolescent-warns.sh
index 280d25a..a95f118 100755
--- a/t/silent6.sh
+++ b/t/silent-obsolescent-warns.sh
@@ -14,7 +14,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Check user extensibility of silent-rules mode.
+# Some checks about silent-rules mode and warnings.
 
 . ./defs || Exit 1
 
@@ -26,65 +26,29 @@ EOF
 cat > Makefile.am <<'EOF'
 my_verbose = $(my_verbose_$(V))
 my_verbose_ = $(my_verbose_$(AM_DEFAULT_VERBOSITY))
-my_verbose_0 = @echo GEN $@;
-
-all-local: foo
-
+my_verbose_0 = @echo " PKG-GEN    $@";
 foo: foo.in
        $(my_verbose)cp $(srcdir)/foo.in $@
-EXTRA_DIST = foo.in
-CLEANFILES = foo
 EOF
 
-: >foo.in
-
 $ACLOCAL
 $AUTOMAKE --add-missing
-$AUTOCONF
-
-./configure --enable-silent-rules
-$MAKE >stdout || { cat stdout; Exit 1; }
-cat stdout
-grep '^ *GEN foo *$' stdout
-grep 'cp ' stdout && Exit 1
-
-$MAKE clean
-$MAKE V=1 >stdout || { cat stdout; Exit 1; }
-cat stdout
-grep 'GEN ' stdout && Exit 1
-grep 'cp \.*/foo\.in foo' stdout
-
-$MAKE distclean
-
-./configure --disable-silent-rules
-$MAKE >stdout || { cat stdout; Exit 1; }
-cat stdout
-grep 'GEN ' stdout && Exit 1
-grep 'cp \.*/foo\.in foo' stdout
-
-$MAKE clean
-$MAKE V=0 >stdout || { cat stdout; Exit 1; }
-cat stdout
-grep '^ *GEN foo *$' stdout
-grep 'cp ' stdout && Exit 1
-
-$MAKE distclean
 
-$sleep
-# Things should also work with -Wall in AM_INIT_AUTOMAKE.
 cat > configure.ac <<'END'
 AC_INIT([silent6], [1.0])
 AM_INIT_AUTOMAKE([-Wall])
 AC_CONFIG_FILES([Makefile])
 END
 
+rm -rf autom4te*.cache
 $ACLOCAL
 AUTOMAKE_fails
+grep 'my_verbose_\$(V.*non-POSIX ' stderr
 $AUTOMAKE -Wno-error
 
 # AM_SILENT_RULES should turn off the warning.
-$sleep
 echo 'AM_SILENT_RULES' >> configure.ac
+rm -rf autom4te*.cache
 $ACLOCAL
 $AUTOMAKE
 grep 'AM_V_GEN' Makefile.in
@@ -92,12 +56,12 @@ $AUTOMAKE --force -Wno-all -Wportability
 grep 'AM_V_GEN' Makefile.in
 
 # The 'silent-rules' option to AM_INIT_AUTOMAKE should work likewise.
-$sleep
 cat > configure.ac <<'END'
 AC_INIT([silent6], [1.0])
 AM_INIT_AUTOMAKE([silent-rules])
 AC_CONFIG_FILES([Makefile])
 END
+rm -rf autom4te*.cache
 $ACLOCAL
 $AUTOMAKE
 grep 'AM_V_GEN' Makefile.in
diff --git a/t/silent6.sh b/t/silent6.sh
index 280d25a..1d67a0c 100755
--- a/t/silent6.sh
+++ b/t/silent6.sh
@@ -20,15 +20,33 @@
 
 cat >>configure.ac <<'EOF'
 AM_SILENT_RULES
+AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
 EOF
 
-cat > Makefile.am <<'EOF'
+# We delegate all the work to the subdir makefile.  This is done
+# to ensure any command-line setting of $(V) gets correctly passed
+# down to recursive make invocations.
+echo SUBDIRS = sub > Makefile.am
+
+mkdir sub
+cat > sub/Makefile.am <<'EOF'
 my_verbose = $(my_verbose_$(V))
 my_verbose_ = $(my_verbose_$(AM_DEFAULT_VERBOSITY))
-my_verbose_0 = @echo GEN $@;
+my_verbose_0 = @echo " XGEN    $@";
+
+all-local: foo gen-headers
 
-all-local: foo
+list = 0 1 2
+.PHONY: gen-headers
+gen-headers:
+       @headers=`for i in $(list); do echo sub/$$i.h; done`; \
+       if $(AM_V_P); then set -x; else \
+         echo " GEN     [headers]"; \
+       fi; \
+       rm -f $$headers || exit 1; \
+## Only fake header generation.
+       : generate-header --flags $$headers
 
 foo: foo.in
        $(my_verbose)cp $(srcdir)/foo.in $@
@@ -36,72 +54,48 @@ EXTRA_DIST = foo.in
 CLEANFILES = foo
 EOF
 
-: >foo.in
+: > sub/foo.in
 
 $ACLOCAL
 $AUTOMAKE --add-missing
 $AUTOCONF
 
-./configure --enable-silent-rules
-$MAKE >stdout || { cat stdout; Exit 1; }
-cat stdout
-grep '^ *GEN foo *$' stdout
-grep 'cp ' stdout && Exit 1
+do_check ()
+{
+  case ${1-} in
+    --silent) silent=:;;
+    --verbose) silent=false;;
+    *) fatal_ "do_check(): incorrect usage";;
+  esac
+  shift
+  $MAKE clean
+  $MAKE ${1+"$@"} >output 2>&1 || { cat output; Exit 1; }
+  sed 's/^/  /' output
+  if $silent; then
+    $FGREP 'cp ' output && Exit 1
+    $FGREP 'generate-header' output && Exit 1
+    $FGREP 'rm -f' output && Exit 1
+    grep '[012]\.h' output && Exit 1
+    grep '^ XGEN    foo$' output
+    grep '^ GEN     \[headers\]$' output
+  else
+    $FGREP 'GEN ' output && Exit 1
+    $FGREP 'cp ./foo.in foo' output
+    $FGREP "rm -f sub/0.h sub/1.h sub/2.h" output
+    $FGREP "generate-header --flags sub/0.h sub/1.h sub/2.h" output
+  fi
+}
 
-$MAKE clean
-$MAKE V=1 >stdout || { cat stdout; Exit 1; }
-cat stdout
-grep 'GEN ' stdout && Exit 1
-grep 'cp \.*/foo\.in foo' stdout
+./configure --enable-silent-rules
+do_check --silent
+do_check --verbose V=1
 
 $MAKE distclean
 
 ./configure --disable-silent-rules
-$MAKE >stdout || { cat stdout; Exit 1; }
-cat stdout
-grep 'GEN ' stdout && Exit 1
-grep 'cp \.*/foo\.in foo' stdout
-
-$MAKE clean
-$MAKE V=0 >stdout || { cat stdout; Exit 1; }
-cat stdout
-grep '^ *GEN foo *$' stdout
-grep 'cp ' stdout && Exit 1
+do_check --verbose
+do_check --silent V=0
 
 $MAKE distclean
 
-$sleep
-# Things should also work with -Wall in AM_INIT_AUTOMAKE.
-cat > configure.ac <<'END'
-AC_INIT([silent6], [1.0])
-AM_INIT_AUTOMAKE([-Wall])
-AC_CONFIG_FILES([Makefile])
-END
-
-$ACLOCAL
-AUTOMAKE_fails
-$AUTOMAKE -Wno-error
-
-# AM_SILENT_RULES should turn off the warning.
-$sleep
-echo 'AM_SILENT_RULES' >> configure.ac
-$ACLOCAL
-$AUTOMAKE
-grep 'AM_V_GEN' Makefile.in
-$AUTOMAKE --force -Wno-all -Wportability
-grep 'AM_V_GEN' Makefile.in
-
-# The 'silent-rules' option to AM_INIT_AUTOMAKE should work likewise.
-$sleep
-cat > configure.ac <<'END'
-AC_INIT([silent6], [1.0])
-AM_INIT_AUTOMAKE([silent-rules])
-AC_CONFIG_FILES([Makefile])
-END
-$ACLOCAL
-$AUTOMAKE
-grep 'AM_V_GEN' Makefile.in
-$AUTOMAKE --force -Wno-all -Wportability
-grep 'AM_V_GEN' Makefile.in
-
 :


hooks/post-receive
-- 
GNU Automake



reply via email to

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