diff options
Diffstat (limited to 'meta/classes/ccache.bbclass')
-rw-r--r-- | meta/classes/ccache.bbclass | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/meta/classes/ccache.bbclass b/meta/classes/ccache.bbclass index 960902065c..59e1022678 100644 --- a/meta/classes/ccache.bbclass +++ b/meta/classes/ccache.bbclass @@ -1,4 +1,14 @@ -CCACHE = "${@bb.utils.which(d.getVar('PATH'), 'ccache') and 'ccache '}" +# +# Usage: +# - Enable ccache +# Add the following line to a conffile such as conf/local.conf: +# INHERIT += "ccache" +# +# - Disable ccache for a recipe +# Add the following line to the recipe if it can't be built with ccache: +# CCACHE_DISABLE = '1' +# + export CCACHE_DIR ?= "${TMPDIR}/ccache/${MULTIMACH_TARGET_SYS}/${PN}" # We need to stop ccache considering the current directory or the @@ -7,5 +17,14 @@ export CCACHE_DIR ?= "${TMPDIR}/ccache/${MULTIMACH_TARGET_SYS}/${PN}" # ${PV} or ${PR} change. export CCACHE_NOHASHDIR ?= "1" -DEPENDS_append_class-target = " ccache-native" -DEPENDS[vardepvalueexclude] = " ccache-native" +python() { + """ + Enable ccache for the recipe + """ + pn = d.getVar('PN') + # quilt-native doesn't need ccache since no c files + if not (pn in ('ccache-native', 'quilt-native') or + bb.utils.to_boolean(d.getVar('CCACHE_DISABLE'))): + d.appendVar('DEPENDS', ' ccache-native') + d.setVar('CCACHE', 'ccache ') +} |