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 run_make_test(q! 10 ifdef SE 11 .SECONDEXPANSION: 12 endif 13 foo$$bar: bar$$baz bar$$biz ; @echo '$@ : $^' 14 PRE = one two 15 bar$$baz: $$(PRE) 16 baraz: $$(PRE) 17 PRE = three four 18 .DEFAULT: ; @echo '$@' 19 !, 20 '', 21 "\$\nbar\$biz\nfoo\$bar : bar\$baz bar\$biz"); 22 23 run_make_test(undef, 'SE=1', "three\nfour\nbariz\nfoo\$bar : baraz bariz"); 24 25 # TEST #1: automatic variables. 26 # 27 run_make_test(' 28 .SECONDEXPANSION: 29 .DEFAULT: ; @echo $@ 30 31 foo: bar baz 32 33 foo: biz | buz 34 35 foo: $$@.1 \ 36 $$<.2 \ 37 $$(addsuffix .3,$$^) \ 38 $$(addsuffix .4,$$+) \ 39 $$|.5 \ 40 $$*.6 41 42 ', 43 '', 44 'bar 45 baz 46 biz 47 buz 48 foo.1 49 bar.2 50 bar.3 51 baz.3 52 biz.3 53 bar.4 54 baz.4 55 biz.4 56 buz.5 57 .6 58 '); 59 60 61 # Test #2: target/pattern -specific variables. 62 # 63 run_make_test(' 64 .SECONDEXPANSION: 65 .DEFAULT: ; @echo $@ 66 67 foo.x: $$a $$b 68 69 foo.x: a := bar 70 71 %.x: b := baz 72 73 ', 74 '', 75 'bar 76 baz 77 '); 78 79 80 # Test #3: order of prerequisites. 81 # 82 run_make_test(' 83 .SECONDEXPANSION: 84 .DEFAULT: ; @echo $@ 85 86 all: foo bar baz 87 88 # Subtest #1 89 # 90 foo: foo.1; @: 91 92 foo: foo.2 93 94 foo: foo.3 95 96 97 # Subtest #2 98 # 99 bar: bar.2 100 101 bar: bar.1; @: 102 103 bar: bar.3 104 105 106 # Subtest #3 107 # 108 baz: baz.1 109 110 baz: baz.2 111 112 baz: ; @: 113 114 ', 115 '', 116 'foo.1 117 foo.2 118 foo.3 119 bar.1 120 bar.2 121 bar.3 122 baz.1 123 baz.2 124 '); 125 126 # This tells the test driver that the perl test script executed properly. 127 1; 128