git: 679b9e2f4367 - main - Mk/bsd.ccache.mk: Add CCACHE_ENABLED variable for ports' convenience

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Mon, 12 Sep 2022 07:47:56 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=679b9e2f43675a36fa552404c770ab620a350fa1

commit 679b9e2f43675a36fa552404c770ab620a350fa1
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-09-12 07:41:44 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-09-12 07:47:54 +0000

    Mk/bsd.ccache.mk: Add CCACHE_ENABLED variable for ports' convenience
    
    Some projects do some special handling when the ccache program is present.
    This causes problems because ports framework has its own ccache settings
    and mere presence of ccache program doesn't mean that ccache is enabled.
    The new CCACHE_ENABLED variable can be used to tell projects if ccache
    is really enabled.
    
    PR:             266310
    Approved by:    tcberner@ (as portmgr)
---
 Mk/bsd.ccache.mk | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Mk/bsd.ccache.mk b/Mk/bsd.ccache.mk
index 036d83720f5b..83f225748420 100644
--- a/Mk/bsd.ccache.mk
+++ b/Mk/bsd.ccache.mk
@@ -11,6 +11,7 @@
 #                       default.
 #
 # Port use (users should not modify these):
+#  - CCACHE_ENABLED - tells the port if ccache is enabled.
 #  - CCACHE_BIN - path to the ccache binary.  Intended to be prefixed before CC.
 #  - CCACHE_WRAPPER_PATH - path to directory containing compiler symlinks back
 #                          to ccache.  For example, gcc5 -> ccache.  Intended
@@ -42,11 +43,18 @@ _CCACHEMKINCLUDED=	yes
 NO_CCACHE=	t
 .  endif
 
+.  if defined(WITH_CCACHE_BUILD)
+CCACHE_ENABLED= yes
+.  else
+CCACHE_ENABLED= no
+.  endif
+
 # HOME is always set to ${WRKDIR} now. Try to use /root/.ccache as default.
 .  if defined(WITH_CCACHE_BUILD) && !defined(CCACHE_DIR)
 .    if defined(USER) && ${USER} == root
 CCACHE_DIR=	/root/.ccache
 .    else
+CCACHE_ENABLED=	no
 NO_CCACHE=	yes
 WARNING+=	WITH_CCACHE_BUILD support disabled, please set CCACHE_DIR.
 .    endif