mirror of
https://github.com/mirror/make.git
synced 2026-09-04 05:32:57 +08:00
[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.
This commit is contained in:
@@ -1,31 +1,33 @@
|
||||
# -*-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.";
|
||||
$description = "Test the special target .SILENT.";
|
||||
|
||||
$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";
|
||||
run_make_test(q!
|
||||
.PHONY: M a b
|
||||
M: a b
|
||||
.SILENT : b
|
||||
a b: ; echo $@
|
||||
!,
|
||||
'', "echo a\na\nb");
|
||||
|
||||
$example = "EXAMPLE_FILE";
|
||||
run_make_test(q!
|
||||
.PHONY: M a b
|
||||
M: a b
|
||||
.SILENT:
|
||||
a b: ; echo $@
|
||||
!,
|
||||
'', "a\nb");
|
||||
|
||||
open(MAKEFILE,"> $makefile");
|
||||
print MAKEFILE qq!
|
||||
.SILENT : clean
|
||||
clean: ; $CMD_rmfile $example
|
||||
!;
|
||||
close(MAKEFILE);
|
||||
# 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 $@
|
||||
|
||||
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);
|
||||
V =
|
||||
$V.SILENT:
|
||||
M: a b
|
||||
!,
|
||||
'--no-print-directory', "a\nb\necho a\na\necho b\nb");
|
||||
|
||||
1;
|
||||
|
||||
Reference in New Issue
Block a user