summaryrefslogtreecommitdiff
path: root/tests/scripts/features/se_implicit
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@kolpackov.net>2005-02-27 21:40:23 +0000
committerBoris Kolpackov <boris@kolpackov.net>2005-02-27 21:40:23 +0000
commit659fc6b55e28740c74d66dbe3bda765d1004a12e (patch)
treea3b99015012abca13c0f7729274dff1bba322f1f /tests/scripts/features/se_implicit
parent9d153cc1b1e467cd6245755c32f78efbd62142c2 (diff)
downloadgunmake-659fc6b55e28740c74d66dbe3bda765d1004a12e.tar.gz
Implementation of the second expansion in explicit
rules, static pattern rules and implicit rules.
Diffstat (limited to 'tests/scripts/features/se_implicit')
-rw-r--r--tests/scripts/features/se_implicit188
1 files changed, 188 insertions, 0 deletions
diff --git a/tests/scripts/features/se_implicit b/tests/scripts/features/se_implicit
new file mode 100644
index 0000000..b6b726c
--- /dev/null
+++ b/tests/scripts/features/se_implicit
@@ -0,0 +1,188 @@
+# -*-perl-*-
+$description = "Test second expansion in ordinary rules.";
+
+$details = "";
+
+use Cwd;
+
+$dir = cwd;
+$dir =~ s,.*/([^/]+)$,../$1,;
+
+
+# Test #1: automatic variables.
+#
+run_make_test('
+.DEFAULT: ; @echo $@
+
+foo.a: bar baz
+
+foo.a: biz | buz
+
+foo.%: 1.$$@ \
+ 2.$$< \
+ $$(addprefix 3.,$$^) \
+ $$(addprefix 4.,$$+) \
+ 5.$$| \
+ 6.$$*
+ @:
+
+1.foo.a \
+2.bar \
+3.bar \
+3.baz \
+3.biz \
+4.bar \
+4.baz \
+4.biz \
+5.buz \
+6.a:
+ @echo $@
+
+',
+'',
+'1.foo.a
+2.bar
+3.bar
+3.baz
+3.biz
+4.bar
+4.baz
+4.biz
+5.buz
+6.a
+bar
+baz
+biz
+buz
+');
+
+
+# Test #2: target/pattern -specific variables.
+#
+run_make_test('
+foo.x:
+
+foo.%: $$(%_a) $$(%_b) bar
+ @:
+
+foo.x: x_a := bar
+
+%.x: x_b := baz
+
+bar baz: ; @echo $@
+
+',
+'',
+'bar
+baz
+');
+
+
+# Test #3: order of prerequisites.
+#
+run_make_test('
+.DEFAULT: ; @echo $@
+
+all: foo bar baz
+
+
+# Subtest #1
+#
+%oo: %oo.1; @:
+
+foo: foo.2
+
+foo: foo.3
+
+foo.1: ; @echo $@
+
+
+# Subtest #2
+#
+bar: bar.2
+
+%ar: %ar.1; @:
+
+bar: bar.3
+
+bar.1: ; @echo $@
+
+
+# Subtest #3
+#
+baz: baz.1
+
+baz: baz.2
+
+%az: ; @:
+
+',
+'',
+'foo.1
+foo.2
+foo.3
+bar.1
+bar.2
+bar.3
+baz.1
+baz.2
+');
+
+
+# Test #4: stem splitting logic.
+#
+run_make_test('
+$(dir)/tmp/bar.o:
+
+$(dir)/tmp/foo/bar.c: ; @echo $@
+$(dir)/tmp/bar/bar.c: ; @echo $@
+foo.h: ; @echo $@
+
+%.o: $$(addsuffix /%.c,foo bar) foo.h
+ @echo $@: {$<} $^
+
+',
+"dir=$dir",
+"$dir/tmp/foo/bar.c
+$dir/tmp/bar/bar.c
+foo.h
+$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('
+$(dir)/tmp/foo.o: $(dir)/tmp/foo.c
+$(dir)/tmp/foo.c: ; @echo $@
+bar.h: ; @echo $@
+
+%.o: %.c|bar.h
+ @echo $@: {$<} {$|} $^
+
+',
+"dir=$dir",
+"$dir/tmp/foo.c
+bar.h
+$dir/tmp/foo.o: {$dir/tmp/foo.c} {bar.h} $dir/tmp/foo.c
+");
+
+
+# Test #6: lack of implicit prerequisites.
+#
+run_make_test('
+foo.o: foo.c
+foo.c: ; @echo $@
+
+%.o:
+ @echo $@: {$<} $^
+
+',
+'',
+'foo.c
+foo.o: {foo.c} foo.c
+');
+
+
+# This tells the test driver that the perl test script executed properly.
+1;