|
Last change
on this file was 2579, checked in by bird, 12 years ago |
|
Importing make-3.82.tar.bz2 (md5sum 1a11100f3c63fcf5753818e59d63088f) with --auto-props but no keywords.
|
|
File size:
2.4 KB
|
| Line | |
|---|
| 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(q!
|
|---|
| 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(q!
|
|---|
| 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 | 'bar
|
|---|
| 75 | baz
|
|---|
| 76 | ');
|
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 | # Test #3: order of prerequisites.
|
|---|
| 80 | #
|
|---|
| 81 | run_make_test(q!
|
|---|
| 82 | .SECONDEXPANSION:
|
|---|
| 83 | .DEFAULT: ; @echo '$@'
|
|---|
| 84 |
|
|---|
| 85 | all: foo bar baz
|
|---|
| 86 |
|
|---|
| 87 | # Subtest #1
|
|---|
| 88 | foo: foo.1; @:
|
|---|
| 89 | foo: foo.2
|
|---|
| 90 | foo: foo.3
|
|---|
| 91 |
|
|---|
| 92 | # Subtest #2
|
|---|
| 93 | bar: bar.2
|
|---|
| 94 | bar: bar.1; @:
|
|---|
| 95 | bar: bar.3
|
|---|
| 96 |
|
|---|
| 97 | # Subtest #3
|
|---|
| 98 | baz: baz.1
|
|---|
| 99 | baz: baz.2
|
|---|
| 100 | baz: ; @:
|
|---|
| 101 | !,
|
|---|
| 102 | '',
|
|---|
| 103 | 'foo.1
|
|---|
| 104 | foo.2
|
|---|
| 105 | foo.3
|
|---|
| 106 | bar.1
|
|---|
| 107 | bar.2
|
|---|
| 108 | bar.3
|
|---|
| 109 | baz.1
|
|---|
| 110 | baz.2
|
|---|
| 111 | ');
|
|---|
| 112 |
|
|---|
| 113 | # TEST #4: eval in a context where there is no reading_file
|
|---|
| 114 | run_make_test(q!
|
|---|
| 115 | .SECONDEXPANSION:
|
|---|
| 116 | all : $$(eval $$(info test))
|
|---|
| 117 | !,
|
|---|
| 118 | '', "test\n#MAKE#: Nothing to be done for `all'.\n");
|
|---|
| 119 |
|
|---|
| 120 | # TEST #5: (NEGATIVE) catch eval in a prereq list trying to create new
|
|---|
| 121 | # target/prereq relationships.
|
|---|
| 122 |
|
|---|
| 123 | run_make_test(q!
|
|---|
| 124 | .SECONDEXPANSION:
|
|---|
| 125 | proj1.exe : proj1.o $$(eval $$(test))
|
|---|
| 126 | define test
|
|---|
| 127 | proj1.o : proj1.c
|
|---|
| 128 | proj1.c: proj1.h
|
|---|
| 129 | endef
|
|---|
| 130 | !,
|
|---|
| 131 | '', "#MAKE#: *** prerequisites cannot be defined in recipes. Stop.\n", 512);
|
|---|
| 132 |
|
|---|
| 133 |
|
|---|
| 134 | # Automatic $$+ variable expansion issue. Savannah bug #25780
|
|---|
| 135 | run_make_test(q!
|
|---|
| 136 | all : foo foo
|
|---|
| 137 | .SECONDEXPANSION:
|
|---|
| 138 | all : $$+ ; @echo '$+'
|
|---|
| 139 | foo : ;
|
|---|
| 140 | !,
|
|---|
| 141 | '', "foo foo foo foo\n");
|
|---|
| 142 |
|
|---|
| 143 |
|
|---|
| 144 | # Automatic $$+ variable expansion issue. Savannah bug #25780
|
|---|
| 145 | run_make_test(q!
|
|---|
| 146 | all : bar bar
|
|---|
| 147 | bar : ;
|
|---|
| 148 | q%x : ;
|
|---|
| 149 | .SECONDEXPANSION:
|
|---|
| 150 | a%l: q1x $$+ q2x ; @echo '$+'
|
|---|
| 151 | !,
|
|---|
| 152 | '', "q1x bar bar q2x bar bar\n");
|
|---|
| 153 |
|
|---|
| 154 |
|
|---|
| 155 | # This tells the test driver that the perl test script executed properly.
|
|---|
| 156 | 1;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.