2013-09-19 13:15:22 +08:00
|
|
|
# -*-perl-*-
|
|
|
|
|
|
|
|
$description = "Test the -w option to GNU make.";
|
|
|
|
|
2020-03-31 02:07:10 +08:00
|
|
|
my $enter = "#MAKE#: Entering directory '#PWD#'";
|
|
|
|
my $leave = "#MAKE#: Leaving directory '#PWD#'";
|
|
|
|
|
2013-09-19 13:15:22 +08:00
|
|
|
# Simple test without -w
|
|
|
|
run_make_test(q!
|
|
|
|
all: ; @echo hi
|
|
|
|
!,
|
|
|
|
"", "hi\n");
|
|
|
|
|
2020-03-31 02:07:10 +08:00
|
|
|
my $ans = "$enter\nhi\n$leave\n";
|
|
|
|
|
2013-09-19 13:15:22 +08:00
|
|
|
# Simple test with -w
|
2020-03-31 02:07:10 +08:00
|
|
|
run_make_test(undef, "-w", $ans);
|
|
|
|
|
|
|
|
# Simple test with overriding -w
|
|
|
|
run_make_test(undef, "-w --no-print-directory", "hi\n");
|
|
|
|
|
|
|
|
# Simple test with overriding --no-print-directory
|
|
|
|
run_make_test(undef, "--no-print-directory --print-directory", $ans);
|
2013-09-19 13:15:22 +08:00
|
|
|
|
|
|
|
# Test makefile rebuild to ensure no enter/leave
|
|
|
|
run_make_test(q!
|
|
|
|
include foo
|
|
|
|
all: ;@:
|
|
|
|
foo: ; touch foo
|
|
|
|
!,
|
2016-04-10 07:49:27 +08:00
|
|
|
"", "touch foo\n");
|
2013-09-19 13:15:22 +08:00
|
|
|
unlink('foo');
|
|
|
|
|
2020-03-31 02:07:10 +08:00
|
|
|
$ans = "$enter\ntouch foo\n$leave\n";
|
|
|
|
|
2013-09-19 13:15:22 +08:00
|
|
|
# Test makefile rebuild with -w
|
2020-03-31 02:07:10 +08:00
|
|
|
run_make_test(undef, "-w", $ans);
|
|
|
|
unlink('foo');
|
|
|
|
|
|
|
|
# Test makefile rebuild with -w overridden
|
|
|
|
run_make_test(undef, "-w --no-print-directory", "touch foo\n");
|
|
|
|
unlink('foo');
|
|
|
|
|
|
|
|
# Test makefile rebuild with --no-print-directory overridden
|
|
|
|
run_make_test(undef, "--no-print-directory --print-directory", $ans);
|
|
|
|
unlink('foo');
|
|
|
|
|
|
|
|
my $enter1 = "#MAKE#[1]: Entering directory '#PWD#'";
|
|
|
|
my $leave1 = "#MAKE#[1]: Leaving directory '#PWD#'";
|
|
|
|
|
|
|
|
$ans = "$enter1\nhi\n$leave1\n";
|
|
|
|
|
|
|
|
# Test makefile recursion with default enter/leave
|
2013-09-19 13:15:22 +08:00
|
|
|
run_make_test(q!
|
2020-03-31 02:07:10 +08:00
|
|
|
all: ;@$(MAKE) -f #MAKEFILE# recurse
|
|
|
|
recurse: ; @echo hi
|
2013-09-19 13:15:22 +08:00
|
|
|
!,
|
2020-03-31 02:07:10 +08:00
|
|
|
"", $ans);
|
|
|
|
|
|
|
|
# Disable enter/leave
|
|
|
|
run_make_test(undef, "--no-print-directory", "hi\n");
|
|
|
|
|
|
|
|
# Re-enable enter/leave
|
|
|
|
$ans = "$enter\n$ans$leave\n";
|
|
|
|
run_make_test(undef, "--no-print-directory -w", $ans);
|
|
|
|
|
|
|
|
# Override enter/leave
|
|
|
|
run_make_test(undef, "-w --no-print-directory", "hi\n");
|
2013-09-19 13:15:22 +08:00
|
|
|
|
|
|
|
1;
|