1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
# -*-perl-*-
$description = "Test second expansion in ordinary rules.";
$details = "";
# TEST #0: Test handing of '$' in prerequisites with and without second
# expansion.
run_make_test(q!
ifdef SE
.SECONDEXPANSION:
endif
foo$$bar: bar$$baz bar$$biz ; @echo '$@ : $^'
PRE = one two
bar$$baz: $$(PRE)
baraz: $$(PRE)
PRE = three four
.DEFAULT: ; @echo '$@'
!,
'',
"\$\nbar\$biz\nfoo\$bar : bar\$baz bar\$biz");
run_make_test(undef, 'SE=1', "three\nfour\nbariz\nfoo\$bar : baraz bariz");
# TEST #1: automatic variables.
#
run_make_test(q!
.SECONDEXPANSION:
.DEFAULT: ; @echo '$@'
foo: bar baz
foo: biz | buz
foo: $$@.1 \
$$<.2 \
$$(addsuffix .3,$$^) \
$$(addsuffix .4,$$+) \
$$|.5 \
$$*.6
!,
'',
'bar
baz
biz
buz
foo.1
bar.2
bar.3
baz.3
biz.3
bar.4
baz.4
biz.4
buz.5
.6
');
# Test #2: target/pattern -specific variables.
#
run_make_test(q!
.SECONDEXPANSION:
.DEFAULT: ; @echo '$@'
foo.x: $$a $$b
foo.x: a := bar
%.x: b := baz
!,
'',
'bar
baz
');
# Test #3: order of prerequisites.
#
run_make_test(q!
.SECONDEXPANSION:
.DEFAULT: ; @echo '$@'
all: foo bar baz
# Subtest #1
foo: foo.1; @:
foo: foo.2
foo: foo.3
# Subtest #2
bar: bar.2
bar: bar.1; @:
bar: bar.3
# Subtest #3
baz: baz.1
baz: baz.2
baz: ; @:
!,
'',
'foo.1
foo.2
foo.3
bar.1
bar.2
bar.3
baz.1
baz.2
');
# TEST #4: eval in a context where there is no reading_file
run_make_test(q!
.SECONDEXPANSION:
all : $$(eval $$(info test))
!,
'', "test\n#MAKE#: Nothing to be done for `all'.\n");
# TEST #5: (NEGATIVE) catch eval in a prereq list trying to create new
# target/prereq relationships.
run_make_test(q!
.SECONDEXPANSION:
proj1.exe : proj1.o $$(eval $$(test))
define test
proj1.o : proj1.c
proj1.c: proj1.h
endef
!,
'', "#MAKE#: *** prerequisites cannot be defined in recipes. Stop.\n", 512);
if ($all_tests) {
# Automatic $$+ variable expansion issue. Savannah bug #25780
run_make_test(q!
all : foo foo
.SECONDEXPANSION:
all : $$+ ; @echo '$+'
foo : ;
!,
'', "foo foo foo foo\n");
}
if ($all_tests) {
# Automatic $$+ variable expansion issue. Savannah bug #25780
run_make_test(q!
all : bar bar
bar : ;
q%x : ;
.SECONDEXPANSION:
a%l: q1x $$+ q2x ; @echo '$+'
!,
'', "q1x bar bar q2x bar bar\n");
}
# This tells the test driver that the perl test script executed properly.
1;
|