public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: linux-kbuild@vger.kernel.org
Cc: Masahiro Yamada <masahiroy@kernel.org>,
	Michal Marek <michal.lkml@markovi.net>,
	Nick Desaulniers <ndesaulniers@google.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 3/4] kbuild: error out if $(KBUILD_EXTMOD) contains % or :
Date: Thu, 14 Jul 2022 14:02:42 +0900	[thread overview]
Message-ID: <20220714050243.16411-3-masahiroy@kernel.org> (raw)
In-Reply-To: <20220714050243.16411-1-masahiroy@kernel.org>

If the directory pass given to KBUILD_EXTMOD (or M=) contains % or :,
the module fails to build.

% is used in pattern rules, and : as the separator of dependencies.

Bail out with a clearer error message.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Makefile b/Makefile
index faa4880f25f7..ecda62e27553 100644
--- a/Makefile
+++ b/Makefile
@@ -129,6 +129,9 @@ endif
 $(if $(word 2, $(KBUILD_EXTMOD)), \
 	$(error building multiple external modules is not supported))
 
+$(foreach x, % :, $(if $(findstring $x, $(KBUILD_EXTMOD)), \
+	$(error module directory path cannot contain '$x')))
+
 # Remove trailing slashes
 ifneq ($(filter %/, $(KBUILD_EXTMOD)),)
 KBUILD_EXTMOD := $(shell dirname $(KBUILD_EXTMOD).)
-- 
2.34.1


  parent reply	other threads:[~2022-07-14  5:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-14  5:02 [PATCH 1/4] kbuild: rpm-pkg: fix build error when _arch is undefined Masahiro Yamada
2022-07-14  5:02 ` [PATCH 2/4] kbuild: rpm-pkg: pass 'linux' to --target option of rpmbuild Masahiro Yamada
2022-07-14  5:02 ` Masahiro Yamada [this message]
2022-07-15  9:17   ` [PATCH 3/4] kbuild: error out if $(KBUILD_EXTMOD) contains % or : Nicolas Schier
2022-07-16 15:38   ` Masahiro Yamada
2022-07-14  5:02 ` [PATCH 4/4] kbuild: error out if $(INSTALL_MOD_PATH) " Masahiro Yamada
2022-07-15  9:17   ` Nicolas Schier
2022-07-16 15:40   ` 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=20220714050243.16411-3-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=ndesaulniers@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