2 $description = "Test second expansion in ordinary rules.";
6 # TEST #0: Test handing of '$' in prerequisites with and without second
9 # If we don't support archives then the prerequisite is different
10 my $prereq = exists $FEATURES{'archives'} ? '$' : '$(PRE)';
16 foo$$bar: bar$$baz bar$$biz ; @echo '$@ : $^'
21 .DEFAULT: ; @echo '$@'
24 "$prereq\nbar\$biz\nfoo\$bar : bar\$baz bar\$biz");
26 run_make_test(undef, 'SE=1', "three\nfour\nbariz\nfoo\$bar : baraz bariz");
28 # TEST #1: automatic variables.
32 .DEFAULT: ; @echo '$@'
40 $$(addsuffix .3,$$^) \
41 $$(addsuffix .4,$$+) \
64 # Test #2: target/pattern -specific variables.
68 .DEFAULT: ; @echo '$@'
82 # Test #3: order of prerequisites.
86 .DEFAULT: ; @echo '$@'
116 # TEST #4: eval in a context where there is no reading_file
119 all : $$(eval $$(info test))
121 '', "test\n#MAKE#: Nothing to be done for 'all'.\n");
123 # TEST #5: (NEGATIVE) catch eval in a prereq list trying to create new
124 # target/prereq relationships.
128 proj1.exe : proj1.o $$(eval $$(test))
134 '', "#MAKE#: *** prerequisites cannot be defined in recipes. Stop.\n", 512);
137 # Automatic $$+ variable expansion issue. Savannah bug #25780
141 all : $$+ ; @echo '$+'
144 '', "foo foo foo foo\n");
147 # Automatic $$+ variable expansion issue. Savannah bug #25780
153 a%l: q1x $$+ q2x ; @echo '$+'
155 '', "q1x bar bar q2x bar bar\n");
158 # Allow patsubst shorthand in second expansion context.
159 # Requires the colon to be quoted. Savannah bug #16545
163 foo: $$(@\\:%=%.bar); @echo '$^'
167 # SV 54549 : Ensure we don't free used variable_sets
171 # Removing second expansion prevents segfault
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 $@`
182 # Having an empty command prevents segfault.
185 # Not creating libcat.a here prevents segfault,
186 libcat.a: ; @touch $@
188 '', q!#MAKEFILE#:16: Recipe was specified for file '-lcat' at #MAKEFILE#:19,
189 #MAKEFILE#:16: but '-lcat' is now considered the same file as 'libcat.a'.
190 #MAKEFILE#:16: Recipe for 'libcat.a' will be ignored in favor of the one for '-lcat'.!);
193 # SV 28456 : Don't reset $$< for default recipes
201 '', "baz\n#MAKE#: Nothing to be done for 'biz'.\n");