diff options
author | Andrew Morton <akpm@osdl.org> | 2004-02-03 18:32:08 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@home.osdl.org> | 2004-02-03 18:32:08 -0800 |
commit | 9f61b232e5a1fdd6340f9e27a66a986d13fed6ad (patch) | |
tree | 2251987d669c6eba65d45e0ae9eb443e459e33fe /scripts | |
parent | 4959674753873b6dc7bb2c045a4fb62590cdc7b5 (diff) | |
download | history-9f61b232e5a1fdd6340f9e27a66a986d13fed6ad.tar.gz |
[PATCH] kbuild: Unmangle include options for gcc
From: Sam Ravnborg <sam@ravnborg.org>
When utilising the make O=... option the include options for gcc were
mangled even when absolute paths was used. Also remove duplication of
CPPFLAGS. They were assigned twice. [It is still possible for
architectures to modify CPPFLAGS].
This patch allows xconfig to be build with make O=... xconfig.It will also
help development of external modules with absolute paths for their -I
options.
Note: As a side effect a full recompile of the kernel takes place due to
changes in number of gcc options.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Makefile.lib | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index badd18666b4ac..51831e5381f6b 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -144,8 +144,7 @@ _hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) $(HOSTCXXFLAGS_$(*F).o) # If building the kernel in a separate objtree expand all occurrences -# of -Idir to -Idir -I$(srctree)/dir. -# hereby allowing gcc to locate files in both trees. Local tree first. +# of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/'). ifeq ($(KBUILD_SRC),) __c_flags = $(_c_flags) @@ -153,16 +152,20 @@ __a_flags = $(_a_flags) __hostc_flags = $(_hostc_flags) __hostcxx_flags = $(_hostcxx_flags) else -flags = $(foreach o,$($(1)),\ - $(if $(filter -I%,$(o)),$(patsubst -I%,-I$(srctree)/%,$(o)),$(o))) - -# -I$(obj) locate generated .h files -# -I$(srctree)/$(src) locate .h files in srctree, from generated .c files -# FIXME: Replace both with specific EXTRA_CFLAGS statements -__c_flags = -I$(obj) -I$(srctree)/$(src) $(call flags,_c_flags) -__a_flags = $(call flags,_a_flags) -__hostc_flags = -I$(obj) $(call flags,_hostc_flags) -__hostcxx_flags = $(call flags,_hostcxx_flags) + +# Prefix -I with $(srctree) if it is not an absolute path +addtree = $(if $(filter-out -I/%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1))) $(1) +# Find all -I options and call addtree +flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o))) + +# -I$(obj) locates generated .h files +# $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files +# and locates generated .h files +# FIXME: Replace both with specific CFLAGS* statements in the makefiles +__c_flags = $(call addtree,-I$(obj)) $(call flags,_c_flags) +__a_flags = $(call flags,_a_flags) +__hostc_flags = -I$(obj) $(call flags,_hostc_flags) +__hostcxx_flags = -I$(obj) $(call flags,_hostcxx_flags) endif c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \ |