make/tests/scripts/targets/SILENT
Paul Smith b5de783f77 [SV 54740] Ensure .SILENT settings do not leak into sub-makes
Create a new variable run_silent to hold the current instance's global
silence setting, allowing silent_flag to represent only whether the -s
option was provided on the command line.

* src/makeint.h: Change silent_flag variable to run_silent.
* src/job.c: Ditto.
* src/remake.c: Ditto.
* src/file.c: Ditto.
* src/main.c: Add a new global variable run_silent.
(decode_switches): After switches are decoded, initialize run_silent.
* tests/scripts/targets/SILENT: Add a test for recursive behavior.
2019-05-19 15:27:26 -04:00

34 lines
572 B
Perl

# -*-perl-*-
$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;