diff options
author | Ron Yorston <rmy@pobox.com> | 2024-05-31 10:27:18 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2024-05-31 10:27:18 +0100 |
commit | f9d10b2b6314ea2a80515112498aaa919ad81c97 (patch) | |
tree | 3f199636f02b16f94f12cd9fe65b04fd087123f8 /testsuite/make.tests | |
parent | 2a0923c400fe5df140e1c5aad8dc59f4733e8598 (diff) | |
download | busybox-w32-f9d10b2b6314ea2a80515112498aaa919ad81c97.tar.gz busybox-w32-f9d10b2b6314ea2a80515112498aaa919ad81c97.tar.bz2 busybox-w32-f9d10b2b6314ea2a80515112498aaa919ad81c97.zip |
make: fix detection of target rules (take 2)
Commit d6b764116 (make: fix detection of target rules) checked
for target rules before macro assignments. This failed for some
Makefiles generated by autotools because partially defined macros
were expanded while testing for a target rule.
Revert to checking for macro assignments first, but try to detect
if the proposed left hand side of the assignment might form part
of a target rule with an inline command.
Also handle the case where the ';' separator of the inline command
has been obfuscated by putting it in a macro.
Saves 128-160 bytes.
(GitHub pdpmake issues 31, 44)
Diffstat (limited to '')
-rwxr-xr-x | testsuite/make.tests | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/testsuite/make.tests b/testsuite/make.tests index 0397ab4de..6438c90c9 100755 --- a/testsuite/make.tests +++ b/testsuite/make.tests | |||
@@ -103,6 +103,29 @@ a = a | |||
103 | target:;@echo a = $(a) | 103 | target:;@echo a = $(a) |
104 | ' | 104 | ' |
105 | 105 | ||
106 | # Ensure an inline command on a target rule can be detected even if | ||
107 | # the semicolon is obfuscated. | ||
108 | testing "make equal sign in obfuscated inline command" \ | ||
109 | "make -f -" "a = a\n" "" ' | ||
110 | a = a | ||
111 | semi = ; | ||
112 | target:$(semi)@echo a = $(a) | ||
113 | ' | ||
114 | |||
115 | # The fix for the above test broke a complex chain of macro assignments | ||
116 | # generated by autotools. | ||
117 | testing "make complex chain of macro assignments" \ | ||
118 | "make -f -" "flag 1\n" "" ' | ||
119 | FLAG_ = $(FLAG_$(VALUE)) | ||
120 | FLAG_0 = flag 0 | ||
121 | FLAG_1 = flag 1 | ||
122 | MYFLAG = $(FLAG_$(VALUE)) | ||
123 | VALUE = 1 | ||
124 | |||
125 | target: | ||
126 | @echo $(MYFLAG) | ||
127 | ' | ||
128 | |||
106 | # When a build command fails and the '-k' option has been provided | 129 | # When a build command fails and the '-k' option has been provided |
107 | # (continue execution on error) no further commands should be executed | 130 | # (continue execution on error) no further commands should be executed |
108 | # for the current target. | 131 | # for the current target. |