mirror of
https://git.savannah.gnu.org/git/make.git
synced 2024-12-27 06:27:51 +00:00
8e024a2532
Previously if --no-print-directory was seen anywhere even once (environment, command line, etc.) it would always take precedence over any --print-directory option. Change this so that the last seen option (which will be the command line, if present there) takes precedence. * NEWS: Mark this change in behavior. * src/makeint.h (print_directory): A new variable to control printing. * src/output.c (output_dump): Use the new variable. (output_start): Ditto. * src/main.c: Add a new variable print_directory. Use -1 for print_directory_flag so we know of the option was seen or not. Add a new default_print_directory_flag set to -1 to keep options from being added. (switches): Use flag_off for --no-print-directory, rather than a separate inhibit_print_directory_flag. (main): If print_directory_flag was set by the user, use that for print_directory. If not, compute the print_directory value based on -s, -C, and sub-makes as before. * tests/scripts/variables/GNUMAKEFLAGS: -w is not added automatically * tests/scripts/options/print-directory: Add tests for overriding print-directory options.
70 lines
1.7 KiB
Perl
70 lines
1.7 KiB
Perl
# -*-perl-*-
|
|
|
|
$description = "Test the -w option to GNU make.";
|
|
|
|
my $enter = "#MAKE#: Entering directory '#PWD#'";
|
|
my $leave = "#MAKE#: Leaving directory '#PWD#'";
|
|
|
|
# Simple test without -w
|
|
run_make_test(q!
|
|
all: ; @echo hi
|
|
!,
|
|
"", "hi\n");
|
|
|
|
my $ans = "$enter\nhi\n$leave\n";
|
|
|
|
# Simple test with -w
|
|
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);
|
|
|
|
# Test makefile rebuild to ensure no enter/leave
|
|
run_make_test(q!
|
|
include foo
|
|
all: ;@:
|
|
foo: ; touch foo
|
|
!,
|
|
"", "touch foo\n");
|
|
unlink('foo');
|
|
|
|
$ans = "$enter\ntouch foo\n$leave\n";
|
|
|
|
# Test makefile rebuild with -w
|
|
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
|
|
run_make_test(q!
|
|
all: ;@$(MAKE) -f #MAKEFILE# recurse
|
|
recurse: ; @echo hi
|
|
!,
|
|
"", $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");
|
|
|
|
1;
|