diff options
author | Ron Yorston <rmy@pobox.com> | 2024-05-22 12:44:01 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2024-05-22 12:44:01 +0100 |
commit | c6b525f2afde0833d21b3f0132961a3b0178bbbb (patch) | |
tree | 34826922d0d52a0420f29059a4a9f014e6b48f79 /testsuite/make.tests | |
parent | eaa8695b76849d8156826a8919a591555c81a3dd (diff) | |
download | busybox-w32-c6b525f2afde0833d21b3f0132961a3b0178bbbb.tar.gz busybox-w32-c6b525f2afde0833d21b3f0132961a3b0178bbbb.tar.bz2 busybox-w32-c6b525f2afde0833d21b3f0132961a3b0178bbbb.zip |
make: set $< and $* for target rules
POSIX only requires $< and $* to be set for inference rules, not
target rules.
As an extension allow them to be set for target rules, as in
GNU make. This may or may not be useful.
In POSIX mode, when $< and $* are only set for inference rules,
they're set to an empty string for target rules. This avoids
the possibility of stale values being used.
Adds 64-80 bytes.
(GitHub issue #407)
Diffstat (limited to '')
-rwxr-xr-x | testsuite/make.tests | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/testsuite/make.tests b/testsuite/make.tests index fdbb4ccfc..5119a77d3 100755 --- a/testsuite/make.tests +++ b/testsuite/make.tests | |||
@@ -540,6 +540,19 @@ bar: | |||
540 | @echo $(BAR) | 540 | @echo $(BAR) |
541 | ' | 541 | ' |
542 | 542 | ||
543 | # $* and $< are supported for target rules | ||
544 | mkdir make.tempdir && cd make.tempdir || exit 1 | ||
545 | touch src.c src.h | ||
546 | testing 'make support $* and $< for target rules' \ | ||
547 | "make -f -" "src.c src.h\nsrc.o\nsrc\nsrc.c\n" "" ' | ||
548 | src.o: src.c src.h | ||
549 | @echo "$?" | ||
550 | @echo "$@" | ||
551 | @echo "$*" | ||
552 | @echo "$<" | ||
553 | ' | ||
554 | cd .. || exit 1; rm -rf make.tempdir 2>/dev/null | ||
555 | |||
543 | # An empty original suffix indicates that every word should have | 556 | # An empty original suffix indicates that every word should have |
544 | # the new suffix added. If neither suffix is provided the words | 557 | # the new suffix added. If neither suffix is provided the words |
545 | # remain unchanged. | 558 | # remain unchanged. |