Convert all "`'" quotes to "''" per new GNU Coding Standard guidelines.
[make.git] / tests / scripts / options / dash-W
blob20b9f7451a6f9dbce5fdb8fa824a480803ca25b3
1 #                                                                    -*-perl-*-
3 $description = "Test make -W (what if) option.\n";
5 # Basic build
7 run_make_test('
8 a.x: b.x
9 a.x b.x: ; echo >> $@
11               '', "echo >> b.x\necho >> a.x");
13 # Run it again: nothing should happen
15 run_make_test(undef, '', "#MAKE#: 'a.x' is up to date.");
17 # Now run it with -W b.x: should rebuild a.x
19 run_make_test(undef, '-W b.x', 'echo >> a.x');
21 # Put the timestamp for a.x into the future; it should still be remade.
23 utouch(1000, 'a.x');
24 run_make_test(undef, '', "#MAKE#: 'a.x' is up to date.");
25 run_make_test(undef, '-W b.x', 'echo >> a.x');
27 # Clean up
29 rmfiles('a.x', 'b.x');
31 # Test -W with the re-exec feature: we don't want to re-exec forever
32 # Savannah bug # 7566
34 # First set it up with a normal build
36 run_make_test('
37 all: baz.x ; @:
38 include foo.x
39 foo.x: bar.x
40         @echo "\$$(info restarts=\$$(MAKE_RESTARTS))" > $@
41         @echo "touch $@"
42 bar.x: ; echo >> $@
43 baz.x: bar.x ; @echo "touch $@"
45               '', '#MAKEFILE#:3: foo.x: No such file or directory
46 echo >> bar.x
47 touch foo.x
48 restarts=1
49 touch baz.x');
51 # Now run with -W bar.x
53 # Tweak foo.x's timestamp so the update will change it.
54 &utouch(1000, 'foo.x');
56 run_make_test(undef, '-W bar.x', "restarts=\ntouch foo.x\nrestarts=1\ntouch baz.x");
58 rmfiles('foo.x', 'bar.x');
60 # Test -W on vpath-found files: it should take effect.
61 # Savannah bug # 15341
63 mkdir('x-dir', 0777);
64 utouch(-20, 'x-dir/x');
65 touch('y');
67 run_make_test('
68 y: x ; @echo cp $< $@
70               '-W x-dir/x VPATH=x-dir',
71               'cp x-dir/x y');
73 # Make sure ./ stripping doesn't interfere with the match.
75 run_make_test('
76 y: x ; @echo cp $< $@
78               '-W ./x-dir/x VPATH=x-dir',
79               'cp x-dir/x y');
81 run_make_test(undef,
82               '-W x-dir/x VPATH=./x-dir',
83               'cp ./x-dir/x y');
85 unlink(qw(y x-dir/x));
86 rmdir('x-dir');