* 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.
This commit is contained in:
Paul Smith 2016-12-28 00:23:55 -05:00
parent a359e32eb5
commit 3daaa4dd3e
5 changed files with 43 additions and 18 deletions

3
NEWS
View File

@ -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.
Version 4.2.1 (10 Jun 2016)

View 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

10
main.c
View File

@ -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 }
};

12
make.1
View File

@ -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)

View File

@ -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;