From: Masahiro Yamada <masahiroy@kernel.org>
To: linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
Masahiro Yamada <masahiroy@kernel.org>,
kernel test robot <lkp@intel.com>
Subject: [PATCH v2 2/4] kbuild: do not add $(srctree) or $(objtree) to header search paths
Date: Sat, 27 Apr 2024 23:55:00 +0900 [thread overview]
Message-ID: <20240427145502.2804311-3-masahiroy@kernel.org> (raw)
In-Reply-To: <20240427145502.2804311-1-masahiroy@kernel.org>
scripts/Makefile.lib is included not only from scripts/Makefile.build
but also from scripts/Makefile.{vmlinux,modfinal} for building generated
C files.
In scripts/Makefile.{vmlinux,modfinal}, $(obj) and $(src) are empty.
Therefore, the header include paths:
-I $(srctree)/$(src) -I $(objtree)/$(obj)
... become meaningless code:
-I $(srctree)/ -I $(objtree)/
Add these paths only when 'obj' and 'src' are defined.
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/oe-kbuild-all/202404170634.BlqTaYA0-lkp@intel.com/
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
Changes in v2:
- New patch to address the build error reported by 0day bot
scripts/Makefile.lib | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index d1d51e38b55d..e67f066c0cea 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -213,9 +213,9 @@ endif
# $(objtree)/$(obj) for including generated headers from checkin source files
ifeq ($(KBUILD_EXTMOD),)
ifdef building_out_of_srctree
-_c_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj)
-_a_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj)
-_cpp_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj)
+_c_flags += $(addprefix -I $(srctree)/,$(src)) $(addprefix -I $(objtree)/,$(obj))
+_a_flags += $(addprefix -I $(srctree)/,$(src)) $(addprefix -I $(objtree)/,$(obj))
+_cpp_flags += $(addprefix -I $(srctree)/,$(src)) $(addprefix -I $(objtree)/,$(obj))
endif
endif
--
2.40.1
next prev parent reply other threads:[~2024-04-27 14:55 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-27 14:54 [PATCH v2 0/4] kbuild: replace $(srctree)/$(src) with $(src) in Makefiles Masahiro Yamada
2024-04-27 14:54 ` [PATCH v2 1/4] arch: use $(obj)/ instead of $(src)/ for preprocessed linker scripts Masahiro Yamada
2024-04-27 14:55 ` Masahiro Yamada [this message]
2024-05-07 8:54 ` [PATCH v2 2/4] kbuild: do not add $(srctree) or $(objtree) to header search paths Nicolas Schier
2024-04-27 14:55 ` [PATCH v2 3/4] kbuild: use $(obj)/ instead of $(src)/ for common pattern rules Masahiro Yamada
2024-04-27 14:55 ` [PATCH v2 4/4] kbuild: use $(src) instead of $(srctree)/$(src) for source directory Masahiro Yamada
2024-05-09 8:59 ` Krzysztof Kozlowski
2024-05-09 19:36 ` Masahiro Yamada
2024-06-27 17:13 ` Edgecombe, Rick P
2024-06-28 2:13 ` Masahiro Yamada
2024-06-28 21:23 ` Edgecombe, Rick P
2024-06-28 22:54 ` Edgecombe, Rick P
2024-07-02 9:15 ` Masahiro Yamada
2024-07-02 16:15 ` Edgecombe, Rick P
2024-07-02 17:46 ` Masahiro Yamada
2024-07-02 9:12 ` Masahiro Yamada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240427145502.2804311-3-masahiroy@kernel.org \
--to=masahiroy@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox