summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2005-12-11 15:41:17 +0000
committerPaul Smith <psmith@gnu.org>2005-12-11 15:41:17 +0000
commit3bcb608bdab1d3d24251548aac8bc33fc2fdad66 (patch)
tree9f5d9e31c96991d14c9774976873c32d2b467a72 /tests
parent0e6c4f5b0ed4183bbdb8cdce168dcbd1bc9cf182 (diff)
downloadgunmake-3bcb608bdab1d3d24251548aac8bc33fc2fdad66.tar.gz
Extend .SECONDEXPANSION to implicit rules. Final fix for bug #13781.
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog6
-rw-r--r--tests/scripts/features/se_implicit8
-rw-r--r--tests/scripts/misc/general427
3 files changed, 41 insertions, 0 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index e222ef1..9320597 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,9 @@
+2005-12-11 Paul D. Smith <psmith@gnu.org>
+
+ * scripts/misc/general4: Test implicit rules with '$' in the
+ prereq list & prereq patterns.
+ * scripts/features/se_implicit: Add in .SECONDEXPANSION settings.
+
2005-12-09 Boris Kolpackov <boris@kolpackov.net>
* scripts/features/patternrules: Add a test for bug #13022.
diff --git a/tests/scripts/features/se_implicit b/tests/scripts/features/se_implicit
index 0c38c17..c2ae648 100644
--- a/tests/scripts/features/se_implicit
+++ b/tests/scripts/features/se_implicit
@@ -12,6 +12,7 @@ $dir =~ s,.*/([^/]+)$,../$1,;
# Test #1: automatic variables.
#
run_make_test('
+.SECONDEXPANSION:
.DEFAULT: ; @echo $@
foo.a: bar baz
@@ -60,6 +61,7 @@ buz
# Test #2: target/pattern -specific variables.
#
run_make_test('
+.SECONDEXPANSION:
foo.x:
foo.%: $$(%_a) $$(%_b) bar
@@ -81,6 +83,7 @@ baz
# Test #3: order of prerequisites.
#
run_make_test('
+.SECONDEXPANSION:
.DEFAULT: ; @echo $@
all: foo bar baz
@@ -132,6 +135,7 @@ baz.2
# Test #4: stem splitting logic.
#
run_make_test('
+.SECONDEXPANSION:
$(dir)/tmp/bar.o:
$(dir)/tmp/foo/bar.c: ; @echo $@
@@ -153,6 +157,7 @@ $dir/tmp/bar.o: {$dir/tmp/foo/bar.c} $dir/tmp/foo/bar.c $dir/tmp/bar/bar.c foo.h
# Test #5: stem splitting logic and order-only prerequisites.
#
run_make_test('
+.SECONDEXPANSION:
$(dir)/tmp/foo.o: $(dir)/tmp/foo.c
$(dir)/tmp/foo.c: ; @echo $@
bar.h: ; @echo $@
@@ -171,6 +176,7 @@ $dir/tmp/foo.o: {$dir/tmp/foo.c} {bar.h} $dir/tmp/foo.c
# Test #6: lack of implicit prerequisites.
#
run_make_test('
+.SECONDEXPANSION:
foo.o: foo.c
foo.c: ; @echo $@
@@ -186,6 +192,7 @@ foo.o: {foo.c} foo.c
# Test #7: Test stem from the middle of the name.
#
run_make_test('
+.SECONDEXPANSION:
foobarbaz:
foo%baz: % $$*.1
@@ -204,6 +211,7 @@ bar
# Test #8: Make sure stem triple-expansion does not happen.
#
run_make_test('
+.SECONDEXPANSION:
foo$$bar:
f%r: % $$*.1
diff --git a/tests/scripts/misc/general4 b/tests/scripts/misc/general4
index bce4a30..ccccf88 100644
--- a/tests/scripts/misc/general4
+++ b/tests/scripts/misc/general4
@@ -53,4 +53,31 @@ baz$$bar bar$$baz: ; @echo '$@'
'',
"baz\$bar\ndone baz\$bar");
+
+# Test implicit rules with '$' in the name (see se_implicit)
+# Use the '$' in the pattern.
+
+run_make_test(q!
+%.foo : %$$bar ; @echo 'done $<'
+test.foo:
+test$$bar: ; @echo '$@'
+!,
+ '',
+ "test\$bar\ndone test\$bar");
+
+# Make sure that subdirectories built as prerequisites are actually handled
+# properly... this time with '$'
+
+run_make_test(q!
+
+all: dir/subdir/file.$$a
+
+dir/subdir: ; @echo mkdir -p '$@'
+
+dir/subdir/file.$$b: dir/subdir ; @echo touch '$@'
+
+dir/subdir/%.$$a: dir/subdir/%.$$b ; @echo 'cp $< $@'
+!,
+ '', "mkdir -p dir/subdir\ntouch dir/subdir/file.\$b\ncp dir/subdir/file.\$b dir/subdir/file.\$a\n");
+
1;