997423f462b52f5fde3a71c27b8a7e727fd2575b
[platform/upstream/make.git] / tests / scripts / targets / ONESHELL
1 #                                                                    -*-perl-*-
2
3 $description = "Test the behaviour of the .ONESHELL target.";
4
5 $details = "";
6
7
8 # Simple
9
10 run_make_test(q!
11 .ONESHELL:
12 all:
13         a=$$$$
14         [ 0"$$a" -eq "$$$$" ] || echo fail
15 !,
16               '', 'a=$$
17 [ 0"$a" -eq "$$" ] || echo fail
18 ');
19
20 # Again, but this time with inner prefix chars
21
22 run_make_test(q!
23 .ONESHELL:
24 all:
25         a=$$$$
26         @-+    [ 0"$$a" -eq "$$$$" ] || echo fail
27 !,
28               '', 'a=$$
29 [ 0"$a" -eq "$$" ] || echo fail
30 ');
31
32 # This time with outer prefix chars
33
34 run_make_test(q!
35 .ONESHELL:
36 all:
37            @a=$$$$
38             [ 0"$$a" -eq "$$$$" ] || echo fail
39 !,
40               '', '');
41
42
43 # This time with outer and inner prefix chars
44
45 run_make_test(q!
46 .ONESHELL:
47 all:
48            @a=$$$$
49             -@     +[ 0"$$a" -eq "$$$$" ] || echo fail
50 !,
51               '', '');
52
53
54 # Now try using a different interpreter
55
56 run_make_test(q!
57 .RECIPEPREFIX = >
58 .ONESHELL:
59 SHELL = #PERL#
60 .SHELLFLAGS = -e
61 all:
62 >          @$$a=5
63 >           +7;
64 >       @y=qw(a b c);
65 >print "a = $$a, y = (@y)\n";
66 !,
67               '', "a = 12, y = (a b c)\n");
68
69 1;