]> git.ipfire.org Git - thirdparty/make.git/commitdiff
* main.c (switches): Add --no-silent to undo -s options.
authorPaul Smith <psmith@gnu.org>
Wed, 28 Dec 2016 05:23:55 +0000 (00:23 -0500)
committerPaul Smith <psmith@gnu.org>
Wed, 28 Dec 2016 14:25:34 +0000 (09:25 -0500)
* make.1: Document the new flag.
* doc/make.texi: Document the new flag.  Remove suggestions that the
.SILENT special target is deprecated or should not be used.
* tests/scripts/options/dash-s: Test the -s and --no-silent options.
* NEWS: Add information about the new option.

NEWS
doc/make.texi
main.c
make.1
tests/scripts/options/dash-s [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 0dab2ee8913efb0df4c01505aee881f3ca41cb70..9e10a9f2682f035af50d46a81c847dbaf0af7040 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -33,6 +33,9 @@ http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=108&set
   increased to 4095.  That limit includes the subprocess started by
   the $(shell) function.
 
+* A new option --no-silent has been added, that cancels the effect of the
+  -s/--silent/--quiet flag.
+
 \f
 Version 4.2.1 (10 Jun 2016)
 
index ddf3330aba67efbca2ed4c2037da946415c1424e..a1aa5d326fc69d03b967fc357e19d123618d3ed3 100644 (file)
@@ -2945,10 +2945,9 @@ If you specify prerequisites for @code{.SILENT}, then @code{make} will
 not print the recipe used to remake those particular files before
 executing them.  The recipe for @code{.SILENT} is ignored.
 
-If mentioned as a target with no prerequisites, @code{.SILENT} says not
-to print any recipes before executing them.  This usage of
-@samp{.SILENT} is supported only for historical compatibility.  We
-recommend you use the more selective ways to silence specific recipes.
+If mentioned as a target with no prerequisites, @code{.SILENT} says
+not to print any recipes before executing them.  You may also use more
+selective ways to silence specific recipe command lines.
 @xref{Echoing, ,Recipe Echoing}.  If you want to silence all recipes
 for a particular run of @code{make}, use the @samp{-s} or
 @w{@samp{--silent}} option (@pxref{Options Summary}).
@@ -3788,8 +3787,7 @@ The @samp{-s} or @samp{--silent}
 flag to @code{make} prevents all echoing, as if all recipes
 started with @samp{@@}.  A rule in the makefile for the special target
 @code{.SILENT} without prerequisites has the same effect
-(@pxref{Special Targets, ,Special Built-in Target Names}).
-@code{.SILENT} is essentially obsolete since @samp{@@} is more flexible.@refill
+(@pxref{Special Targets, ,Special Built-in Target Names}).@refill
 
 @node Execution, Parallel, Echoing, Recipes
 @section Recipe Execution
diff --git a/main.c b/main.c
index fa65446aef188ff9673249e4cbcb052e961ebcb0..a17b70e8fa9ab804dd61951582055dd66fca2ee8 100644 (file)
--- a/main.c
+++ b/main.c
@@ -165,6 +165,7 @@ int verify_flag;
 /* Nonzero means do not print commands to be executed (-s).  */
 
 int silent_flag;
+static const int default_silent_flag = 0;
 
 /* Nonzero means just touch the files
    that would appear to need remaking (-t)  */
@@ -220,7 +221,7 @@ int no_builtin_variables_flag = 0;
 /* Nonzero means keep going even if remaking some file fails (-k).  */
 
 int keep_going_flag;
-int default_keep_going_flag = 0;
+static const int default_keep_going_flag = 0;
 
 /* Nonzero means check symlink mtimes.  */
 
@@ -389,6 +390,8 @@ static const char *const usage[] =
     N_("\
   -s, --silent, --quiet       Don't echo recipes.\n"),
     N_("\
+  --no-silent                 Echo recipes (disable --silent mode).\n"),
+    N_("\
   -S, --no-keep-going, --stop\n\
                               Turns off -k.\n"),
     N_("\
@@ -434,7 +437,7 @@ static const struct command_switch switches[] =
     { 'r', flag, &no_builtin_rules_flag, 1, 1, 0, 0, 0, "no-builtin-rules" },
     { 'R', flag, &no_builtin_variables_flag, 1, 1, 0, 0, 0,
       "no-builtin-variables" },
-    { 's', flag, &silent_flag, 1, 1, 0, 0, 0, "silent" },
+    { 's', flag, &silent_flag, 1, 1, 0, 0, &default_silent_flag, "silent" },
     { 'S', flag_off, &keep_going_flag, 1, 1, 0, 0, &default_keep_going_flag,
       "no-keep-going" },
     { 't', flag, &touch_flag, 1, 1, 1, 0, 0, "touch" },
@@ -464,7 +467,8 @@ static const struct command_switch switches[] =
       "warn-undefined-variables" },
     { CHAR_MAX+6, strlist, &eval_strings, 1, 0, 0, 0, 0, "eval" },
     { CHAR_MAX+7, string, &sync_mutex, 1, 1, 0, 0, 0, "sync-mutex" },
-    { CHAR_MAX+8, string, &jobserver_auth, 1, 0, 0, 0, 0, "jobserver-fds" },
+    { CHAR_MAX+8, flag_off, &silent_flag, 1, 1, 0, 0, &default_silent_flag, "no-silent" },
+    { CHAR_MAX+9, string, &jobserver_auth, 1, 0, 0, 0, 0, "jobserver-fds" },
     { 0, 0, 0, 0, 0, 0, 0, 0, 0 }
   };
 
diff --git a/make.1 b/make.1
index d4bd2846fbb206655a74a6e203c2ca0d8aa017c7..5396650a1ce6629f0403445246a5fadaa9bccadc 100644 (file)
--- a/make.1
+++ b/make.1
@@ -270,19 +270,13 @@ Don't define any built\-in variables.
 \fB\-s\fR, \fB\-\-silent\fR, \fB\-\-quiet\fR
 Silent operation; do not print the commands as they are executed.
 .TP 0.5i
+.B \-\-no\-silent
+Cancel the effect of the \fB\-s\fR option.
+.TP 0.5i
 \fB\-S\fR, \fB\-\-no\-keep\-going\fR, \fB\-\-stop\fR
 Cancel the effect of the
 .B \-k
 option.
-This is never necessary except in a recursive
-.B make
-where
-.B \-k
-might be inherited from the top-level
-.B make
-via MAKEFLAGS or if you set
-.B \-k
-in MAKEFLAGS in your environment.
 .TP 0.5i
 \fB\-t\fR, \fB\-\-touch\fR
 Touch files (mark them up to date without really changing them)
diff --git a/tests/scripts/options/dash-s b/tests/scripts/options/dash-s
new file mode 100644 (file)
index 0000000..76bffe6
--- /dev/null
@@ -0,0 +1,26 @@
+#                                                                    -*-perl-*-
+
+$description = "Test the -s (silent) and --no-silent options.\n";
+
+run_make_test(q!
+all: one two
+one: ; @echo MAKEFLAGS=$$MAKEFLAGS
+two: ; echo two
+!,
+              '', "MAKEFLAGS=\necho two\ntwo");
+
+run_make_test(undef, '-s', "MAKEFLAGS=s\ntwo");
+run_make_test(undef, '--silent', "MAKEFLAGS=s\ntwo");
+run_make_test(undef, '--quiet', "MAKEFLAGS=s\ntwo");
+
+run_make_test(undef, '--no-silent', "MAKEFLAGS=\necho two\ntwo");
+
+run_make_test(undef, '-s --no-silent', "MAKEFLAGS=\necho two\ntwo");
+run_make_test(undef, '--silent --no-silent', "MAKEFLAGS=\necho two\ntwo");
+run_make_test(undef, '--quiet --no-silent', "MAKEFLAGS=\necho two\ntwo");
+
+run_make_test(undef, '--no-silent -s', "MAKEFLAGS=s\ntwo");
+run_make_test(undef, '--no-silent --silent', "MAKEFLAGS=s\ntwo");
+run_make_test(undef, '--no-silent --quiet', "MAKEFLAGS=s\ntwo");
+
+1;