2014-10-28 18:01:55 +00:00
|
|
|
# $FreeBSD$
|
2017-03-09 22:35:29 +00:00
|
|
|
#-*- tab-width: 4; -*-
|
|
|
|
# ex:ts=4
|
2017-03-09 23:20:46 +00:00
|
|
|
#
|
|
|
|
# WITH_CCACHE_BUILD=yes enables depending on ccache and using it in the build.
|
|
|
|
# NO_CCACHE_DEPEND will additionally not add the dependency on ccache.
|
|
|
|
# NO_CCACHE will disable this entirely.
|
2014-10-28 18:01:55 +00:00
|
|
|
|
|
|
|
COMMANDS_Include_MAINTAINER= portmgr@FreeBSD.org
|
|
|
|
|
|
|
|
.if !defined(_CCACHEMKINCLUDED)
|
|
|
|
|
|
|
|
_CCACHEMKINCLUDED= yes
|
|
|
|
|
2019-10-10 20:09:59 +00:00
|
|
|
.if defined(NOCCACHE)
|
|
|
|
NO_CCACHE= t
|
|
|
|
.endif
|
|
|
|
|
2015-03-22 19:41:44 +00:00
|
|
|
# HOME is always set to ${WRKDIR} now. Try to use /root/.ccache as default.
|
|
|
|
.if defined(WITH_CCACHE_BUILD) && !defined(CCACHE_DIR)
|
2014-10-28 18:01:55 +00:00
|
|
|
. if defined(USER) && ${USER} == root
|
|
|
|
CCACHE_DIR= /root/.ccache
|
|
|
|
. else
|
|
|
|
NO_CCACHE= yes
|
|
|
|
WARNING+= WITH_CCACHE_BUILD support disabled, please set CCACHE_DIR.
|
|
|
|
. endif
|
|
|
|
.endif
|
|
|
|
|
|
|
|
# Support NO_CCACHE for common setups, require WITH_CCACHE_BUILD, and
|
|
|
|
# don't use if ccache already set in CC
|
|
|
|
.if !defined(NO_CCACHE) && defined(WITH_CCACHE_BUILD) && !${CC:M*ccache*} && \
|
2019-10-10 20:09:59 +00:00
|
|
|
!defined(NO_BUILD)
|
2017-03-09 23:20:46 +00:00
|
|
|
|
2015-04-14 20:58:26 +00:00
|
|
|
# Avoid depends loops between ccache and pkg
|
2017-03-09 23:20:46 +00:00
|
|
|
. if !defined(NO_CCACHE_DEPEND) && \
|
|
|
|
${PKGORIGIN} != ${PKG_ORIGIN}
|
2016-03-27 01:23:25 +00:00
|
|
|
BUILD_DEPENDS+= ${LOCALBASE}/bin/ccache:devel/ccache
|
2014-10-28 18:01:55 +00:00
|
|
|
. endif
|
|
|
|
|
2017-03-10 02:20:51 +00:00
|
|
|
CCACHE_WRAPPER_PATH?= ${LOCALBASE}/libexec/ccache
|
2019-10-10 20:06:24 +00:00
|
|
|
CCACHE_BIN?= ${CCACHE_WRAPPER_PATH:C,/libexec/ccache$,,}/bin/ccache
|
2014-10-28 18:01:55 +00:00
|
|
|
|
2017-03-10 02:20:51 +00:00
|
|
|
.if exists(${CCACHE_WRAPPER_PATH})
|
2014-10-28 18:01:55 +00:00
|
|
|
# Prepend the ccache dir into the PATH and setup ccache env
|
2017-03-10 02:20:51 +00:00
|
|
|
PATH:= ${CCACHE_WRAPPER_PATH}:${PATH}
|
2014-10-28 18:01:55 +00:00
|
|
|
#.MAKEFLAGS: PATH=${PATH}
|
|
|
|
.if !${MAKE_ENV:MPATH=*} && !${CONFIGURE_ENV:MPATH=*}
|
|
|
|
MAKE_ENV+= PATH=${PATH}
|
|
|
|
CONFIGURE_ENV+= PATH=${PATH}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
# Ensure this is always in subchild environments
|
|
|
|
. if defined(CCACHE_DIR)
|
|
|
|
#.MAKEFLAGS: CCACHE_DIR=${CCACHE_DIR}
|
|
|
|
MAKE_ENV+= CCACHE_DIR="${CCACHE_DIR}"
|
|
|
|
CONFIGURE_ENV+= CCACHE_DIR="${CCACHE_DIR}"
|
|
|
|
. endif
|
|
|
|
.endif
|
2018-02-25 03:32:18 +00:00
|
|
|
|
|
|
|
# Some ports will truncate CCACHE_DIR from the env and due to HOME=${WRKDIR}
|
|
|
|
# will incorrectly use ${WRKDIR}/.ccache. Symlink to the proper place.
|
|
|
|
${WRKDIR}/.ccache: ${WRKDIR}
|
|
|
|
@${LN} -sf ${CCACHE_DIR} ${WRKDIR}/.ccache
|
|
|
|
ccache-wrkdir-link: ${WRKDIR}/.ccache .PHONY
|
|
|
|
post-extract: ccache-wrkdir-link
|
2017-03-09 23:20:46 +00:00
|
|
|
.endif
|
2014-10-28 18:01:55 +00:00
|
|
|
|
|
|
|
.endif
|