diff options
author | Ron Yorston <rmy@pobox.com> | 2024-10-20 12:52:42 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2024-10-20 12:52:42 +0100 |
commit | ef4756eb0994bc25de66cbb04e1752dda217ff5d (patch) | |
tree | b5e13e2148177d67993d50e547de3f8c5ad1e85a /testsuite/make.tests | |
parent | 253bcde618f9f3f4b12015bcc62f59e8cddff45d (diff) | |
download | busybox-w32-ef4756eb0994bc25de66cbb04e1752dda217ff5d.tar.gz busybox-w32-ef4756eb0994bc25de66cbb04e1752dda217ff5d.tar.bz2 busybox-w32-ef4756eb0994bc25de66cbb04e1752dda217ff5d.zip |
make: changes to .DEFAULT/inference rules
The POSIX standard allows inference rules to be redefined but not
the .DEFAULT rule. There is no explicit exception for .DEFAULT to:
Only one target rule for any given target can contain commands.
Treat redefinition of a .DEFAULT rule as an error in POSIX mode
but allow it as an extension.
Also, the code didn't allow an inference rule with dependencies to
redefine an existing inference rule. This is no longer the case.
Adds 64-96 bytes.
Diffstat (limited to '')
-rwxr-xr-x | testsuite/make.tests | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/testsuite/make.tests b/testsuite/make.tests index a12e50b8b..376bdcc15 100755 --- a/testsuite/make.tests +++ b/testsuite/make.tests | |||
@@ -12,18 +12,6 @@ target: | |||
12 | @echo target | 12 | @echo target |
13 | ' | 13 | ' |
14 | 14 | ||
15 | # .DEFAULT rules with no commands or some prerequisites are ignored. | ||
16 | # .DEFAULT rules with commands can be redefined. | ||
17 | testing "make .DEFAULT rule" \ | ||
18 | "make -f - default" "default2\n" "" ' | ||
19 | .DEFAULT: ignored | ||
20 | .DEFAULT: | ||
21 | @echo default1 | ||
22 | .DEFAULT: | ||
23 | @echo default2 | ||
24 | target: | ||
25 | ' | ||
26 | |||
27 | testing "make .DEFAULT rule for prerequisite" \ | 15 | testing "make .DEFAULT rule for prerequisite" \ |
28 | "make -f - 2>/dev/null" "source\n" "" ' | 16 | "make -f - 2>/dev/null" "source\n" "" ' |
29 | .DEFAULT: | 17 | .DEFAULT: |
@@ -721,6 +709,26 @@ target:: file2 file3 file3 | |||
721 | ' | 709 | ' |
722 | cd .. || exit 1; rm -rf make.tempdir 2>/dev/null | 710 | cd .. || exit 1; rm -rf make.tempdir 2>/dev/null |
723 | 711 | ||
712 | # .DEFAULT rules with no commands or some prerequisites are ignored. | ||
713 | # .DEFAULT rules with commands can be redefined. | ||
714 | testing "make: .DEFAULT rule" \ | ||
715 | "make -f - default" "default2\n" "" ' | ||
716 | .DEFAULT: ignored | ||
717 | .DEFAULT: | ||
718 | @echo default1 | ||
719 | .DEFAULT: | ||
720 | @echo default2 | ||
721 | target: | ||
722 | ' | ||
723 | |||
724 | testing "make: double-colon rule" \ | ||
725 | "make -f -" "target1\ntarget2\n" "" ' | ||
726 | target:: | ||
727 | @echo target1 | ||
728 | target:: | ||
729 | @echo target2 | ||
730 | ' | ||
731 | |||
724 | # Double-colon rules didn't work properly if their target was phony: | 732 | # Double-colon rules didn't work properly if their target was phony: |
725 | # - they didn't ignore the presence of a file matching the target name; | 733 | # - they didn't ignore the presence of a file matching the target name; |
726 | # - they were also invoked as if they were a single-colon rule. | 734 | # - they were also invoked as if they were a single-colon rule. |