mirror of
https://git.savannah.gnu.org/git/make.git
synced 2024-12-28 15:57:48 +00:00
d7ff21ecd7
Ensure that variable overrides are passed to recursive make instances even if no overrides were provided on the command line. Fix suggested by Rici Lake <ricilake@gmail.com> * src/main.c (define_makeflags): Add overrides without respect to the value of command_variables. * tests/scripts/features/recursion: Add a test.
67 lines
1.6 KiB
Perl
67 lines
1.6 KiB
Perl
# -*-perl-*-
|
|
$description = "Test recursion.";
|
|
|
|
$details = "DETAILS";
|
|
|
|
# Test some basic recursion.
|
|
run_make_test('
|
|
.RECIPEPREFIX := |
|
|
all:
|
|
| $(MAKE) -f #MAKEFILE# foo
|
|
foo:
|
|
| @echo $(MAKE)
|
|
| @echo MAKELEVEL = $(MAKELEVEL)
|
|
| $(MAKE) -f #MAKEFILE# last
|
|
last:
|
|
| @echo $(MAKE)
|
|
| @echo MAKELEVEL = $(MAKELEVEL)
|
|
| @echo THE END
|
|
',
|
|
('CFLAGS=-O -w' . ($parallel_jobs ? ' -j 2' : '')),
|
|
($vos
|
|
? "#MAKE#: Entering directory '#PWD#'
|
|
make 'CFLAGS=-O' -f #MAKEFILE# foo
|
|
make CFLAGS=-O
|
|
MAKELEVEL = 0
|
|
make 'CFLAGS=-O' -f #MAKEFILE# last
|
|
make CFLAGS=-O
|
|
MAKELEVEL = 0
|
|
THE END
|
|
#MAKE#: Leaving directory '#PWD#'"
|
|
: "#MAKE#: Entering directory '#PWD#'
|
|
#MAKEPATH# -f #MAKEFILE# foo
|
|
#MAKE#[1]: Entering directory '#PWD#'
|
|
#MAKEPATH#
|
|
MAKELEVEL = 1
|
|
#MAKEPATH# -f #MAKEFILE# last
|
|
#MAKE#[2]: Entering directory '#PWD#'
|
|
#MAKEPATH#
|
|
MAKELEVEL = 2
|
|
THE END
|
|
#MAKE#[2]: Leaving directory '#PWD#'
|
|
#MAKE#[1]: Leaving directory '#PWD#'
|
|
#MAKE#: Leaving directory '#PWD#'"));
|
|
|
|
|
|
# Test command line overrides.
|
|
run_make_test('
|
|
recur: all ; @$(MAKE) --no-print-directory -f #MAKEFILE# a=AA all
|
|
all: ; @echo "MAKEOVERRIDES = $(MAKEOVERRIDES)"
|
|
',
|
|
'a=ZZ',
|
|
'MAKEOVERRIDES = a=ZZ
|
|
MAKEOVERRIDES = a=AA
|
|
');
|
|
|
|
# SV 46013: Ensure that MAKEOVERRIDES is passed even if set in the makefile
|
|
run_make_test(q!
|
|
ifeq ($(MAKELEVEL),0)
|
|
MAKEOVERRIDES += FOO+=bar
|
|
endif
|
|
.PHONY: M R
|
|
M: ; @$(MAKE) --no-print-directory -f #MAKEFILE# R
|
|
R: ; @echo '$(FOO)'
|
|
!,
|
|
'', 'bar');
|
|
|
|
1;
|