make/tests/scripts/variables/GNUMAKEFLAGS
Paul Smith 7044e0c93c [SV 59169] Add --debug=why and --debug=print options
Add debug options to print recipes even if they would otherwise be
silent, and to print the reason that a target was considered out of
date.

Modify --trace to simply be a shorthand for --debug=print,why.

* NEWS: Announce changes.
* doc/make.texi (Summary of Options): Document the new options.
* doc/make.1: Ditto.
* src/debug.h: Add new flags DB_PRINT and DB_WHY.
* src/makeint.h: Remove the trace_flag variable.
* src/job.c (start_job_command): Check debug flags not trace_flag.
(new_job): Ditto.
* src/main.c (trace_flag): Make a static variable for switches.
(decode_debug_flags): Set DB_PRINT and DB_WHY if trace_flag is set.
* tests/scripts/variables/GNUMAKEFLAGS: Update known-good messages.
* tests/scripts/variables/MAKEFLAGS: Ditto.
2020-12-05 16:25:12 -05:00

42 lines
1.3 KiB
Perl

# -*-perl-*-
$description = "Test proper behavior of GNUMAKEFLAGS";
# Accept flags from GNUMAKEFLAGS as well as MAKEFLAGS
# Results always go in MAKEFLAGS
$ENV{'GNUMAKEFLAGS'} = '-e -r -R';
run_make_test(q!
all: ; @echo $(MAKEFLAGS)
!,
'', 'erR');
# Long arguments mean everything is prefixed with "-"
$ENV{'GNUMAKEFLAGS'} = '--no-print-directory -e -r -R --trace';
run_make_test(q!
all: ; @echo $(MAKEFLAGS)
!,
'', "#MAKEFILE#:2: update target 'all' due to: target does not exist
echo erR --trace --no-print-directory
erR --trace --no-print-directory");
# Verify that re-exec / recursion doesn't duplicate flags from GNUMAKEFLAGS
unlink('x.mk');
$ENV{GNUMAKEFLAGS} = '-Itst/bad';
run_make_test(q!
recurse: ; @echo $@; echo MAKEFLAGS = $$MAKEFLAGS; echo GNUMAKEFLAGS = $$GNUMAKEFLAGS; #MAKEPATH# -f #MAKEFILE# all
all: ; @echo $@; echo MAKEFLAGS = $$MAKEFLAGS; echo GNUMAKEFLAGS = $$GNUMAKEFLAGS
-include x.mk
x.mk: ; @echo $@; echo MAKEFLAGS = $$MAKEFLAGS; echo GNUMAKEFLAGS = $$GNUMAKEFLAGS; echo > $@
!,
"", "x.mk\nMAKEFLAGS = -Itst/bad\nGNUMAKEFLAGS =\nrecurse\nMAKEFLAGS = -Itst/bad\nGNUMAKEFLAGS =\n#MAKE#[1]: Entering directory '#PWD#'\nall\nMAKEFLAGS = -Itst/bad\nGNUMAKEFLAGS =\n#MAKE#[1]: Leaving directory '#PWD#'\n");
unlink('x.mk');
1;