summaryrefslogtreecommitdiff
path: root/tests/scripts/features/recursion
blob: b9dfd4f42fc74cf58f6708d27f4e7a0e5be0647e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#                                                                    -*-perl-*-
$description = "Test recursion.";

$details = "DETAILS";

# Test some basic recursion.
run_make_test('
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
');

1;