diff options
author | Paul Smith <psmith@gnu.org> | 2005-10-24 13:01:39 +0000 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2005-10-24 13:01:39 +0000 |
commit | 11095a90f120545c915c92b8ebf48f04723d1837 (patch) | |
tree | 73dba88903ea90cdac930057fe8619a8a04fb869 /tests/scripts/features/order_only | |
parent | 66459baee27374577d32a78564604ad64228f71d (diff) | |
download | gunmake-11095a90f120545c915c92b8ebf48f04723d1837.tar.gz |
Make second expansion optional (partial implementation).
I decided this feature was too impacting to make the permanent default
behavior. This set of changes makes the default behavior of make the
old behavior (no second expansion). If you want second expansion, you
must define the .SECONDEXPANSION: special target before the first target
that needs it.
This set of changes ONLY fixes explicit and static pattern rules to work
like this. Implicit rules still have second expansion enabled all the
time: I'll work on that next.
Note that there is still a backward-incompatibility: now to get the old
SysV behavior using $$@ etc. in the prerequisites list you need to set
.SECONDEXPANSION: as well.
Diffstat (limited to 'tests/scripts/features/order_only')
-rw-r--r-- | tests/scripts/features/order_only | 104 |
1 files changed, 32 insertions, 72 deletions
diff --git a/tests/scripts/features/order_only b/tests/scripts/features/order_only index 82a7253..4ebdc2b 100644 --- a/tests/scripts/features/order_only +++ b/tests/scripts/features/order_only @@ -5,9 +5,18 @@ $details = "\ Create makefiles with various combinations of normal and order-only prerequisites and ensure they behave properly. Test the \$| variable."; -open(MAKEFILE,"> $makefile"); +# TEST #0 -- Basics -print MAKEFILE <<'EOF'; +run_make_test(' +%r: | baz ; @echo $< $^ $| +bar: foo +foo:;@: +baz:;@:', + '', "foo foo baz\n"); + +# TEST #1 -- First try: the order-only prereqs need to be built. + +run_make_test(q! foo: bar | baz @echo '$$^ = $^' @echo '$$| = $|' @@ -16,34 +25,19 @@ foo: bar | baz .PHONY: baz bar baz: - touch $@ -EOF - -close(MAKEFILE); - - -# TEST #1 -- just the syntax - -&run_make_with_options($makefile, "", &get_logfile); -$answer = "touch bar\ntouch baz\n\$^ = bar\n\$| = baz\ntouch foo\n"; -&compare_output($answer,&get_logfile(1)); + touch $@!, + '', "touch bar\ntouch baz\n\$^ = bar\n\$| = baz\ntouch foo\n"); # TEST #2 -- now we do it again: baz is PHONY but foo should _NOT_ be updated -&run_make_with_options($makefile, "", &get_logfile); -$answer = "touch baz\n"; -&compare_output($answer,&get_logfile(1)); +run_make_test(undef, '', "touch baz\n"); unlink(qw(foo bar baz)); -# Test prereqs that are both order and non-order - -$makefile2 = &get_tmpfile; - -open(MAKEFILE,"> $makefile2"); +# TEST #3 -- Make sure the order-only prereq was promoted to normal. -print MAKEFILE <<'EOF'; +run_make_test(q! foo: bar | baz @echo '$$^ = $^' @echo '$$| = $|' @@ -54,33 +48,21 @@ foo: baz .PHONY: baz bar baz: - touch $@ -EOF - -close(MAKEFILE); - -# TEST #3 -- Make sure the order-only prereq was promoted to normal. - -&run_make_with_options($makefile2, "", &get_logfile); -$answer = "touch bar\ntouch baz\n\$^ = bar baz\n\$| = \ntouch foo\n"; -&compare_output($answer,&get_logfile(1)); + touch $@!, + '', "touch bar\ntouch baz\n\$^ = bar baz\n\$| = \ntouch foo\n"); # TEST #4 -- now we do it again -&run_make_with_options($makefile2, "", &get_logfile); -$answer = "touch baz\n\$^ = bar baz\n\$| = \ntouch foo\n"; -&compare_output($answer,&get_logfile(1)); +run_make_test(undef, '', "touch baz\n\$^ = bar baz\n\$| = \ntouch foo\n"); unlink(qw(foo bar baz)); # Test empty normal prereqs -$makefile3 = &get_tmpfile; - -open(MAKEFILE,"> $makefile3"); +# TEST #5 -- make sure the parser was correct. -print MAKEFILE <<'EOF'; +run_make_test(q! foo:| baz @echo '$$^ = $^' @echo '$$| = $|' @@ -89,33 +71,20 @@ foo:| baz .PHONY: baz baz: - touch $@ -EOF - -close(MAKEFILE); - -# TEST #5 -- make sure the parser was correct. - -&run_make_with_options($makefile3, "", &get_logfile); -$answer = "touch baz\n\$^ = \n\$| = baz\ntouch foo\n"; -&compare_output($answer,&get_logfile(1)); - + touch $@!, + '', "touch baz\n\$^ = \n\$| = baz\ntouch foo\n"); # TEST #6 -- now we do it again: this time foo won't be built -&run_make_with_options($makefile3, "", &get_logfile); -$answer = "touch baz\n"; -&compare_output($answer,&get_logfile(1)); +run_make_test(undef, '', "touch baz\n"); unlink(qw(foo baz)); # Test order-only in pattern rules -$makefile4 = &get_tmpfile; - -open(MAKEFILE,"> $makefile4"); +# TEST #7 -- make sure the parser was correct. -print MAKEFILE <<'EOF'; +run_make_test(q! %.w : %.x | baz @echo '$$^ = $^' @echo '$$| = $|' @@ -125,22 +94,13 @@ 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)); + touch $@!, + '', + "touch foo.x\ntouch baz\n\$^ = foo.x\n\$| = baz\ntouch foo.w\n"); # 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)); +run_make_test(undef, '', "touch baz\n"); unlink(qw(foo.w foo.x baz)); @@ -151,8 +111,8 @@ run_make_test(' %r: | baz ; @echo $< $^ $| bar: foo foo:;@: -baz:;@: -', '', "foo foo baz\n"); +baz:;@:', + '', "foo foo baz\n"); 1; |