| 1 |
# -*-perl-*- |
| 2 |
|
| 3 |
$description = "Test the -w option to GNU Make."; |
| 4 |
|
| 5 |
my $enter = "#MAKE#: Entering directory '#PWD#'"; |
| 6 |
my $leave = "#MAKE#: Leaving directory '#PWD#'"; |
| 7 |
|
| 8 |
# Simple test without -w |
| 9 |
run_make_test(q! |
| 10 |
all: ; @echo hi |
| 11 |
!, |
| 12 |
"", "hi\n"); |
| 13 |
|
| 14 |
my $ans = "$enter\nhi\n$leave\n"; |
| 15 |
|
| 16 |
# Simple test with -w |
| 17 |
run_make_test(undef, "-w", $ans); |
| 18 |
|
| 19 |
# Simple test with overriding -w |
| 20 |
run_make_test(undef, "-w --no-print-directory", "hi\n"); |
| 21 |
|
| 22 |
# Simple test with overriding --no-print-directory |
| 23 |
run_make_test(undef, "--no-print-directory --print-directory", $ans); |
| 24 |
|
| 25 |
# Test makefile rebuild to ensure no enter/leave |
| 26 |
run_make_test(q! |
| 27 |
include foo |
| 28 |
all: ;@: |
| 29 |
foo: ; touch foo |
| 30 |
!, |
| 31 |
"", "touch foo\n"); |
| 32 |
unlink('foo'); |
| 33 |
|
| 34 |
$ans = "$enter\ntouch foo\n$leave\n"; |
| 35 |
|
| 36 |
# Test makefile rebuild with -w |
| 37 |
run_make_test(undef, "-w", $ans); |
| 38 |
unlink('foo'); |
| 39 |
|
| 40 |
# Test makefile rebuild with -w overridden |
| 41 |
run_make_test(undef, "-w --no-print-directory", "touch foo\n"); |
| 42 |
unlink('foo'); |
| 43 |
|
| 44 |
# Test makefile rebuild with --no-print-directory overridden |
| 45 |
run_make_test(undef, "--no-print-directory --print-directory", $ans); |
| 46 |
unlink('foo'); |
| 47 |
|
| 48 |
my $enter1 = "#MAKE#[1]: Entering directory '#PWD#'"; |
| 49 |
my $leave1 = "#MAKE#[1]: Leaving directory '#PWD#'"; |
| 50 |
|
| 51 |
$ans = "$enter1\nhi\n$leave1\n"; |
| 52 |
|
| 53 |
# Test makefile recursion with default enter/leave |
| 54 |
run_make_test(q! |
| 55 |
all: ;@$(MAKE) -f #MAKEFILE# recurse |
| 56 |
recurse: ; @echo hi |
| 57 |
!, |
| 58 |
"", $ans); |
| 59 |
|
| 60 |
# Disable enter/leave |
| 61 |
run_make_test(undef, "--no-print-directory", "hi\n"); |
| 62 |
|
| 63 |
# Re-enable enter/leave |
| 64 |
$ans = "$enter\n$ans$leave\n"; |
| 65 |
run_make_test(undef, "--no-print-directory -w", $ans); |
| 66 |
|
| 67 |
# Override enter/leave |
| 68 |
run_make_test(undef, "-w --no-print-directory", "hi\n"); |
| 69 |
|
| 70 |
1; |