| 1 |
# -*-perl-*- |
| 2 |
$description = "Test second expansion in ordinary rules."; |
| 3 |
|
| 4 |
$details = ""; |
| 5 |
|
| 6 |
# TEST #0: Test handing of '$' in prerequisites with and without second |
| 7 |
# expansion. |
| 8 |
|
| 9 |
# If we don't support archives then the prerequisite is different |
| 10 |
my $prereq = exists $FEATURES{'archives'} ? '$' : '$(PRE)'; |
| 11 |
|
| 12 |
run_make_test(q! |
| 13 |
ifdef SE |
| 14 |
.SECONDEXPANSION: |
| 15 |
endif |
| 16 |
foo$$bar: bar$$baz bar$$biz ; @echo '$@ : $^' |
| 17 |
PRE = one two |
| 18 |
bar$$baz: $$(PRE) |
| 19 |
baraz: $$(PRE) |
| 20 |
PRE = three four |
| 21 |
.DEFAULT: ; @echo '$@' |
| 22 |
!, |
| 23 |
'', |
| 24 |
"$prereq\nbar\$biz\nfoo\$bar : bar\$baz bar\$biz"); |
| 25 |
|
| 26 |
run_make_test(undef, 'SE=1', "three\nfour\nbariz\nfoo\$bar : baraz bariz"); |
| 27 |
|
| 28 |
# TEST #1: automatic variables. |
| 29 |
# |
| 30 |
run_make_test(q! |
| 31 |
.SECONDEXPANSION: |
| 32 |
.DEFAULT: ; @echo '$@' |
| 33 |
|
| 34 |
foo: bar baz |
| 35 |
|
| 36 |
foo: biz | buz |
| 37 |
|
| 38 |
foo: [email protected] \ |
| 39 |
$$<.2 \ |
| 40 |
$$(addsuffix .3,$$^) \ |
| 41 |
$$(addsuffix .4,$$+) \ |
| 42 |
$$|.5 \ |
| 43 |
$$*.6 |
| 44 |
|
| 45 |
!, |
| 46 |
'', |
| 47 |
'bar |
| 48 |
baz |
| 49 |
biz |
| 50 |
buz |
| 51 |
foo.1 |
| 52 |
bar.2 |
| 53 |
bar.3 |
| 54 |
baz.3 |
| 55 |
biz.3 |
| 56 |
bar.4 |
| 57 |
baz.4 |
| 58 |
biz.4 |
| 59 |
buz.5 |
| 60 |
.6 |
| 61 |
'); |
| 62 |
|
| 63 |
|
| 64 |
# Test #2: target/pattern -specific variables. |
| 65 |
# |
| 66 |
run_make_test(q! |
| 67 |
.SECONDEXPANSION: |
| 68 |
.DEFAULT: ; @echo '$@' |
| 69 |
|
| 70 |
foo.x: $$a $$b |
| 71 |
|
| 72 |
foo.x: a := bar |
| 73 |
|
| 74 |
%.x: b := baz |
| 75 |
!, |
| 76 |
'', |
| 77 |
'bar |
| 78 |
baz |
| 79 |
'); |
| 80 |
|
| 81 |
|
| 82 |
# Test #3: order of prerequisites. |
| 83 |
# |
| 84 |
run_make_test(q! |
| 85 |
.SECONDEXPANSION: |
| 86 |
.DEFAULT: ; @echo '$@' |
| 87 |
|
| 88 |
all: foo bar baz |
| 89 |
|
| 90 |
# Subtest #1 |
| 91 |
foo: foo.1; @: |
| 92 |
foo: foo.2 |
| 93 |
foo: foo.3 |
| 94 |
|
| 95 |
# Subtest #2 |
| 96 |
bar: bar.2 |
| 97 |
bar: bar.1; @: |
| 98 |
bar: bar.3 |
| 99 |
|
| 100 |
# Subtest #3 |
| 101 |
baz: baz.1 |
| 102 |
baz: baz.2 |
| 103 |
baz: ; @: |
| 104 |
!, |
| 105 |
'', |
| 106 |
'foo.1 |
| 107 |
foo.2 |
| 108 |
foo.3 |
| 109 |
bar.1 |
| 110 |
bar.2 |
| 111 |
bar.3 |
| 112 |
baz.1 |
| 113 |
baz.2 |
| 114 |
'); |
| 115 |
|
| 116 |
# TEST #4: eval in a context where there is no reading_file |
| 117 |
run_make_test(q! |
| 118 |
.SECONDEXPANSION: |
| 119 |
all : $$(eval $$(info test)) |
| 120 |
!, |
| 121 |
'', "test\n#MAKE#: Nothing to be done for 'all'.\n"); |
| 122 |
|
| 123 |
# TEST #5: (NEGATIVE) catch eval in a prereq list trying to create new |
| 124 |
# target/prereq relationships. |
| 125 |
|
| 126 |
run_make_test(q! |
| 127 |
.SECONDEXPANSION: |
| 128 |
proj1.exe : proj1.o $$(eval $$(test)) |
| 129 |
define test |
| 130 |
proj1.o : proj1.c |
| 131 |
proj1.c: proj1.h |
| 132 |
endef |
| 133 |
!, |
| 134 |
'', "#MAKE#: *** prerequisites cannot be defined in recipes. Stop.\n", 512); |
| 135 |
|
| 136 |
|
| 137 |
# Automatic $$+ variable expansion issue. Savannah bug #25780 |
| 138 |
run_make_test(q! |
| 139 |
all : foo foo |
| 140 |
.SECONDEXPANSION: |
| 141 |
all : $$+ ; @echo '$+' |
| 142 |
foo : ; |
| 143 |
!, |
| 144 |
'', "foo foo foo foo\n"); |
| 145 |
|
| 146 |
|
| 147 |
# Automatic $$+ variable expansion issue. Savannah bug #25780 |
| 148 |
run_make_test(q! |
| 149 |
all : bar bar |
| 150 |
bar : ; |
| 151 |
q%x : ; |
| 152 |
.SECONDEXPANSION: |
| 153 |
a%l: q1x $$+ q2x ; @echo '$+' |
| 154 |
!, |
| 155 |
'', "q1x bar bar q2x bar bar\n"); |
| 156 |
|
| 157 |
|
| 158 |
# Allow patsubst shorthand in second expansion context. |
| 159 |
# Requires the colon to be quoted. Savannah bug #16545 |
| 160 |
run_make_test(q! |
| 161 |
.PHONY: foo.bar |
| 162 |
.SECONDEXPANSION: |
| 163 |
foo: $$(@\\:%=%.bar); @echo '$^' |
| 164 |
!, |
| 165 |
'', "foo.bar\n"); |
| 166 |
|
| 167 |
# SV 54549 : Ensure we don't free used variable_sets |
| 168 |
run_make_test(q! |
| 169 |
foo: -lcat |
| 170 |
|
| 171 |
# Removing second expansion prevents segfault |
| 172 |
.SECONDEXPANSION: |
| 173 |
foo: [email protected] ; |
| 174 |
|
| 175 |
# Having an empty command here prevents segfault unless, |
| 176 |
# the environment is empty. `env -i make foo` |
| 177 |
# MFLAGS=-w or MAKEFLAGS=-w `env MFLAGS=-w make foo` |
| 178 |
# libcat.a target calls an extra command, `@true \n @touch $@` |
| 179 |
# odd. |
| 180 |
%.o: ; @true |
| 181 |
|
| 182 |
# Having an empty command prevents segfault. |
| 183 |
-l%: lib%.a ; @true |
| 184 |
|
| 185 |
# Not creating libcat.a here prevents segfault, |
| 186 |
libcat.a: ; @touch $@ |
| 187 |
!, |
| 188 |
'', q!#MAKEFILE#:16: Recipe was specified for file '-lcat' at #MAKEFILE#:16, |
| 189 |
#MAKEFILE#:16: but '-lcat' is now considered the same file as 'libcat.a'. |
| 190 |
#MAKEFILE#:16: Recipe for '-lcat' will be ignored in favor of the one for 'libcat.a'.!); |
| 191 |
unlink('libcat.a'); |
| 192 |
|
| 193 |
# SV 28456 : Don't reset $$< for default recipes |
| 194 |
run_make_test(q! |
| 195 |
.SECONDEXPANSION: |
| 196 |
|
| 197 |
.PHONY: biz baz |
| 198 |
biz: baz ; |
| 199 |
biz: $$(info $$<) |
| 200 |
!, |
| 201 |
'', "baz\n#MAKE#: Nothing to be done for 'biz'.\n"); |
| 202 |
|
| 203 |
|
| 204 |
# sv 60659. Second expansion of automatic variables inside a function in the |
| 205 |
# prerequisite list. |
| 206 |
# $$@ expands to the target in the 1st and following rules. |
| 207 |
# $$<,$$^,$$+,$$|,$$?,$$*,$$% expand to the empty string in the prerequisite |
| 208 |
# list of the 1st rule. |
| 209 |
# $$<,$$^,$$+,$$|,$$?,$$*,$$% in the prerequisite list of the 2nd (and |
| 210 |
# following) rule expand to the values from the 1st rule. |
| 211 |
|
| 212 |
|
| 213 |
# subtest 1. Explicit rules. 1st rule. |
| 214 |
run_make_test(q! |
| 215 |
.SECONDEXPANSION: |
| 216 |
all: 2.x |
| 217 |
2.x: 5.z 6.z 5.z $$(info @=$$@,<=$$<,^=$$^,+=$$+,|=$$|,?=$$?,*=$$*,%=$$%) ; |
| 218 |
%.z: ; |
| 219 |
!, '', |
| 220 |
"@=2.x,<=,^=,+=,|=,?=,*=,%= |
| 221 |
#MAKE#: Nothing to be done for 'all'.\n"); |
| 222 |
|
| 223 |
|
| 224 |
# subtest 2. Explicit rules. 2nd rule. |
| 225 |
run_make_test(q! |
| 226 |
.SECONDEXPANSION: |
| 227 |
all: 15.x 1.x |
| 228 |
15.x: 5.z 6.z 5.z | 7.z 7.z 8.z |
| 229 |
1.x: 1.z 2.z 2.z | 3.z 4.z |
| 230 |
15.x 1.x: 9.z $$(info @=$$@,<=$$<,^=$$^,+=$$+,|=$$|,?=$$?,*=$$*,%=$$%) ; |
| 231 |
%.z: ; |
| 232 |
!, '', |
| 233 |
"@=15.x,<=5.z,^=5.z 6.z,+=5.z 6.z 5.z,|=7.z 8.z,?=,*=,%= |
| 234 |
@=1.x,<=1.z,^=1.z 2.z,+=1.z 2.z 2.z,|=3.z 4.z,?=,*=,%= |
| 235 |
#MAKE#: Nothing to be done for 'all'.\n"); |
| 236 |
|
| 237 |
|
| 238 |
# subtest 3. Grouped targets in explicit rules. 1st rule. |
| 239 |
run_make_test(q! |
| 240 |
.SECONDEXPANSION: |
| 241 |
all: 15.x |
| 242 |
15.x 1.x&: 5.z 6.z 5.z $$(info @=$$@,<=$$<,^=$$^,+=$$+,|=$$|,?=$$?,*=$$*,%=$$%) ; |
| 243 |
%.z: ; |
| 244 |
!, '', |
| 245 |
"@=15.x,<=,^=,+=,|=,?=,*=,%= |
| 246 |
@=1.x,<=,^=,+=,|=,?=,*=,%= |
| 247 |
#MAKE#: Nothing to be done for 'all'.\n"); |
| 248 |
|
| 249 |
|
| 250 |
# subtest 4. Grouped targets in explicit rules. 2nd rule. |
| 251 |
run_make_test(q! |
| 252 |
.SECONDEXPANSION: |
| 253 |
all: 15.x 1.x |
| 254 |
15.x: 5.z 6.z 5.z | 7.z 7.z 8.z |
| 255 |
1.x: 1.z 2.z 2.z | 3.z 4.z |
| 256 |
15.x 1.x&: 9.z $$(info @=$$@,<=$$<,^=$$^,+=$$+,|=$$|,?=$$?,*=$$*,%=$$%) ; |
| 257 |
%.z: ; |
| 258 |
!, '', |
| 259 |
"@=15.x,<=5.z,^=5.z 6.z,+=5.z 6.z 5.z,|=7.z 8.z,?=,*=,%= |
| 260 |
@=1.x,<=1.z,^=1.z 2.z,+=1.z 2.z 2.z,|=3.z 4.z,?=,*=,%= |
| 261 |
#MAKE#: Nothing to be done for 'all'.\n"); |
| 262 |
|
| 263 |
|
| 264 |
# Double colon rules. |
| 265 |
# Because each double colon rule is independent of the other double colon rules |
| 266 |
# for the same target, each automatic variable in the prerequisite list, other |
| 267 |
# than $$@, second expands to the empty string in any rule, 1st, 2nd or later. |
| 268 |
|
| 269 |
# subtest 5. 1st double colon rule. |
| 270 |
run_make_test(q! |
| 271 |
.SECONDEXPANSION: |
| 272 |
all: 2.x |
| 273 |
2.x:: 5.z 6.z 5.z $$(info @=$$@,<=$$<,^=$$^,+=$$+,|=$$|,?=$$?,*=$$*,%=$$%) ; |
| 274 |
%.z: ; |
| 275 |
!, '', |
| 276 |
"@=2.x,<=,^=,+=,|=,?=,*=,%= |
| 277 |
#MAKE#: Nothing to be done for 'all'.\n"); |
| 278 |
|
| 279 |
|
| 280 |
# subtest 6. 2nd double colon rule. |
| 281 |
run_make_test(q! |
| 282 |
.SECONDEXPANSION: |
| 283 |
all: 15.x 1.x |
| 284 |
15.x:: 5.z 6.z 5.z | 7.z 7.z 8.z ; |
| 285 |
1.x:: 1.z 2.z 2.z | 3.z 4.z ; |
| 286 |
15.x 1.x:: 9.z $$(info @=$$@,<=$$<,^=$$^,+=$$+,|=$$|,?=$$?,*=$$*,%=$$%) ; |
| 287 |
%.z: ; |
| 288 |
!, '', |
| 289 |
"@=15.x,<=,^=,+=,|=,?=,*=,%= |
| 290 |
@=1.x,<=,^=,+=,|=,?=,*=,%= |
| 291 |
#MAKE#: Nothing to be done for 'all'.\n"); |
| 292 |
|
| 293 |
|
| 294 |
# sv 62324. |
| 295 |
# Integrity self check. |
| 296 |
run_make_test(q! |
| 297 |
.SECONDEXPANSION: |
| 298 |
all: bye.x |
| 299 |
bye.x: $$(firstword bye.1; |
| 300 |
!, '', "#MAKEFILE#:4: *** unterminated call to function 'firstword': missing ')'. Stop.", 512); |
| 301 |
|
| 302 |
unlink('hello.tsk', 'test.o', 'bye.tsk', 'hello.o', 'hello.h', 'hello.q', 'bye.c', 'bye.o'); |
| 303 |
|
| 304 |
# sv 62706. |
| 305 |
# Test that makes avoids second expanding prerequisites of the targets which |
| 306 |
# are not built. |
| 307 |
# Here, hello.tsk is built and its prerequisites are second expanded. |
| 308 |
# bye.tsk is not built and its prerequisites are not second expanded. |
| 309 |
run_make_test(q! |
| 310 |
.SECONDEXPANSION: |
| 311 |
hello.tsk: hello.o $$(info second expansion of $$@ prereqs); $(info $@ from $<) |
| 312 |
bye.tsk: bye.o $$(info second expansion of $$@ prereqs); $(info $@ from $<) |
| 313 |
hello.o: $$(info second expansion of $$@ prereqs); $(info $@) |
| 314 |
bye.o: $$(info second expansion of $$@ prereqs); $(info $@) |
| 315 |
!, 'hello.tsk', |
| 316 |
"second expansion of hello.tsk prereqs |
| 317 |
second expansion of hello.o prereqs |
| 318 |
hello.o |
| 319 |
hello.tsk from hello.o |
| 320 |
#MAKE#: 'hello.tsk' is up to date.\n"); |
| 321 |
|
| 322 |
# sv 62706. |
| 323 |
# Multiple rules per target. |
| 324 |
run_make_test(q! |
| 325 |
.SECONDEXPANSION: |
| 326 |
|
| 327 |
all: hello.tsk |
| 328 |
dep1:=hello.o |
| 329 |
dep2:=hello.h |
| 330 |
hello.tsk: $$(dep1) |
| 331 |
hello.tsk: $$(dep2); $(info $@ from $^) |
| 332 |
hello.o:; $(info $@) |
| 333 |
hello.h:; $(info $@) |
| 334 |
!, 'hello.tsk', |
| 335 |
"hello.h |
| 336 |
hello.o |
| 337 |
hello.tsk from hello.h hello.o |
| 338 |
#MAKE#: 'hello.tsk' is up to date.\n"); |
| 339 |
|
| 340 |
# sv 62706. |
| 341 |
# Multiple targets per rule. |
| 342 |
run_make_test(q! |
| 343 |
.SECONDEXPANSION: |
| 344 |
hello.tsk bye.tsk: hello.o $$(info second expansion of $$@ prereqs); $(info $@ from $<) |
| 345 |
bye.tsk: bye.o $$(info second expansion of $$@ prereqs) |
| 346 |
hello.o: $$(info second expansion of $$@ prereqs); $(info $@) |
| 347 |
bye.o: $$(info second expansion of $$@ prereqs); $(info $@) |
| 348 |
!, 'hello.tsk', |
| 349 |
"second expansion of hello.tsk prereqs |
| 350 |
second expansion of hello.o prereqs |
| 351 |
hello.o |
| 352 |
hello.tsk from hello.o |
| 353 |
#MAKE#: 'hello.tsk' is up to date.\n"); |
| 354 |
|
| 355 |
# sv 62706. |
| 356 |
# Grouped targets. |
| 357 |
run_make_test(q! |
| 358 |
.SECONDEXPANSION: |
| 359 |
world.tsk: world.o $$(info 1 second expansion of $$@ prereqs) |
| 360 |
hello.tsk world.tsk &: hello.o $$(info 2 second expansion of $$@ prereqs); $(info $@ from $<) |
| 361 |
bye.tsk: bye.o $$(info second expansion of $$@ prereqs); $(info $@ from $<) |
| 362 |
hello.o: $$(info second expansion of $$@ prereqs); $(info $@) |
| 363 |
world.o: $$(info second expansion of $$@ prereqs); $(info $@) |
| 364 |
bye.o: $$(info second expansion of $$@ prereqs); $(info $@) |
| 365 |
!, 'hello.tsk', |
| 366 |
"2 second expansion of hello.tsk prereqs |
| 367 |
second expansion of hello.o prereqs |
| 368 |
hello.o |
| 369 |
2 second expansion of world.tsk prereqs |
| 370 |
1 second expansion of world.tsk prereqs |
| 371 |
second expansion of world.o prereqs |
| 372 |
world.o |
| 373 |
hello.tsk from hello.o |
| 374 |
#MAKE#: 'hello.tsk' is up to date.\n"); |
| 375 |
|
| 376 |
# sv 62706. |
| 377 |
# Order only. |
| 378 |
run_make_test(q! |
| 379 |
.SECONDEXPANSION: |
| 380 |
hello.tsk:| hello.o $$(info second expansion of $$@ prereqs); $(info $@ from $|) |
| 381 |
bye.tsk:| bye.o $$(info second expansion of $$@ prereqs); $(info $@ from $|) |
| 382 |
hello.o:| $$(info second expansion of $$@ prereqs); $(info $@) |
| 383 |
bye.o:| $$(info second expansion of $$@ prereqs); $(info $@) |
| 384 |
!, 'hello.tsk', |
| 385 |
"second expansion of hello.tsk prereqs |
| 386 |
second expansion of hello.o prereqs |
| 387 |
hello.o |
| 388 |
hello.tsk from hello.o |
| 389 |
#MAKE#: 'hello.tsk' is up to date.\n"); |
| 390 |
|
| 391 |
# sv 62706. |
| 392 |
# Double colon. 1 rule per target. |
| 393 |
run_make_test(q! |
| 394 |
.SECONDEXPANSION: |
| 395 |
hello.tsk:: hello.o $$(info second expansion of $$@ prereqs); $(info $@ from $<) |
| 396 |
bye.tsk:: bye.o $$(info second expansion of $$@ prereqs); $(info $@ from $<) |
| 397 |
hello.o:: $$(info second expansion of $$@ prereqs); $(info $@) |
| 398 |
bye.o:: $$(info second expansion of $$@ prereqs); $(info $@) |
| 399 |
!, 'hello.tsk', |
| 400 |
"second expansion of hello.tsk prereqs |
| 401 |
second expansion of hello.o prereqs |
| 402 |
hello.o |
| 403 |
hello.tsk from hello.o |
| 404 |
#MAKE#: 'hello.tsk' is up to date.\n"); |
| 405 |
|
| 406 |
# sv 62706. |
| 407 |
# Double colon. 2 rules per targets. |
| 408 |
run_make_test(q! |
| 409 |
.SECONDEXPANSION: |
| 410 |
hello.tsk:: hello.o $$(info 1 second expansion of $$@ prereqs); $(info 1 $@ from $<) |
| 411 |
hello.tsk:: hello.o $$(info 2 second expansion of $$@ prereqs); $(info 2 $@ from $<) |
| 412 |
bye.tsk:: bye.o $$(info 1 second expansion of $$@ prereqs); $(info 1 $@ from $<) |
| 413 |
bye.tsk:: bye.o $$(info 2 second expansion of $$@ prereqs); $(info 2 $@ from $<) |
| 414 |
hello.o:: $$(info 1 second expansion of $$@ prereqs); $(info 1 $@) |
| 415 |
hello.o:: $$(info 2 second expansion of $$@ prereqs); $(info 2 $@) |
| 416 |
bye.o:: $$(info 1 second expansion of $$@ prereqs); $(info 1 $@) |
| 417 |
bye.o:: $$(info 2 second expansion of $$@ prereqs); $(info 2 $@) |
| 418 |
!, 'hello.tsk', |
| 419 |
"1 second expansion of hello.tsk prereqs |
| 420 |
1 second expansion of hello.o prereqs |
| 421 |
1 hello.o |
| 422 |
2 second expansion of hello.o prereqs |
| 423 |
2 hello.o |
| 424 |
1 hello.tsk from hello.o |
| 425 |
2 second expansion of hello.tsk prereqs |
| 426 |
2 hello.tsk from hello.o |
| 427 |
#MAKE#: 'hello.tsk' is up to date.\n"); |
| 428 |
|
| 429 |
# sv 62706. |
| 430 |
# Test that the prerequisites of 'hello.tsk' are second expanded once. |
| 431 |
run_make_test(q! |
| 432 |
.SECONDEXPANSION: |
| 433 |
all: hello.tsk hello.q |
| 434 |
hello.tsk: hello.o $$(info second expansion of $$@ prereqs); $(info $@ from $^) |
| 435 |
hello.o: $$(info second expansion of $$@ prereqs); $(info $@) |
| 436 |
hello.q: hello.tsk $$(info second expansion of $$@ prereqs); $(info $@ from $^) |
| 437 |
!, '', |
| 438 |
"second expansion of hello.tsk prereqs |
| 439 |
second expansion of hello.o prereqs |
| 440 |
hello.o |
| 441 |
hello.tsk from hello.o |
| 442 |
second expansion of hello.q prereqs |
| 443 |
hello.q from hello.tsk |
| 444 |
#MAKE#: Nothing to be done for 'all'.\n"); |
| 445 |
|
| 446 |
# sv 62706. |
| 447 |
# Merge vpath file and local file. |
| 448 |
# Test that both sets of prerequisites from 'hello.c' rule and from |
| 449 |
# 'src/hello.c' rule are second expanded. |
| 450 |
run_make_test(q! |
| 451 |
.SECONDEXPANSION: |
| 452 |
vpath hello.c src |
| 453 |
all: hello.c; $(info $@ from $^) |
| 454 |
hello.c: $$(info second expansion of hello.c prereqs); $(info 1 $@) |
| 455 |
src/hello.c: $$(info second expansion of src/hello.c prereqs); $(info 2 $@) |
| 456 |
!, '', |
| 457 |
"#MAKEFILE#:5: Recipe was specified for file 'hello.c' at #MAKEFILE#:5, |
| 458 |
#MAKEFILE#:5: but 'hello.c' is now considered the same file as 'src/hello.c'. |
| 459 |
#MAKEFILE#:5: Recipe for 'hello.c' will be ignored in favor of the one for 'src/hello.c'. |
| 460 |
second expansion of src/hello.c prereqs |
| 461 |
second expansion of hello.c prereqs |
| 462 |
2 src/hello.c |
| 463 |
all from src/hello.c |
| 464 |
#MAKE#: 'all' is up to date.\n"); |
| 465 |
|
| 466 |
# sv 62706. |
| 467 |
# .DEFAULT. |
| 468 |
run_make_test(q! |
| 469 |
.SECONDEXPANSION: |
| 470 |
bye:=bye.c |
| 471 |
all: hello.o |
| 472 |
.DEFAULT: $$(info second expansion of prereqs of default recipe @ = $$@) ; $(info default recipe $@) |
| 473 |
!, '', |
| 474 |
"default recipe hello.o |
| 475 |
#MAKE#: Nothing to be done for 'all'.\n"); |
| 476 |
|
| 477 |
unlink('hello.1'); |
| 478 |
|
| 479 |
# sv 62706. |
| 480 |
# No side effects from second expansion of unrelated rules. |
| 481 |
run_make_test(q! |
| 482 |
.SECONDEXPANSION: |
| 483 |
hello.tsk:; exit 1 |
| 484 |
unrelated: $$(shell touch hello.1); |
| 485 |
!, '', |
| 486 |
"exit 1 |
| 487 |
#MAKE#: *** [#MAKEFILE#:3: hello.tsk] Error 1\n", 512); |
| 488 |
|
| 489 |
# sv 62706. |
| 490 |
# Second expansion of intermediate prerequisites. |
| 491 |
# The rule to build hello.x is explicit. |
| 492 |
# .SECONDARY marks hello.x as intermediate. |
| 493 |
# Test that $$(deps) is secondary expanded. |
| 494 |
run_make_test(q! |
| 495 |
deps:=hello.h |
| 496 |
.SECONDEXPANSION: |
| 497 |
.SECONDARY: hello.x |
| 498 |
all: hello.x |
| 499 |
hello.x: $$(deps); $(info $@) |
| 500 |
hello.h:; $(info $@) |
| 501 |
!, '', "hello.h\nhello.x\n#MAKE#: Nothing to be done for 'all'.\n"); |
| 502 |
|
| 503 |
|
| 504 |
1; |