diff options
author | Ron Yorston <rmy@pobox.com> | 2024-05-28 11:54:51 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2024-05-28 11:54:51 +0100 |
commit | 208d9858409f823d533d1e95396dde00be03d7d3 (patch) | |
tree | 34c0ea21c8d1b23c2bc72909843b12bd1c0cb9ca /testsuite | |
parent | 0224cfd5e5c8157e5bc74a81027fa508687abfbf (diff) | |
download | busybox-w32-208d9858409f823d533d1e95396dde00be03d7d3.tar.gz busybox-w32-208d9858409f823d533d1e95396dde00be03d7d3.tar.bz2 busybox-w32-208d9858409f823d533d1e95396dde00be03d7d3.zip |
make: fixes to -t option
The -t option (in general) causes targets to be touched instead of
having build commands run to create them. There were two problems.
The flag variable 'ssilent' in docmds was too small (uint8_t) to
contain the value of 'dotouch' (uint32_t). Truncation of the
value resulted in build commands being echoed when they shouldn't
have been.
The POSIX specification is unclear as to how build commands with
a '+' prefix interact with touch. The rationale indicates that
this feature was imported from GNU make, so the behaviour has been
made to match what it does: if a '+' build command is run the
target is not touched.
The code has been rearranged to move the call to touch() up into
docmds().
Adds 48 bytes.
Diffstat (limited to 'testsuite')
-rwxr-xr-x | testsuite/make.tests | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/testsuite/make.tests b/testsuite/make.tests index 33e730602..c2b62532a 100755 --- a/testsuite/make.tests +++ b/testsuite/make.tests | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | . ./testing.sh | 3 | . ./testing.sh |
4 | unset MAKEFLAGS | 4 | unset MAKEFLAGS |
5 | rm -rf make.tempdir | ||
5 | 6 | ||
6 | # testing "test name" "command" "expected result" "file input" "stdin" | 7 | # testing "test name" "command" "expected result" "file input" "stdin" |
7 | 8 | ||
@@ -116,6 +117,31 @@ baz: | |||
116 | @: | 117 | @: |
117 | ' | 118 | ' |
118 | 119 | ||
120 | # The -t option touches files that are out-of-date unless the target | ||
121 | # has no commands or they're already up-to-date. | ||
122 | mkdir make.tempdir && cd make.tempdir || exit 1 | ||
123 | touch baz | ||
124 | testing "make check -t option" \ | ||
125 | "make -t -f - 2>/dev/null" "touch bar\n" "" ' | ||
126 | all: foo bar baz | ||
127 | foo: | ||
128 | bar: | ||
129 | @echo bar | ||
130 | baz: | ||
131 | @echo baz | ||
132 | ' | ||
133 | cd .. || exit 1; rm -rf make.tempdir 2>/dev/null | ||
134 | |||
135 | # Build commands with a '+' prefix are executed even with the -t option. | ||
136 | mkdir make.tempdir && cd make.tempdir || exit 1 | ||
137 | testing "make execute build command with + prefix and -t" \ | ||
138 | "make -t -f - 2>/dev/null" "OK\n" "" ' | ||
139 | all: bar | ||
140 | bar: | ||
141 | @+echo OK | ||
142 | ' | ||
143 | cd .. || exit 1; rm -rf make.tempdir 2>/dev/null | ||
144 | |||
119 | # A macro created using ::= remembers it's of type immediate-expansion. | 145 | # A macro created using ::= remembers it's of type immediate-expansion. |
120 | # Immediate expansion also occurs when += is used to append to such a macro. | 146 | # Immediate expansion also occurs when += is used to append to such a macro. |
121 | testing "make appending to immediate-expansion macro" \ | 147 | testing "make appending to immediate-expansion macro" \ |