OSDN Git Service

Bump Security String to 2019-10-05
[android-x86/build.git] / core / ccache.mk
1 #
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
17 ifneq ($(filter-out false,$(USE_CCACHE)),)
18   # The default check uses size and modification time, causing false misses
19   # since the mtime depends when the repo was checked out
20   export CCACHE_COMPILERCHECK := content
21
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   ifeq ($(CCACHE_BASEDIR),)
34     export CCACHE_BASEDIR := $(ANDROID_BUILD_TOP)
35   endif
36
37   # Workaround for ccache with clang.
38   # See http://petereisentraut.blogspot.com/2011/09/ccache-and-clang-part-2.html
39   export CCACHE_CPP2 := true
40
41   # Detect if the system already has ccache installed to use instead of the prebuilt
42   ccache := $(shell which ccache)
43
44   ifeq ($(ccache),)
45     CCACHE_HOST_TAG := $(HOST_PREBUILT_TAG)
46     ccache := prebuilts/misc/$(CCACHE_HOST_TAG)/ccache/ccache
47   endif
48
49   # Check that the executable is here.
50   ccache := $(strip $(wildcard $(ccache)))
51   ifdef ccache
52     ifndef CC_WRAPPER
53       CC_WRAPPER := $(ccache)
54     endif
55     ifndef CXX_WRAPPER
56       CXX_WRAPPER := $(ccache)
57     endif
58     ccache =
59   endif
60 endif