[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251110095025.1475896-5-ojeda@kernel.org>
Date: Mon, 10 Nov 2025 10:50:09 +0100
From: Miguel Ojeda <ojeda@...nel.org>
To: Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Nathan Chancellor <nathan@...nel.org>,
Nicolas Schier <nicolas@...sle.eu>
Cc: Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <lossin@...nel.org>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>,
rust-for-linux@...r.kernel.org,
linux-kbuild@...r.kernel.org,
linux-kernel@...r.kernel.org,
patches@...ts.linux.dev
Subject: [PATCH 04/18] rust: kbuild: add host library support
Add the a host library rule that produces `.rlib` files to be used by the
`macros` crate.
Signed-off-by: Miguel Ojeda <ojeda@...nel.org>
---
.gitignore | 1 +
rust/Makefile | 10 ++++++++++
2 files changed, 11 insertions(+)
diff --git a/.gitignore b/.gitignore
index 86a1ba0d9035..3a7241c941f5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,6 +41,7 @@
*.o.*
*.patch
*.pyc
+*.rlib
*.rmeta
*.rpm
*.rsi
diff --git a/rust/Makefile b/rust/Makefile
index 7efed88d032c..9eea6563ef35 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -430,6 +430,16 @@ $(obj)/exports_bindings_generated.h: $(obj)/bindings.o FORCE
$(obj)/exports_kernel_generated.h: $(obj)/kernel.o FORCE
$(call if_changed,exports)
+quiet_cmd_rustc_hostlibrary = $(RUSTC_OR_CLIPPY_QUIET) H $@
+ cmd_rustc_hostlibrary = \
+ $(if $(skip_clippy),$(RUSTC),$(RUSTC_OR_CLIPPY)) \
+ $(filter-out $(skip_flags),$(rust_common_flags) $(rustc_target_flags)) \
+ --emit=dep-info,link --crate-type rlib -O \
+ --out-dir $(objtree)/$(obj) -L$(objtree)/$(obj) \
+ --crate-name $(patsubst lib%.rlib,%,$(notdir $@)) $<; \
+ mv $(objtree)/$(obj)/$(patsubst lib%.rlib,%,$(notdir $@)).d $(depfile); \
+ sed -i '/^\#/d' $(depfile)
+
quiet_cmd_rustc_procmacro = $(RUSTC_OR_CLIPPY_QUIET) P $@
cmd_rustc_procmacro = \
$(RUSTC_OR_CLIPPY) $(rust_common_flags) $(rustc_target_flags) \
--
2.51.2
Powered by blists - more mailing lists