[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250922-demonic-raccoon-of-will-1adb52@bergen>
Date: Mon, 22 Sep 2025 08:02:36 +0200
From: Nicolas Schier <nicolas.schier@...ux.dev>
To: Onur Özkan <work@...rozkan.dev>
Cc: rust-for-linux@...r.kernel.org, ojeda@...nel.org, nathan@...nel.org,
nicolas.schier@...ux.dev, masahiroy@...nel.org,
aliceryhl@...gle.com, thomas.weissschuh@...utronix.de,
tamird@...il.com, linux-kbuild@...r.kernel.org,
linux-kernel@...r.kernel.org, alex.gaynor@...il.com,
boqun.feng@...il.com, gary@...yguo.net, bjorn3_gh@...tonmail.com,
lossin@...nel.org, a.hindborg@...nel.org, tmgross@...ch.edu,
dakr@...nel.org
Subject: Re: [PATCH v2 1/1] rust: add `rustcheck` make target for check-only
builds
On Mon, Sep 15, 2025 at 02:53:11PM +0300, Onur Özkan wrote:
> Adds a new `rustcheck` make target to run a check-only build
> similar to `cargo check`. This allows us to verify that the Rust
> sources can build without building/linking final artifacts,
> which speeds up the iteration (a lot) during development.
>
> The target also supports the CLIPPY flag (e.g., `make LLVM=1
> rustcheck CLIPPY=1) to run Clippy in a faster way.
>
> Also, unlike `make LLVM=1`, it doesn't compile large amounts of C
> code (on a fresh checkout) when the goal is only to check that
> Rust builds are not broken after some changes.
>
> Suggested-by: Benno Losin <lossin@...nel.org>
> Link: https://rust-for-linux.zulipchat.com/#narrow/channel/288089/topic/x/near/539103602
> Signed-off-by: Onur Özkan <work@...rozkan.dev>
> ---
> Makefile | 7 +++++
> rust/Makefile | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 80 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index cf37b9407821..7812cdc72938 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1716,6 +1716,8 @@ help:
> @echo ' is formatted, printing a diff otherwise.'
> @echo ' rustdoc - Generate Rust documentation'
> @echo ' (requires kernel .config)'
> + @echo ' rustcheck - Check that the Rust code builds'
> + @echo ' (requires kernel .config)'
> @echo ' rusttest - Runs the Rust tests'
> @echo ' (requires kernel .config; downloads external repos)'
> @echo ' rust-analyzer - Generate rust-project.json rust-analyzer support file'
> @@ -1821,6 +1823,11 @@ PHONY += rustdoc
> rustdoc: prepare
> $(Q)$(MAKE) $(build)=rust $@
>
> +# Checking Rust sources.
> +PHONY += rustcheck
> +rustcheck: prepare0
Why do you let rustcheck depend on prepare0 instead of prepare?
> + $(Q)$(MAKE) $(build)=rust $@
> +
> # Testing target
> PHONY += rusttest
> rusttest: prepare
> diff --git a/rust/Makefile b/rust/Makefile
> index bfa915b0e588..b45878870207 100644
> --- a/rust/Makefile
> +++ b/rust/Makefile
> @@ -265,6 +265,79 @@ rusttest-kernel: $(src)/kernel/lib.rs rusttestlib-ffi rusttestlib-kernel \
> rusttestlib-uapi rusttestlib-pin_init FORCE
> +$(call if_changed,rustc_test)
>
> +## Check-only compilation (similar to `cargo check`)
> +quiet_cmd_rustc_check_library = $(RUSTC_OR_CLIPPY_QUIET) CHECK $<
> + cmd_rustc_check_library = \
> + OBJTREE=$(abspath $(objtree)) \
Have you tried this?
OBJTREE=$(CURDIR) \
or
OBJTREE=$(abs_output) \
I'd favor using one of these instead.
Kind regards,
Nicolas
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists