diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2019-05-13 02:22:17 -0400 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2019-05-17 22:49:57 -0400 |
commit | cdd750bfb1f76fe9be8cfb53cbe77b2e811081ab (patch) | |
tree | aef9cb28da3409096df0239e3e315c4787fd5787 /scripts/Makefile.lib | |
parent | 9cc342f6c4a06ea613ddef1bcaa25409260aec63 (diff) |
kbuild: remove 'addtree' and 'flags' magic for header search paths
The 'addtree' and 'flags' in scripts/Kbuild.include are so compilecated
and ugly.
As I mentioned in [1], Kbuild should stop automatic prefixing of header
search path options.
I fixed up (almost) all Makefiles in the kernel. Now 'addtree' and
'flags' have been removed.
Kbuild still caters to add $(srctree)/$(src) and $(objtree)/$(obj)
to the header search path for O= building, but never touches extra
compiler options from ccflags-y etc.
[1]: https://patchwork.kernel.org/patch/9632347/
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts/Makefile.lib')
-rw-r--r-- | scripts/Makefile.lib | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 41e98fa66b91..1b412d4394ae 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
@@ -137,36 +137,26 @@ _c_flags += $(if $(patsubst n%,, \ | |||
137 | $(CFLAGS_KCOV)) | 137 | $(CFLAGS_KCOV)) |
138 | endif | 138 | endif |
139 | 139 | ||
140 | __c_flags = $(_c_flags) | 140 | # $(srctree)/$(src) for including checkin headers from generated source files |
141 | __a_flags = $(_a_flags) | 141 | # $(objtree)/$(obj) for including generated headers from checkin source files |
142 | __cpp_flags = $(_cpp_flags) | ||
143 | |||
144 | # If building the kernel in a separate objtree expand all occurrences | ||
145 | # of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/'). | ||
146 | ifeq ($(KBUILD_EXTMOD),) | 142 | ifeq ($(KBUILD_EXTMOD),) |
147 | ifneq ($(srctree),.) | 143 | ifneq ($(srctree),.) |
148 | 144 | _c_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj) | |
149 | # -I$(obj) locates generated .h files | 145 | _a_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj) |
150 | # $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files | 146 | _cpp_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj) |
151 | # and locates generated .h files | ||
152 | # FIXME: Replace both with specific CFLAGS* statements in the makefiles | ||
153 | __c_flags = $(if $(obj),$(call addtree,-I$(src)) -I$(obj)) \ | ||
154 | $(call flags,_c_flags) | ||
155 | __a_flags = $(call flags,_a_flags) | ||
156 | __cpp_flags = $(call flags,_cpp_flags) | ||
157 | endif | 147 | endif |
158 | endif | 148 | endif |
159 | 149 | ||
160 | c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ | 150 | c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ |
161 | -include $(srctree)/include/linux/compiler_types.h \ | 151 | -include $(srctree)/include/linux/compiler_types.h \ |
162 | $(__c_flags) $(modkern_cflags) \ | 152 | $(_c_flags) $(modkern_cflags) \ |
163 | $(basename_flags) $(modname_flags) | 153 | $(basename_flags) $(modname_flags) |
164 | 154 | ||
165 | a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ | 155 | a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ |
166 | $(__a_flags) $(modkern_aflags) | 156 | $(_a_flags) $(modkern_aflags) |
167 | 157 | ||
168 | cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ | 158 | cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ |
169 | $(__cpp_flags) | 159 | $(_cpp_flags) |
170 | 160 | ||
171 | ld_flags = $(KBUILD_LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F)) | 161 | ld_flags = $(KBUILD_LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F)) |
172 | 162 | ||