aboutsummaryrefslogtreecommitdiff
path: root/testsuite/make.tests
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2024-05-31 10:27:18 +0100
committerRon Yorston <rmy@pobox.com>2024-05-31 10:27:18 +0100
commitf9d10b2b6314ea2a80515112498aaa919ad81c97 (patch)
tree3f199636f02b16f94f12cd9fe65b04fd087123f8 /testsuite/make.tests
parent2a0923c400fe5df140e1c5aad8dc59f4733e8598 (diff)
downloadbusybox-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-xtestsuite/make.tests23
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
103target:;@echo a = $(a) 103target:;@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.
108testing "make equal sign in obfuscated inline command" \
109 "make -f -" "a = a\n" "" '
110a = a
111semi = ;
112target:$(semi)@echo a = $(a)
113'
114
115# The fix for the above test broke a complex chain of macro assignments
116# generated by autotools.
117testing "make complex chain of macro assignments" \
118 "make -f -" "flag 1\n" "" '
119FLAG_ = $(FLAG_$(VALUE))
120FLAG_0 = flag 0
121FLAG_1 = flag 1
122MYFLAG = $(FLAG_$(VALUE))
123VALUE = 1
124
125target:
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.