From a35db9027526a8cad59c4e139ab224946245a7f7 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Wed, 7 Jan 2004 19:36:39 +0000 Subject: 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. --- tests/scripts/features/order_only | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'tests/scripts') 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; -- cgit v1.2.3