Imported Upstream version 4.4
[platform/upstream/make.git] / tests / scripts / targets / NOTINTERMEDIATE
1 #                                                                    -*-perl-*-
2
3 $description = "Test the behaviour of the .NOTINTERMEDIATE target.";
4
5 $details = "\
6 Test the behavior of the .NOTINTERMEDIATE special target.\n";
7
8 touch('hello.z');
9 unlink('hello.x');
10
11
12 # Test 1. A file which matches a .NOTINTERMEDIATE pattern is not intermediate.
13 run_make_test(q!
14 hello.z:
15 %.z: %.x; touch $@
16 %.x: ;
17 .NOTINTERMEDIATE: %.q %.x
18 !, '', "touch hello.z\n");
19
20 # Test 2. .NOTINTERMEDIATE: %.q pattern has no effect on hello.x.
21 touch('hello.z');
22 run_make_test(q!
23 hello.z:
24 %.z: %.x; touch $@
25 %.x: ;
26 .NOTINTERMEDIATE: %.q
27 !, '', "#MAKE#: 'hello.z' is up to date.\n");
28
29 # Test 3. A file which is a prereq of .NOTINTERMEDIATE is not intermediate.
30 run_make_test(q!
31 hello.z:
32 %.z: %.x; touch $@
33 %.x: ;
34 .NOTINTERMEDIATE: %.q hello.x
35 !, '', "touch hello.z\n");
36
37 # Test 4. .NOTINTERMEDIATE without prerequisites makes everything
38 # notintermediate.
39 unlink('hello.z');
40 run_make_test(q!
41 hello.z:
42 %.z: %.x; touch $@
43 %.x: ;
44 .NOTINTERMEDIATE:
45 !, '', "touch hello.z\n");
46
47 # Test 5. Same file cannot be intermediate and notintermediate.
48 run_make_test(q!
49 .INTERMEDIATE: hello.x
50 .NOTINTERMEDIATE: hello.x
51 !, '', "#MAKE#: *** hello.x cannot be both .NOTINTERMEDIATE and .INTERMEDIATE.  Stop.\n", 512);
52
53 # Test 6. Same file cannot be secondary and notintermediate.
54 run_make_test(q!
55 .SECONDARY: hello.x
56 .NOTINTERMEDIATE: hello.x
57 !, '', "#MAKE#: *** hello.x cannot be both .NOTINTERMEDIATE and .SECONDARY.  Stop.\n", 512);
58
59 # Test 7. All .SECONDARY and all .NOTINTERMEDIATE are mutually exclusive.
60 run_make_test(q!
61 .SECONDARY:
62 .NOTINTERMEDIATE:
63 !, '', "#MAKE#: *** .NOTINTERMEDIATE and .SECONDARY are mutually exclusive.  Stop.\n", 512);
64
65 # Test 8. .INTERMEDIATE file takes priority over a .NOTINTERMEDIATE pattern.
66 unlink('hello.x');
67 run_make_test(q!
68 hello.z:
69 %.z: %.x; touch $@
70 %.x: ;
71 .INTERMEDIATE: hello.x
72 .NOTINTERMEDIATE: %.q %.x
73 !, '', "#MAKE#: 'hello.z' is up to date.\n");
74
75 # Test 9. Everything is notintermediate, except hello.x.
76 unlink('hello.x');
77 run_make_test(q!
78 hello.z:
79 %.z: %.x; touch $@
80 %.x: ;
81 .INTERMEDIATE: hello.x
82 .NOTINTERMEDIATE:
83 !, '', "#MAKE#: 'hello.z' is up to date.\n");
84
85 # Test 10. Everything is notintermediate, except hello.x.
86 unlink('hello.x');
87 run_make_test(q!
88 hello.z:
89 %.z: %.x; touch $@
90 %.x: ;
91 .SECONDARY: hello.x
92 .NOTINTERMEDIATE:
93 !, '', "#MAKE#: 'hello.z' is up to date.\n");
94
95 # Test 11. Everything is secondary, except %.q, hello.x.
96 unlink('hello.x');
97 run_make_test(q!
98 hello.z:
99 %.z: %.x; touch $@
100 %.x: ;
101 .NOTINTERMEDIATE: %.q hello.x
102 .SECONDARY:
103 !, '', "touch hello.z\n");
104
105 # Test 12. Everything is secondary, except %.q %.x.
106 unlink('hello.x');
107 run_make_test(q!
108 hello.z:
109 %.z: %.x; touch $@
110 %.x: ;
111 .NOTINTERMEDIATE: %.q %.x
112 .SECONDARY:
113 !, '', "touch hello.z\n");
114
115
116
117 unlink('hello.z');
118 # This tells the test driver that the perl test script executed properly.
119 1;