py/mkrules.mk: Fix dependency file generation for compiler wrappers.

When compiling with distcc, it does not understand the -MD flag on its own.
This fixes the interaction by explicitly adding the -MF option.

The error in distcc is described here under "Problems with gcc -MD":
https://www.distcc.org/faq.html

Signed-off-by: Peter Züger <zueger.peter@icloud.com>
This commit is contained in:
Peter Züger 2023-12-21 00:23:50 +01:00 committed by Damien George
parent ce42c9ee16
commit d69e69adb6

View File

@ -63,7 +63,7 @@ $(BUILD)/%.o: %.s
define compile_c
$(ECHO) "CC $<"
$(Q)$(CC) $(CFLAGS) -c -MD -o $@ $< || (echo -e $(HELP_BUILD_ERROR); false)
$(Q)$(CC) $(CFLAGS) -c -MD -MF $(@:.o=.d) -o $@ $< || (echo -e $(HELP_BUILD_ERROR); false)
@# The following fixes the dependency file.
@# See http://make.paulandlesley.org/autodep.html for details.
@# Regex adjusted from the above to play better with Windows paths, etc.
@ -75,7 +75,7 @@ endef
define compile_cxx
$(ECHO) "CXX $<"
$(Q)$(CXX) $(CXXFLAGS) -c -MD -o $@ $< || (echo -e $(HELP_BUILD_ERROR); false)
$(Q)$(CXX) $(CXXFLAGS) -c -MD -MF $(@:.o=.d) -o $@ $< || (echo -e $(HELP_BUILD_ERROR); false)
@# The following fixes the dependency file.
@# See http://make.paulandlesley.org/autodep.html for details.
@# Regex adjusted from the above to play better with Windows paths, etc.