1# -*-perl-*- 2$description = "Test second expansion in static pattern rules."; 3 4$details = ""; 5 6# Test #1: automatic variables. 7# 8run_make_test(' 9.SECONDEXPANSION: 10.DEFAULT: ; @echo $@ 11 12foo.a foo.b: foo.%: bar.% baz.% 13 14foo.a foo.b: foo.%: biz.% | buz.% 15 16foo.a foo.b: foo.%: $$@.1 \ 17 $$<.2 \ 18 $$(addsuffix .3,$$^) \ 19 $$(addsuffix .4,$$+) \ 20 $$|.5 \ 21 $$*.6 22 23', 24'', 25'bar.a 26baz.a 27biz.a 28buz.a 29foo.a.1 30bar.a.2 31bar.a.3 32baz.a.3 33biz.a.3 34bar.a.4 35baz.a.4 36biz.a.4 37buz.a.5 38a.6 39'); 40 41 42# Test #2: target/pattern -specific variables. 43# 44run_make_test(' 45.SECONDEXPANSION: 46.DEFAULT: ; @echo $@ 47 48foo.x foo.y: foo.%: $$(%_a) $$($$*_b) 49 50foo.x: x_a := bar 51 52%.x: x_b := baz 53 54 55', 56'', 57'bar 58baz 59'); 60 61 62# Test #3: order of prerequisites. 63# 64run_make_test(' 65.SECONDEXPANSION: 66.DEFAULT: ; @echo $@ 67 68all: foo.a bar.a baz.a 69 70# Subtest #1 71# 72foo.a foo.b: foo.%: foo.%.1; @: 73 74foo.a foo.b: foo.%: foo.%.2 75 76foo.a foo.b: foo.%: foo.%.3 77 78 79# Subtest #2 80# 81bar.a bar.b: bar.%: bar.%.2 82 83bar.a bar.b: bar.%: bar.%.1; @: 84 85bar.a bar.b: bar.%: bar.%.3 86 87 88# Subtest #3 89# 90baz.a baz.b: baz.%: baz.%.1 91 92baz.a baz.b: baz.%: baz.%.2 93 94baz.a baz.b: ; @: 95 96', 97'', 98'foo.a.1 99foo.a.2 100foo.a.3 101bar.a.1 102bar.a.2 103bar.a.3 104baz.a.1 105baz.a.2 106'); 107 108 109# Test #4: Make sure stem triple-expansion does not happen. 110# 111run_make_test(' 112.SECONDEXPANSION: 113foo$$bar: f%r: % $$*.1 114 @echo \'$*\' 115 116oo$$ba oo$$ba.1: 117 @echo \'$@\' 118 119', 120'', 121'oo$ba 122oo$ba.1 123oo$ba 124'); 125 126 127# This tells the test driver that the perl test script executed properly. 1281; 129