forked from luck/tmp_suning_uos_patched
kbuild: use -MMD instead of -MD to exclude system headers from dependency
This omits system headers from the generated header dependency. System headers are not updated unless you upgrade the compiler. Nor do they contain CONFIG options, so fixdep does not need to parse them. Having said that, the effect of this optimization will be quite small because the kernel code generally does not include system headers except <stdarg.h>. Host programs include a lot of system headers, but there are not so many in the kernel tree. At first, keeping system headers in .*.cmd files might be useful to detect the compiler update, but there is no guarantee that <stdarg.h> is included from every file. So, I implemented a more reliable way in the previous commit. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
This commit is contained in:
parent
8b59cd81dc
commit
30a7729771
|
@ -16,7 +16,7 @@ pound := \#
|
||||||
dot-target = $(dir $@).$(notdir $@)
|
dot-target = $(dir $@).$(notdir $@)
|
||||||
|
|
||||||
###
|
###
|
||||||
# The temporary file to save gcc -MD generated dependencies must not
|
# The temporary file to save gcc -MMD generated dependencies must not
|
||||||
# contain a comma
|
# contain a comma
|
||||||
depfile = $(subst $(comma),_,$(dot-target).d)
|
depfile = $(subst $(comma),_,$(dot-target).d)
|
||||||
|
|
||||||
|
|
|
@ -88,8 +88,8 @@ _hostcxx_flags += -I $(objtree)/$(obj)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
hostc_flags = -Wp,-MD,$(depfile) $(_hostc_flags)
|
hostc_flags = -Wp,-MMD,$(depfile) $(_hostc_flags)
|
||||||
hostcxx_flags = -Wp,-MD,$(depfile) $(_hostcxx_flags)
|
hostcxx_flags = -Wp,-MMD,$(depfile) $(_hostcxx_flags)
|
||||||
|
|
||||||
#####
|
#####
|
||||||
# Compile programs on the host
|
# Compile programs on the host
|
||||||
|
|
|
@ -171,22 +171,22 @@ modkern_aflags = $(if $(part-of-module), \
|
||||||
$(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE), \
|
$(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE), \
|
||||||
$(KBUILD_AFLAGS_KERNEL) $(AFLAGS_KERNEL))
|
$(KBUILD_AFLAGS_KERNEL) $(AFLAGS_KERNEL))
|
||||||
|
|
||||||
c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
|
c_flags = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
|
||||||
-include $(srctree)/include/linux/compiler_types.h \
|
-include $(srctree)/include/linux/compiler_types.h \
|
||||||
$(_c_flags) $(modkern_cflags) \
|
$(_c_flags) $(modkern_cflags) \
|
||||||
$(basename_flags) $(modname_flags)
|
$(basename_flags) $(modname_flags)
|
||||||
|
|
||||||
a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
|
a_flags = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
|
||||||
$(_a_flags) $(modkern_aflags)
|
$(_a_flags) $(modkern_aflags)
|
||||||
|
|
||||||
cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
|
cpp_flags = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
|
||||||
$(_cpp_flags)
|
$(_cpp_flags)
|
||||||
|
|
||||||
ld_flags = $(KBUILD_LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F))
|
ld_flags = $(KBUILD_LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F))
|
||||||
|
|
||||||
DTC_INCLUDE := $(srctree)/scripts/dtc/include-prefixes
|
DTC_INCLUDE := $(srctree)/scripts/dtc/include-prefixes
|
||||||
|
|
||||||
dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \
|
dtc_cpp_flags = -Wp,-MMD,$(depfile).pre.tmp -nostdinc \
|
||||||
$(addprefix -I,$(DTC_INCLUDE)) \
|
$(addprefix -I,$(DTC_INCLUDE)) \
|
||||||
-undef -D__DTS__
|
-undef -D__DTS__
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
# We cannot go as far as adding -Wpedantic since it emits too many warnings.
|
# We cannot go as far as adding -Wpedantic since it emits too many warnings.
|
||||||
UAPI_CFLAGS := -std=c90 -Wall -Werror=implicit-function-declaration
|
UAPI_CFLAGS := -std=c90 -Wall -Werror=implicit-function-declaration
|
||||||
|
|
||||||
override c_flags = $(UAPI_CFLAGS) -Wp,-MD,$(depfile) -I$(objtree)/usr/include
|
override c_flags = $(UAPI_CFLAGS) -Wp,-MMD,$(depfile) -I$(objtree)/usr/include
|
||||||
|
|
||||||
# The following are excluded for now because they fail to build.
|
# The following are excluded for now because they fail to build.
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue
Block a user