summaryrefslogtreecommitdiff
path: root/tests/scripts
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2004-01-07 19:36:39 +0000
committerPaul Smith <psmith@gnu.org>2004-01-07 19:36:39 +0000
commita35db9027526a8cad59c4e139ab224946245a7f7 (patch)
tree010e38117617a73053a9ac5fbecf3316b2eff705 /tests/scripts
parentee3d37a591cf2db3dd1444b2c1e2fcb041f68d33 (diff)
downloadgunmake-a35db9027526a8cad59c4e139ab224946245a7f7.tar.gz
Fix order-only prerequisites for pattern rules. (Savannah patch #2349).
Add a regression test for this. Older libraries don't allow *alloc(0), so make sure we don't ever do that.
Diffstat (limited to 'tests/scripts')
-rw-r--r--tests/scripts/features/order_only35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/scripts/features/order_only b/tests/scripts/features/order_only
index e324d68..ac0d538 100644
--- a/tests/scripts/features/order_only
+++ b/tests/scripts/features/order_only
@@ -109,4 +109,39 @@ $answer = "touch baz\n";
unlink(qw(foo baz));
+# Test order-only in pattern rules
+
+$makefile4 = &get_tmpfile;
+
+open(MAKEFILE,"> $makefile4");
+
+print MAKEFILE <<'EOF';
+%.w : %.x | baz
+ @echo '$$^ = $^'
+ @echo '$$| = $|'
+ touch $@
+
+all: foo.w
+
+.PHONY: baz
+foo.x baz:
+ touch $@
+EOF
+
+close(MAKEFILE);
+
+# TEST #7 -- make sure the parser was correct.
+
+&run_make_with_options($makefile4, "", &get_logfile);
+$answer = "touch foo.x\ntouch baz\n\$^ = foo.x\n\$| = baz\ntouch foo.w\n";
+&compare_output($answer,&get_logfile(1));
+
+# TEST #8 -- now we do it again: this time foo.w won't be built
+
+&run_make_with_options($makefile4, "", &get_logfile);
+$answer = "touch baz\n";
+&compare_output($answer,&get_logfile(1));
+
+unlink(qw(foo.w foo.x baz));
+
1;