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/ChangeLog | 5 +++++ tests/scripts/features/order_only | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) (limited to 'tests') diff --git a/tests/ChangeLog b/tests/ChangeLog index 0f6da1b..76e725d 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,8 @@ +2004-01-07 Paul D. Smith + + * scripts/features/order_only: Test order-only prerequisites in + pattern rules (patch #2349). + 2003-11-02 Paul D. Smith * scripts/functions/if: Test if on conditionals with trailing 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