git: fdc4db57224c - main - usr.bin/Makefile: always build ELF Tool Chain strings(1)

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Thu, 20 Mar 2025 17:59:41 UTC
The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=fdc4db57224ce19b867c60fce4c410068be40c27

commit fdc4db57224ce19b867c60fce4c410068be40c27
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2025-03-20 17:47:29 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2025-03-20 17:59:32 +0000

    usr.bin/Makefile: always build ELF Tool Chain strings(1)
    
    strings(1) is not conditional on WITH_/WITHOUT_TOOLCHAIN, as it is a
    small utility that is also useful outside of the toolchain context.
    As of commit 1cae7121c667 we switched to WITH_LLVM_BINUTILS by default.
    
    After this change building world with default options but installing
    WITHOUT_TOOLCHAIN failed, because we would build LLVM's strings but
    attempt to install ELF Tool Chain's version, which did not exist.
    Address this by always including ELF Tool Chain strings in non-install
    make targets, so that it will be available if options are changed at
    install time.
    
    PR:             285556
    Reported by:    Michael Butler
    Reviewed by:    brooks
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D49425
---
 usr.bin/Makefile | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/usr.bin/Makefile b/usr.bin/Makefile
index bca7896e5a17..15fcdeb479f7 100644
--- a/usr.bin/Makefile
+++ b/usr.bin/Makefile
@@ -250,6 +250,12 @@ SUBDIR.${MK_TOOLCHAIN}+=	nm
 SUBDIR.${MK_TOOLCHAIN}+=	objcopy
 SUBDIR.${MK_TOOLCHAIN}+=	readelf
 SUBDIR.${MK_TOOLCHAIN}+=	size
+.endif
+# Include elftoolchain's strings in build targets even if using LLVM_BINUTILS,
+# as we may later install with different options.  In particular, the release
+# artifact builds use default options for buildworld but install with
+# MK_TOOLCHAIN=no which implies MK_LLVM_BINUTILS=no.
+.if ${MK_LLVM_BINUTILS} == "no" || !make(install)
 SUBDIR+=			strings
 .endif
 SUBDIR.${MK_TOOLCHAIN}+=	c89