mirror of
https://github.com/mirror/make.git
synced 2025-01-09 20:00:28 +08:00
3ec497f8f8
If GNUMAKEFLAGS was not present in the environment when we started, don't add it. * src/main.c (main): Don't mess with GNUMAKEFLAGS unless it exists. * tests/scripts/variables/GNUMAKEFLAGS: Test this behavior.
55 lines
1.6 KiB
Perl
55 lines
1.6 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');
|
|
|
|
# Ensure that we don't add GNUMAKEFLAGS to the environment if it's not there
|
|
run_make_test(q!
|
|
all: ; @env | grep GNUMAKEFLAGS; true
|
|
!,
|
|
'', '');
|
|
|
|
$ENV{GNUMAKEFLAGS} = '-Itst/bad';
|
|
run_make_test(q!
|
|
all: ; @env | grep GNUMAKEFLAGS; true
|
|
!,
|
|
'', 'GNUMAKEFLAGS=');
|
|
|
|
1;
|