1#                                                                    -*-perl-*-
2
3$description = "Test the MAKE_RESTARTS variable.";
4
5# Test basic capability
6
7run_make_test('
8all: ; @:
9$(info MAKE_RESTARTS=$(MAKE_RESTARTS))
10include foo.x
11foo.x: ; @touch $@
12',
13              '', 'MAKE_RESTARTS=
14#MAKEFILE#:4: foo.x: No such file or directory
15MAKE_RESTARTS=1');
16
17rmfiles('foo.x');
18
19# Test multiple restarts
20
21run_make_test('
22all: ; @:
23$(info MAKE_RESTARTS=$(MAKE_RESTARTS))
24include foo.x
25foo.x: ; @echo "include bar.x" > $@
26bar.x: ; @touch $@
27',
28              '', 'MAKE_RESTARTS=
29#MAKEFILE#:4: foo.x: No such file or directory
30MAKE_RESTARTS=1
31foo.x:1: bar.x: No such file or directory
32MAKE_RESTARTS=2');
33
34rmfiles('foo.x', 'bar.x');
35
36# Test multiple restarts and make sure the variable is cleaned up
37
38run_make_test('
39recurse:
40	@echo recurse MAKE_RESTARTS=$$MAKE_RESTARTS
41	@$(MAKE) -f #MAKEFILE# all
42all:
43	@echo all MAKE_RESTARTS=$$MAKE_RESTARTS
44$(info MAKE_RESTARTS=$(MAKE_RESTARTS))
45include foo.x
46foo.x: ; @echo "include bar.x" > $@
47bar.x: ; @touch $@
48',
49              '', "MAKE_RESTARTS=
50#MAKEFILE#:8: foo.x: No such file or directory
51MAKE_RESTARTS=1
52foo.x:1: bar.x: No such file or directory
53MAKE_RESTARTS=2
54recurse MAKE_RESTARTS=
55MAKE_RESTARTS=
56#MAKE#[1]: Entering directory `#PWD#'
57all MAKE_RESTARTS=
58#MAKE#[1]: Leaving directory `#PWD#'");
59
60rmfiles('foo.x', 'bar.x');
61
621;
63