From 11095a90f120545c915c92b8ebf48f04723d1837 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Mon, 24 Oct 2005 13:01:39 +0000 Subject: Make second expansion optional (partial implementation). I decided this feature was too impacting to make the permanent default behavior. This set of changes makes the default behavior of make the old behavior (no second expansion). If you want second expansion, you must define the .SECONDEXPANSION: special target before the first target that needs it. This set of changes ONLY fixes explicit and static pattern rules to work like this. Implicit rules still have second expansion enabled all the time: I'll work on that next. Note that there is still a backward-incompatibility: now to get the old SysV behavior using $$@ etc. in the prerequisites list you need to set .SECONDEXPANSION: as well. --- tests/scripts/features/se_explicit | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'tests/scripts/features/se_explicit') diff --git a/tests/scripts/features/se_explicit b/tests/scripts/features/se_explicit index 0e696be..01860a9 100644 --- a/tests/scripts/features/se_explicit +++ b/tests/scripts/features/se_explicit @@ -3,9 +3,29 @@ $description = "Test second expansion in ordinary rules."; $details = ""; -# Test #1: automatic variables. +# TEST #0: Test handing of '$' in prerequisites with and without second +# expansion. + +run_make_test(q! +ifdef SE + .SECONDEXPANSION: +endif +foo$$bar: bar$$baz bar$$biz ; @echo '$@ : $^' +PRE = one two +bar$$baz: $$(PRE) +baraz: $$(PRE) +PRE = three four +.DEFAULT: ; @echo '$@' +!, + '', + "\$\nbar\$biz\nfoo\$bar : bar\$baz bar\$biz"); + +run_make_test(undef, 'SE=1', "three\nfour\nbariz\nfoo\$bar : baraz bariz"); + +# TEST #1: automatic variables. # run_make_test(' +.SECONDEXPANSION: .DEFAULT: ; @echo $@ foo: bar baz @@ -41,6 +61,7 @@ buz.5 # Test #2: target/pattern -specific variables. # run_make_test(' +.SECONDEXPANSION: .DEFAULT: ; @echo $@ foo.x: $$a $$b @@ -59,6 +80,7 @@ baz # Test #3: order of prerequisites. # run_make_test(' +.SECONDEXPANSION: .DEFAULT: ; @echo $@ all: foo bar baz -- cgit v1.2.3