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# We no longer provide a ccache prebuilt.
18#
19# Ours was old, and had a number of issues that triggered non-reproducible
20# results and other failures. Newer ccache versions may fix some of those
21# issues, but at the large scale of our build servers, we weren't seeing
22# significant performance gains from using ccache -- you end up needing very
23# good locality and/or very large caches if you're building many different
24# configurations.
25#
26# Local no-change full rebuilds were showing better results, but why not just
27# use incremental builds at that point?
28#
29# So if you still want to use ccache, continue setting USE_CCACHE, but also set
30# the CCACHE_EXEC environment variable to the path to your ccache executable.
31ifneq ($(CCACHE_EXEC),)
32ifneq ($(filter-out false,$(USE_CCACHE)),)
33  # The default check uses size and modification time, causing false misses
34  # since the mtime depends when the repo was checked out
35  CCACHE_COMPILERCHECK ?= content
36
37  # See man page, optimizations to get more cache hits
38  # implies that __DATE__ and __TIME__ are not critical for functionality.
39  # Ignore include file modification time since it will depend on when
40  # the repo was checked out
41  CCACHE_SLOPPINESS := time_macros,include_file_mtime,file_macro
42
43  # Turn all preprocessor absolute paths into relative paths.
44  # Fixes absolute paths in preprocessed source due to use of -g.
45  # We don't really use system headers much so the rootdir is
46  # fine; ensures these paths are relative for all Android trees
47  # on a workstation.
48  CCACHE_BASEDIR := /
49
50  # Workaround for ccache with clang.
51  # See http://petereisentraut.blogspot.com/2011/09/ccache-and-clang-part-2.html
52  CCACHE_CPP2 := true
53
54  ifndef CC_WRAPPER
55    CC_WRAPPER := $(CCACHE_EXEC)
56  endif
57  ifndef CXX_WRAPPER
58    CXX_WRAPPER := $(CCACHE_EXEC)
59  endif
60endif
61endif
62