From 571c435e1a34dcf08fd7545d531c258c9116ea79 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Wed, 23 Aug 2023 06:26:18 +0000 Subject: [PATCH] 8313374: --enable-ccache's CCACHE_BASEDIR breaks builds Reviewed-by: erikj --- make/common/NativeCompilation.gmk | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk index 8609fc4ca00d1..e97d8767ce238 100644 --- a/make/common/NativeCompilation.gmk +++ b/make/common/NativeCompilation.gmk @@ -215,7 +215,21 @@ DEPENDENCY_TARGET_SED_PATTERN := \ # The fix-deps-file macro is used to adjust the contents of the generated make # dependency files to contain paths compatible with make. # +REWRITE_PATHS_RELATIVE = false ifeq ($(ALLOW_ABSOLUTE_PATHS_IN_OUTPUT)-$(FILE_MACRO_CFLAGS), false-) + REWRITE_PATHS_RELATIVE = true +endif + +# CCACHE_BASEDIR needs fix-deps-file as makefiles use absolute filenames for +# object files while CCACHE_BASEDIR will make ccache relativize all paths for +# its compiler. The compiler then produces relative dependency files. +# make does not know a relative and absolute filename is the same so it will +# ignore such dependencies. +ifneq ($(CCACHE), ) + REWRITE_PATHS_RELATIVE = true +endif + +ifeq ($(REWRITE_PATHS_RELATIVE), true) # Need to handle -I flags as both '-Ifoo' and '-I foo'. MakeCommandRelative = \ $(CD) $(WORKSPACE_ROOT) && \