build: add -MP to CFLAGS along with -MMD
authorDavid Woodhouse <dwmw@amazon.co.uk>
Tue, 24 Mar 2020 09:43:51 +0000 (10:43 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 24 Mar 2020 09:43:51 +0000 (10:43 +0100)
This causes gcc (yes, and clang) to emit phony targets for each dependency.

This means that when a header file is deleted, the C files which *used*
to include it will no longer stop building with bogus out-of-date
dependencies like this:

  make[5]: *** No rule to make target
  '/home/dwmw2/git/xen/xen/include/asm/hvm/svm/amd-iommu-proto.h',
  needed by 'p2m.o'. Stop.

Based on -MP post-dating -MP by many years it is assumed that the
behavior of -MP isn't the defualt just out of extreme caution. We're
sufficiently convinced that there are no undue side effects of this.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/Rules.mk
xen/Rules.mk

index 52f47be3f8462dbb3949cbfedd9016cf7d036df0..9bac15c8d1b1df372d5e4bcf76d5d93f75481aa4 100644 (file)
@@ -186,7 +186,7 @@ SHLIB_libxlutil  = $(SHDEPS_libxlutil) -Wl,-rpath-link=$(XEN_XLUTIL)
 CFLAGS += -D__XEN_INTERFACE_VERSION__=__XEN_LATEST_INTERFACE_VERSION__
 
 # Get gcc to generate the dependencies for us.
-CFLAGS += -MMD -MF .$(if $(filter-out .,$(@D)),$(subst /,@,$(@D))@)$(@F).d
+CFLAGS += -MMD -MP -MF .$(if $(filter-out .,$(@D)),$(subst /,@,$(@D))@)$(@F).d
 DEPS = .*.d
 
 ifneq ($(FILE_OFFSET_BITS),)
index 92a13ca601636b05fe42f92d3c83d02974883e8e..9079df7978a77b0fb28ee691e42ca740f3b4245b 100644 (file)
@@ -71,7 +71,7 @@ AFLAGS += -D__ASSEMBLY__
 ALL_OBJS := $(ALL_OBJS-y)
 
 # Get gcc to generate the dependencies for us.
-CFLAGS-y += -MMD -MF $(@D)/.$(@F).d
+CFLAGS-y += -MMD -MP -MF $(@D)/.$(@F).d
 
 CFLAGS += $(CFLAGS-y)
 # allow extra CFLAGS externally via EXTRA_CFLAGS_XEN_CORE