Skip to content

Commit d9df92e

Browse files
author
Sam Ravnborg
committed
kbuild: properly pass options to hostcc when doing make O=..
This fix a longstanding bug where proper options was not passed to hostcc in case of a make O=.. build. This bug showed up in (not yet merged) klibc, and is not known to have any counterpart in-kernel. Fixed by moving the flags macro to Kbuild.include so it can be used by both Makefile.lib and Makefile.host. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
1 parent 7d2d8fe commit d9df92e

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎scripts/Kbuild.include‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ cc-ifversion = $(shell if [ $(call cc-version, $(CC)) $(1) $(2) ]; then \
8787
# $(Q)$(MAKE) $(build)=dir
8888
build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
8989

90+
# Prefix -I with $(srctree) if it is not an absolute path
91+
addtree = $(if $(filter-out -I/%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1))) $(1)
92+
# Find all -I options and call addtree
93+
flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o)))
94+
9095
# If quiet is set, only print short version of command
9196
cmd = @$(echo-cmd) $(cmd_$(1))
9297

‎scripts/Makefile.lib‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,6 @@ __a_flags = $(_a_flags)
9999
__cpp_flags = $(_cpp_flags)
100100
else
101101

102-
# Prefix -I with $(srctree) if it is not an absolute path
103-
addtree = $(if $(filter-out -I/%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1))) $(1)
104-
# Find all -I options and call addtree
105-
flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o)))
106-
107102
# -I$(obj) locates generated .h files
108103
# $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files
109104
# and locates generated .h files

0 commit comments

Comments
 (0)