Debian Codegraph @

tests/scripts/options/dash-B

raw
1 # -*-perl-*-
2
3 $description = "Test make -B (always remake) option.\n";
4
5 $details = "\
6 Construct a simple makefile that builds a target.
7 Invoke make once, so it builds everything. Invoke it again and verify
8 that nothing is built. Then invoke it with -B and verify that everything
9 is built again.";
10
11 &touch('bar.x');
12
13 run_make_test('
14 .SUFFIXES:
15
16 .PHONY: all
17 all: foo
18
19 foo: bar.x
20 @echo cp $< $@
21 @echo "" > $@
22 ',
23 '', 'cp bar.x foo');
24
25 run_make_test(undef, '', "#MAKE#: Nothing to be done for 'all'.");
26 run_make_test(undef, '-B', 'cp bar.x foo');
27
28 # Put the timestamp for foo into the future; it should still be remade.
29
30 utouch(1000, 'foo');
31 run_make_test(undef, '', "#MAKE#: Nothing to be done for 'all'.");
32 run_make_test(undef, '-B', 'cp bar.x foo');
33
34 # Clean up
35
36 rmfiles('bar.x', 'foo');
37
38 # Test -B with the re-exec feature: we don't want to re-exec forever
39 # Savannah bug # 7566
40
41 run_make_test('
42 all: ; @:
43 $(info MAKE_RESTARTS=$(MAKE_RESTARTS))
44 include foo.x
45 foo.x: ; @touch $@
46 ',
47 '-B', 'MAKE_RESTARTS=
48 MAKE_RESTARTS=1');
49
50 rmfiles('foo.x');
51
52 # Test -B with the re-exec feature: we DO want -B in the "normal" part of the
53 # makefile.
54
55 &touch('blah.x');
56
57 run_make_test('
58 all: blah.x ; @echo $@
59 $(info MAKE_RESTARTS=$(MAKE_RESTARTS))
60 include foo.x
61 foo.x: ; @touch $@
62 blah.x: ; @echo $@
63 ',
64 '-B', 'MAKE_RESTARTS=
65 MAKE_RESTARTS=1
66 blah.x
67 all');
68
69 rmfiles('foo.x', 'blah.x');
70
71 # Test that $? is set properly with -B; all prerequisites will be newer!
72
73 utouch(-10, 'x.b');
74 touch('x.a');
75
76 run_make_test(q!
77 x.a: x.b ; @echo $?
78 !,
79 '-B', "x.b\n");
80
81 unlink(qw(x.a x.b));
82
83 1;
84
85 ### Local Variables:
86 ### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
87 ### End: