summaryrefslogtreecommitdiff
path: root/tests/scripts/variables/MAKE_RESTARTS
blob: ef8e368f9d62cf536bc86734fc77aadae52859a6 (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
56
57
58
59
60
61
62
#                                                                    -*-perl-*-

$description = "Test the MAKE_RESTARTS variable.";

# Test basic capability

run_make_test('
all: ; @:
$(info MAKE_RESTARTS=$(MAKE_RESTARTS))
include foo.x
foo.x: ; @touch $@
',
              '', 'MAKE_RESTARTS=
#MAKEFILE#:4: foo.x: No such file or directory
MAKE_RESTARTS=1');

rmfiles('foo.x');

# Test multiple restarts

run_make_test('
all: ; @:
$(info MAKE_RESTARTS=$(MAKE_RESTARTS))
include foo.x
foo.x: ; @echo "include bar.x" > $@
bar.x: ; @touch $@
',
              '', 'MAKE_RESTARTS=
#MAKEFILE#:4: foo.x: No such file or directory
MAKE_RESTARTS=1
foo.x:1: bar.x: No such file or directory
MAKE_RESTARTS=2');

rmfiles('foo.x', 'bar.x');

# Test multiple restarts and make sure the variable is cleaned up

run_make_test('
recurse:
	@echo recurse MAKE_RESTARTS=$$MAKE_RESTARTS
	@$(MAKE) -f #MAKEFILE# all
all:
	@echo all MAKE_RESTARTS=$$MAKE_RESTARTS
$(info MAKE_RESTARTS=$(MAKE_RESTARTS))
include foo.x
foo.x: ; @echo "include bar.x" > $@
bar.x: ; @touch $@
',
              '', "MAKE_RESTARTS=
#MAKEFILE#:8: foo.x: No such file or directory
MAKE_RESTARTS=1
foo.x:1: bar.x: No such file or directory
MAKE_RESTARTS=2
recurse MAKE_RESTARTS=
#MAKE#[1]: Entering directory '#PWD#'
MAKE_RESTARTS=
all MAKE_RESTARTS=
#MAKE#[1]: Leaving directory '#PWD#'");

rmfiles('foo.x', 'bar.x');

1;