From: Masahiro Yamada <masahiroy@kernel.org>
To: linux-kbuild@vger.kernel.org
Cc: Will McVicker <willmcvicker@google.com>,
Masahiro Yamada <masahiroy@kernel.org>,
Michal Marek <michal.lkml@markovi.net>,
linux-kernel@vger.kernel.org
Subject: [PATCH] kbuild: warn a relative path used for M= in out-of-tree builds
Date: Thu, 21 Jan 2021 04:31:00 +0900 [thread overview]
Message-ID: <20210120193100.3414664-1-masahiroy@kernel.org> (raw)
Surprising to me, Kbuild can handle a relative M= path while having
in-kernel objects in a separate directory. In this case, the M= option
actually defines:
- the path to external module sources relative to $(srctree)
- the path to external module objects relative to $(objtree)
For example,
make O=foo/bar M=baz
... will find the source files in baz, and create objects in foo/bar/baz.
Currently, it works like that because of the presence of VPATH and
--include-dir=$(abs_srctree), but this behavior is subtle and cannot
be guaranteed in the future. I do not know if it was even officially
supported ever.
I do not recommend this usage.
Reported-by: Will McVicker <willmcvicker@google.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
Makefile | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Makefile b/Makefile
index b0e4767735dc..e42a27447eae 100644
--- a/Makefile
+++ b/Makefile
@@ -1699,6 +1699,13 @@ else # KBUILD_EXTMOD
# Install the modules built in the module directory
# Assumes install directory is already created
+ifdef building_out_of_srctree
+ifneq ($(filter-out /%, $(KBUILD_EXTMOD)),)
+$(warning The combination of out-of-tree build and relative M= path is not well supported.)
+$(warning Please do not complain about any trouble happening under this circumstance.)
+endif
+endif
+
# We are always building only modules.
KBUILD_BUILTIN :=
KBUILD_MODULES := 1
--
2.27.0
next reply other threads:[~2021-01-20 19:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-20 19:31 Masahiro Yamada [this message]
2021-01-20 19:46 ` Will McVicker
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=20210120193100.3414664-1-masahiroy@kernel.org \
--to=masahiroy@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.lkml@markovi.net \
--cc=willmcvicker@google.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
all inboxes | Powered by JetHome®