Mk/bsd.sanity.mk: Reduce parsing during package builds

This disables bsd.sanity.mk when PACKAGE_BUILDING is set such that it
only is loaded during 'make [all]' or 'make check-sanity'.  It is assumed the
package tool will manually call the target if it wants the check.  Otherwise
we get redundant logic and filesystem lookups from this file for every other
build target.

Prodded by:	mjg
This commit is contained in:
Bryan Drewery 2022-12-21 08:12:45 -08:00
parent efbf64ff8c
commit 4ca11c4efc
2 changed files with 6 additions and 0 deletions

View File

@ -1961,7 +1961,10 @@ ERROR+= "Unknown USES=${f:C/\:.*//}"
. endfor
. if defined(PORTNAME)
. if !defined(PACKAGE_BUILDING) || empty(.TARGETS) || make(all) || \
make(check-sanity) || make(show*-errors) || make(show*-warnings)
.include "${PORTSDIR}/Mk/bsd.sanity.mk"
. endif
. endif
. if defined(USE_LOCALE)

View File

@ -55,6 +55,7 @@ ERROR+= "${a} is unsupported, please use ${${a}_ALT}"
# Warnings only when DEVELOPER=yes
.if defined(DEVELOPER)
.if exists(${.CURDIR}/../../Mk/bsd.port.mk) || ${OVERLAYS:tA:M${.CURDIR:H:H}} == ${.CURDIR:H:H}
. if ${.CURDIR:H:T} != ${PKGCATEGORY}
@ -311,3 +312,5 @@ DEV_WARNING+= "${a} is not needed: ${${a}_REASON}"
DEV_ERROR+= "${a} is unsupported, please use ${${a}_ALT}"
. endif
.endfor
.endif # defined(DEVELOPER)