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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# -*-perl-*-
$description = "Test make -B (always remake) option.\n";
$details = "\
Construct a simple makefile that builds a target.
Invoke make once, so it builds everything. Invoke it again and verify
that nothing is built. Then invoke it with -B and verify that everything
is built again.";
&touch('bar.x');
run_make_test('
.SUFFIXES:
.PHONY: all
all: foo
foo: bar.x
@echo cp $< $@
@echo "" > $@
',
'', 'cp bar.x foo');
run_make_test(undef, '', "#MAKE#: Nothing to be done for 'all'.");
run_make_test(undef, '-B', 'cp bar.x foo');
# Put the timestamp for foo into the future; it should still be remade.
utouch(1000, 'foo');
run_make_test(undef, '', "#MAKE#: Nothing to be done for 'all'.");
run_make_test(undef, '-B', 'cp bar.x foo');
# Clean up
rmfiles('bar.x', 'foo');
# Test -B with the re-exec feature: we don't want to re-exec forever
# Savannah bug # 7566
run_make_test('
all: ; @:
$(info MAKE_RESTARTS=$(MAKE_RESTARTS))
include foo.x
foo.x: ; @touch $@
',
'-B', 'MAKE_RESTARTS=
#MAKEFILE#:4: foo.x: No such file or directory
MAKE_RESTARTS=1');
rmfiles('foo.x');
# Test -B with the re-exec feature: we DO want -B in the "normal" part of the
# makefile.
&touch('blah.x');
run_make_test('
all: blah.x ; @echo $@
$(info MAKE_RESTARTS=$(MAKE_RESTARTS))
include foo.x
foo.x: ; @touch $@
blah.x: ; @echo $@
',
'-B', 'MAKE_RESTARTS=
#MAKEFILE#:4: foo.x: No such file or directory
MAKE_RESTARTS=1
blah.x
all');
rmfiles('foo.x', 'blah.x');
# Test that $? is set properly with -B; all prerequisites will be newer!
utouch(-10, 'x.b');
touch('x.a');
run_make_test(q!
x.a: x.b ; @echo $?
!,
'-B', "x.b\n");
unlink(qw(x.a x.b));
1;
|