* main.c (switches): Add --no-silent to undo -s options.
* 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.
diff --git a/NEWS b/NEWS
index 0dab2ee..9e10a9f 100644
--- a/NEWS
+++ b/NEWS
@@ -33,6 +33,9 @@
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.
+
Version 4.2.1 (10 Jun 2016)
diff --git a/doc/make.texi b/doc/make.texi
index ddf3330..a1aa5d3 100644
--- a/doc/make.texi
+++ b/doc/make.texi
@@ -2945,10 +2945,9 @@
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 @@
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 fa65446..a17b70e 100644
--- a/main.c
+++ b/main.c
@@ -165,6 +165,7 @@
/* 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 @@
/* 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 @@
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 @@
{ '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 @@
"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 d4bd284..5396650 100644
--- a/make.1
+++ b/make.1
@@ -270,19 +270,13 @@
\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
index 0000000..76bffe6
--- /dev/null
+++ b/tests/scripts/options/dash-s
@@ -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;