blob: d67bce6c7bbc76034319a1793985119f17ff7203 [file] [log] [blame]
Ying Wang57d90602015-07-20 18:40:18 -07001#
2# Copyright (C) 2015 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
Shinichiro Hamajid78cba12015-12-18 15:26:17 +090017ifneq ($(filter-out false,$(USE_CCACHE)),)
Ying Wang57d90602015-07-20 18:40:18 -070018 # The default check uses size and modification time, causing false misses
19 # since the mtime depends when the repo was checked out
Stefan Stanacar25da3a32016-03-15 15:12:34 +020020 export CCACHE_COMPILERCHECK ?= content
Ying Wang57d90602015-07-20 18:40:18 -070021
22 # See man page, optimizations to get more cache hits
23 # implies that __DATE__ and __TIME__ are not critical for functionality.
24 # Ignore include file modification time since it will depend on when
25 # the repo was checked out
26 export CCACHE_SLOPPINESS := time_macros,include_file_mtime,file_macro
27
28 # Turn all preprocessor absolute paths into relative paths.
29 # Fixes absolute paths in preprocessed source due to use of -g.
30 # We don't really use system headers much so the rootdir is
31 # fine; ensures these paths are relative for all Android trees
32 # on a workstation.
33 export CCACHE_BASEDIR := /
34
35 # Workaround for ccache with clang.
36 # See http://petereisentraut.blogspot.com/2011/09/ccache-and-clang-part-2.html
37 export CCACHE_CPP2 := true
38
39 CCACHE_HOST_TAG := $(HOST_PREBUILT_TAG)
Ying Wang57d90602015-07-20 18:40:18 -070040 ccache := prebuilts/misc/$(CCACHE_HOST_TAG)/ccache/ccache
41 # Check that the executable is here.
42 ccache := $(strip $(wildcard $(ccache)))
43 ifdef ccache
44 ifndef CC_WRAPPER
45 CC_WRAPPER := $(ccache)
46 endif
47 ifndef CXX_WRAPPER
48 CXX_WRAPPER := $(ccache)
49 endif
50 ccache =
51 endif
52endif