summaryrefslogtreecommitdiff
path: root/tests/scripts/features/se_explicit
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2005-10-24 13:01:39 +0000
committerPaul Smith <psmith@gnu.org>2005-10-24 13:01:39 +0000
commit11095a90f120545c915c92b8ebf48f04723d1837 (patch)
tree73dba88903ea90cdac930057fe8619a8a04fb869 /tests/scripts/features/se_explicit
parent66459baee27374577d32a78564604ad64228f71d (diff)
downloadgunmake-11095a90f120545c915c92b8ebf48f04723d1837.tar.gz
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.
Diffstat (limited to 'tests/scripts/features/se_explicit')
-rw-r--r--tests/scripts/features/se_explicit24
1 files changed, 23 insertions, 1 deletions
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