[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251014094511.627258-2-gtucker@gtucker.io>
Date: Tue, 14 Oct 2025 11:45:11 +0200
From: Guillaume Tucker <gtucker@...cker.io>
To: Nathan Chancellor <nathan@...nel.org>,
Nicolas Schier <nicolas.schier@...ux.dev>
Cc: Guillaume Tucker <gtucker@...cker.io>,
Miguel Ojeda <ojeda@...nel.org>,
rust-for-linux@...r.kernel.org,
linux-kbuild@...r.kernel.org,
linux-kernel@...r.kernel.org,
automated-testing@...ts.yoctoproject.org,
Arnd Bergmann <arnd@...db.de>,
workflows@...r.kernel.org,
llvm@...ts.linux.dev
Subject: [RFC PATCH 1/1] kbuild: add Makefile.container with CONTAINER option
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@...nel.org>
Cc: Miguel Ojeda <ojeda@...nel.org>
Link: https://lore.kernel.org/all/affb7aff-dc9b-4263-bbd4-a7965c19ac4e@gtucker.io/
Signed-off-by: Guillaume Tucker <gtucker@...cker.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
Powered by blists - more mailing lists