git: c63166a2aff4 - stable/14 - bsd.prog.mk: Skip warnings if compiler.mk was not included

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Mon, 03 Nov 2025 22:00:46 UTC
The branch stable/14 has been updated by emaste:

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

commit c63166a2aff488314be4c2a75493ed30597a91d4
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2025-10-31 15:53:42 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2025-11-03 20:42:50 +0000

    bsd.prog.mk: Skip warnings if compiler.mk was not included
    
    We emit a warning if src.conf options WITH_RETPOLINE or INIT_ALL are
    in use, and the compiler or linker does not support the feature.
    
    For targets like `cleandir` we skip including bsd.compiler.mk, which
    leaves COMPILER_FEATURES unset and spurious warnings were emitted in
    early buildworld stages, if these options are in use.
    
    Commit 0837b2ebd570 ("pkg: Die if make -V BRANCH fails") added -W to
    usr.sbin/pkg's make flags, causing it to exit on warnings.  As a result
    buildworld failed when these src.conf options were in use.
    
    Clean this up by omitting the warning if the magic
    _NO_INCLUDE_COMPILERMK flag is set, which indicates that
    COMPILER_FEATURES is not set.
    
    Reviewed by:    imp
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D53501
    
    (cherry picked from commit e4f2a350955406ffd58dd3f0bb7610df0f36d647)
    (cherry picked from commit 1471af5110fc3bb6b1f1548e056f1717fb844ffd)
---
 share/mk/bsd.prog.mk | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk
index fa15370a82c6..1c32a442aac9 100644
--- a/share/mk/bsd.prog.mk
+++ b/share/mk/bsd.prog.mk
@@ -49,9 +49,11 @@ CXXFLAGS+= -mretpoline
 LDFLAGS+= -Wl,-zretpolineplt
 .endif
 .else
+.if !defined(_NO_INCLUDE_COMPILERMK)
 .warning Retpoline requested but not supported by compiler or linker
 .endif
 .endif
+.endif
 # LLD sensibly defaults to -znoexecstack, so do the same for BFD
 LDFLAGS.bfd+= -Wl,-znoexecstack
 
@@ -65,16 +67,20 @@ CFLAGS+= -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clan
 CXXFLAGS+= -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
 .endif
 .else
+.if !defined(_NO_INCLUDE_COMPILERMK)
 .warning InitAll (zeros) requested but not supported by compiler
 .endif
+.endif
 .elif ${MK_INIT_ALL_PATTERN} == "yes"
 .if ${COMPILER_FEATURES:Minit-all}
 CFLAGS+= -ftrivial-auto-var-init=pattern
 CXXFLAGS+= -ftrivial-auto-var-init=pattern
 .else
+.if !defined(_NO_INCLUDE_COMPILERMK)
 .warning InitAll (pattern) requested but not supported by compiler
 .endif
 .endif
+.endif
 
 # bsd.sanitizer.mk is not installed, so don't require it (e.g. for ports).
 .sinclude "bsd.sanitizer.mk"