Skip to content

Commit c37acdb

Browse files
SendaoYanGoeLin
SendaoYan
authored andcommitted
8313374: --enable-ccache's CCACHE_BASEDIR breaks builds
Backport-of: 571c435e1a34dcf08fd7545d531c258c9116ea79
1 parent 7dc0f7a commit c37acdb

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

make/common/NativeCompilation.gmk

+14
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,21 @@ DEPENDENCY_TARGET_SED_PATTERN := \
215215
# The fix-deps-file macro is used to adjust the contents of the generated make
216216
# dependency files to contain paths compatible with make.
217217
#
218+
REWRITE_PATHS_RELATIVE = false
218219
ifeq ($(ALLOW_ABSOLUTE_PATHS_IN_OUTPUT)-$(FILE_MACRO_CFLAGS), false-)
220+
REWRITE_PATHS_RELATIVE = true
221+
endif
222+
223+
# CCACHE_BASEDIR needs fix-deps-file as makefiles use absolute filenames for
224+
# object files while CCACHE_BASEDIR will make ccache relativize all paths for
225+
# its compiler. The compiler then produces relative dependency files.
226+
# make does not know a relative and absolute filename is the same so it will
227+
# ignore such dependencies.
228+
ifneq ($(CCACHE), )
229+
REWRITE_PATHS_RELATIVE = true
230+
endif
231+
232+
ifeq ($(REWRITE_PATHS_RELATIVE), true)
219233
# Need to handle -I flags as both '-Ifoo' and '-I foo'.
220234
MakeCommandRelative = \
221235
$(CD) $(WORKSPACE_ROOT) && \

0 commit comments

Comments
 (0)