Home | History | Annotate | Download | only in core
      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 ($(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   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)
     40   # If we are cross-compiling Windows binaries on Linux
     41   # then use the linux ccache binary instead.
     42   ifeq ($(HOST_OS)-$(BUILD_OS),windows-linux)
     43     CCACHE_HOST_TAG := linux-$(HOST_PREBUILT_ARCH)
     44   endif
     45   ccache := prebuilts/misc/$(CCACHE_HOST_TAG)/ccache/ccache
     46   # Check that the executable is here.
     47   ccache := $(strip $(wildcard $(ccache)))
     48   ifdef ccache
     49     ifndef CC_WRAPPER
     50       CC_WRAPPER := $(ccache)
     51     endif
     52     ifndef CXX_WRAPPER
     53       CXX_WRAPPER := $(ccache)
     54     endif
     55     ccache =
     56   endif
     57 endif
     58