rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guillaume Tucker <gtucker@gtucker.io>
To: Nathan Chancellor <nathan@kernel.org>,
	Nicolas Schier <nicolas.schier@linux.dev>
Cc: Guillaume Tucker <gtucker@gtucker.io>,
	Miguel Ojeda <ojeda@kernel.org>,
	rust-for-linux@vger.kernel.org, linux-kbuild@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	automated-testing@lists.yoctoproject.org,
	Arnd Bergmann <arnd@arndb.de>,
	workflows@vger.kernel.org, llvm@lists.linux.dev
Subject: [RFC PATCH 1/1] kbuild: add Makefile.container with CONTAINER option
Date: Tue, 14 Oct 2025 11:45:11 +0200	[thread overview]
Message-ID: <20251014094511.627258-2-gtucker@gtucker.io> (raw)
In-Reply-To: <20251014094511.627258-1-gtucker@gtucker.io>

Add scripts/Makefile.container to wrap the make command in a container
using the CONTAINER= variable to specify the image name.  For example:

    make -f scripts/Makefile.container CONTAINER=korg-gcc defconfig

The container image name is entirely arbitrary and the container tool
may be Docker, Podman or any other compatible alternative specified by
the CONTAINER_COMMAND variable.  The default is set to docker for now.

Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Miguel Ojeda <ojeda@kernel.org>
Link: https://lore.kernel.org/all/affb7aff-dc9b-4263-bbd4-a7965c19ac4e@gtucker.io/
Signed-off-by: Guillaume Tucker <gtucker@gtucker.io>
---
 scripts/Makefile.container | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 scripts/Makefile.container

diff --git a/scripts/Makefile.container b/scripts/Makefile.container
new file mode 100644
index 000000000000..711cf9188016
--- /dev/null
+++ b/scripts/Makefile.container
@@ -0,0 +1,15 @@
+# SPDX-License-Identifier: GPL-2.0
+
+ifeq ($(CONTAINER),)
+$(error "Usage: make CONTAINER=<container-image-name> [...]")
+endif
+CONTAINER_COMMAND ?= docker
+PHONY := __all
+
+__all:
+%:
+	@echo Running in $(CONTAINER_COMMAND) $(CONTAINER)
+	@$(CONTAINER_COMMAND) run -it -v $(PWD):/src -w /src \
+	$(CONTAINER) $(MAKE) \
+	$(subst CONTAINER=$(CONTAINER),,$(MAKEFLAGS)) \
+	$(GNUMAKEFLAGS) $(MAKECMDGOALS)
-- 
2.47.3


  reply	other threads:[~2025-10-14  9:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-14  9:45 [RFC PATCH 0/1] kbuild: introduce containerized builds Guillaume Tucker
2025-10-14  9:45 ` Guillaume Tucker [this message]
2025-10-14 11:58   ` [RFC PATCH 1/1] kbuild: add Makefile.container with CONTAINER option Miguel Ojeda
2025-10-14 14:08     ` Onur Özkan
2025-10-14 14:42       ` Guillaume Tucker
2025-10-14 14:31     ` Guillaume Tucker
2025-10-14 15:42       ` Miguel Ojeda

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=20251014094511.627258-2-gtucker@gtucker.io \
    --to=gtucker@gtucker.io \
    --cc=arnd@arndb.de \
    --cc=automated-testing@lists.yoctoproject.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=nicolas.schier@linux.dev \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=workflows@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).