{
if (! doneany)
DB (DB_BASIC, (_("Removing intermediate files...\n")));
- if (!silent_flag)
+ if (!run_silent)
{
if (! doneany)
{
if (f != 0 && f->is_target)
{
if (f->deps == 0)
- silent_flag = 1;
+ run_silent = 1;
else
for (d = f->deps; d != 0; d = d->next)
for (f2 = d->file; f2 != 0; f2 = f2->prev)
const char *nm;
size_t l;
- if (ignored && silent_flag)
+ if (ignored && run_silent)
return;
if (exit_sig && coredump)
/* Print the command if appropriate. */
if (just_print_flag || trace_flag
- || (!(flags & COMMANDS_SILENT) && !silent_flag))
+ || (!(flags & COMMANDS_SILENT) && !run_silent))
OS (message, 0, "%s", p);
/* Tell update_goal_chain that a command has been started on behalf of
/* Nonzero means do not print commands to be executed (-s). */
-int silent_flag;
+static int silent_flag;
static const int default_silent_flag = 0;
+/* Nonzero means either -s was given, or .SILENT-with-no-deps was seen. */
+
+int run_silent = 0;
+
/* Nonzero means just touch the files
that would appear to need remaking (-t) */
/* If there are any options that need to be decoded do it now. */
decode_debug_flags ();
decode_output_sync_flags ();
+
+ /* Perform any special switch handling. */
+ run_silent = silent_flag;
}
/* Decode switches from environment variable ENVAR (which is LEN chars long).
extern unsigned short stopchar_map[];
-extern int just_print_flag, silent_flag, ignore_errors_flag, keep_going_flag;
+extern int just_print_flag, run_silent, ignore_errors_flag, keep_going_flag;
extern int print_data_base_flag, question_flag, touch_flag, always_make_flag;
extern int env_overrides, no_builtin_rules_flag, no_builtin_variables_flag;
extern int print_version_flag, print_directory_flag, check_symlink_flag;
any commands were actually started for this goal. */
&& file->update_status == us_success && !g->changed
/* Never give a message under -s or -q. */
- && !silent_flag && !question_flag)
+ && !run_silent && !question_flag)
OS (message, 1, ((file->phony || file->cmds == 0)
? _("Nothing to be done for '%s'.")
: _("'%s' is up to date.")),
static enum update_status
touch_file (struct file *file)
{
- if (!silent_flag)
+ if (!run_silent)
OS (message, 0, "touch %s", file->name);
/* Print-only (-n) takes precedence over touch (-t). */
# -*-perl-*-
-$description = "The following tests the special target .SILENT. By simply\n"
- ."mentioning this as a target, it tells make not to print\n"
- ."commands before executing them.";
-
-$details = "This test is the same as the clean test except that it should\n"
- ."not echo its command before deleting the specified file.\n";
-
-$example = "EXAMPLE_FILE";
-
-open(MAKEFILE,"> $makefile");
-print MAKEFILE qq!
-.SILENT : clean
-clean: ; $CMD_rmfile $example
-!;
-close(MAKEFILE);
-
-touch($example);
-
-$answer = '';
-run_make_with_options($makefile,"clean",&get_logfile,0);
-if (-f $example) {
- $test_passed = 0;
-}
-compare_output($answer,&get_logfile(1));
-
-# Just in case
-unlink($example);
+$description = "Test the special target .SILENT.";
+
+run_make_test(q!
+.PHONY: M a b
+M: a b
+.SILENT : b
+a b: ; echo $@
+!,
+ '', "echo a\na\nb");
+
+run_make_test(q!
+.PHONY: M a b
+M: a b
+.SILENT:
+a b: ; echo $@
+!,
+ '', "a\nb");
+
+# SV 54740 : don't inherit .SILENT settings in sub-makes
+run_make_test(q!
+.PHONY: M r a b
+r: a b ; @$(MAKE) -f #MAKEFILE# M V=x
+a b: ; echo $@
+
+V =
+$V.SILENT:
+M: a b
+!,
+ '--no-print-directory', "a\nb\necho a\na\necho b\nb");
1;