xref: /netbsd-src/external/gpl2/gmake/dist/tests/scripts/options/dash-B (revision 69606e3f5c9388e52aed8c120ad63c049ca45d8f)
1*69606e3fSchristos#                                                                    -*-perl-*-
2*69606e3fSchristos
3*69606e3fSchristos$description = "Test make -B (always remake) option.\n";
4*69606e3fSchristos
5*69606e3fSchristos$details = "\
6*69606e3fSchristosConstruct a simple makefile that builds a target.
7*69606e3fSchristosInvoke make once, so it builds everything.  Invoke it again and verify
8*69606e3fSchristosthat nothing is built.  Then invoke it with -B and verify that everything
9*69606e3fSchristosis built again.";
10*69606e3fSchristos
11*69606e3fSchristos&touch('bar.x');
12*69606e3fSchristos
13*69606e3fSchristosrun_make_test('
14*69606e3fSchristos.SUFFIXES:
15*69606e3fSchristos
16*69606e3fSchristos.PHONY: all
17*69606e3fSchristosall: foo
18*69606e3fSchristos
19*69606e3fSchristosfoo: bar.x
20*69606e3fSchristos	@echo cp $< $@
21*69606e3fSchristos	@echo "" > $@
22*69606e3fSchristos',
23*69606e3fSchristos              '', 'cp bar.x foo');
24*69606e3fSchristos
25*69606e3fSchristosrun_make_test(undef, '', "#MAKE#: Nothing to be done for `all'.");
26*69606e3fSchristosrun_make_test(undef, '-B', 'cp bar.x foo');
27*69606e3fSchristos
28*69606e3fSchristos# Put the timestamp for foo into the future; it should still be remade.
29*69606e3fSchristos
30*69606e3fSchristosutouch(1000, 'foo');
31*69606e3fSchristosrun_make_test(undef, '', "#MAKE#: Nothing to be done for `all'.");
32*69606e3fSchristosrun_make_test(undef, '-B', 'cp bar.x foo');
33*69606e3fSchristos
34*69606e3fSchristos# Clean up
35*69606e3fSchristos
36*69606e3fSchristosrmfiles('bar.x', 'foo');
37*69606e3fSchristos
38*69606e3fSchristos# Test -B with the re-exec feature: we don't want to re-exec forever
39*69606e3fSchristos# Savannah bug # 7566
40*69606e3fSchristos
41*69606e3fSchristosrun_make_test('
42*69606e3fSchristosall: ; @:
43*69606e3fSchristos$(info MAKE_RESTARTS=$(MAKE_RESTARTS))
44*69606e3fSchristosinclude foo.x
45*69606e3fSchristosfoo.x: ; @touch $@
46*69606e3fSchristos',
47*69606e3fSchristos              '-B', 'MAKE_RESTARTS=
48*69606e3fSchristos#MAKEFILE#:4: foo.x: No such file or directory
49*69606e3fSchristosMAKE_RESTARTS=1');
50*69606e3fSchristos
51*69606e3fSchristosrmfiles('foo.x');
52*69606e3fSchristos
53*69606e3fSchristos# Test -B with the re-exec feature: we DO want -B in the "normal" part of the
54*69606e3fSchristos# makefile.
55*69606e3fSchristos
56*69606e3fSchristos&touch('blah.x');
57*69606e3fSchristos
58*69606e3fSchristosrun_make_test('
59*69606e3fSchristosall: blah.x ; @echo $@
60*69606e3fSchristos$(info MAKE_RESTARTS=$(MAKE_RESTARTS))
61*69606e3fSchristosinclude foo.x
62*69606e3fSchristosfoo.x: ; @touch $@
63*69606e3fSchristosblah.x: ; @echo $@
64*69606e3fSchristos',
65*69606e3fSchristos              '-B', 'MAKE_RESTARTS=
66*69606e3fSchristos#MAKEFILE#:4: foo.x: No such file or directory
67*69606e3fSchristosMAKE_RESTARTS=1
68*69606e3fSchristosblah.x
69*69606e3fSchristosall');
70*69606e3fSchristos
71*69606e3fSchristosrmfiles('foo.x', 'blah.x');
72*69606e3fSchristos
73*69606e3fSchristos1;
74