]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
rust: kbuild: define `procmacro-extension` variable
authorMiguel Ojeda <ojeda@kernel.org>
Mon, 8 Jun 2026 14:14:24 +0000 (16:14 +0200)
committerMiguel Ojeda <ojeda@kernel.org>
Tue, 9 Jun 2026 02:13:22 +0000 (04:13 +0200)
Since we are adding one more proc macro crate (`zerocopy-derive`),
we are refactoring their handling.

Thus, instead of using `libmacros_extension` as the common variable to
hold the extension for all of them, use a dedicated variable with a more
generic name (including for its implementation).

Link: https://patch.msgid.link/20260608141439.182634-6-ojeda@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/Makefile

index 8dfccf7399d9175c85f39e3dbecccd50c255a5b6..df90fabefb703faf73f386894f4406d6732b0a4d 100644 (file)
@@ -48,10 +48,9 @@ endif
 ifdef CONFIG_RUST
 
 procmacro-name = $(shell MAKEFLAGS= $(RUSTC) --print file-names --crate-name $(1) --crate-type proc-macro - </dev/null)
+procmacro-extension := $(patsubst libname.%,%,$(call procmacro-name,name))
 
 libmacros_name := $(call procmacro-name,macros)
-libmacros_extension := $(patsubst libmacros.%,%,$(libmacros_name))
-
 libpin_init_internal_name := $(call procmacro-name,pin_init_internal)
 
 always-$(CONFIG_RUST) += $(libmacros_name) $(libpin_init_internal_name)
@@ -549,7 +548,7 @@ quiet_cmd_rustc_procmacro = $(RUSTC_OR_CLIPPY_QUIET) P $@
                -Clink-args='$(call escsq,$(KBUILD_PROCMACROLDFLAGS))' \
                --emit=dep-info=$(depfile) --emit=link=$@ --extern proc_macro \
                --crate-type proc-macro -L$(objtree)/$(obj) \
-               --crate-name $(patsubst lib%.$(libmacros_extension),%,$(notdir $@)) \
+               --crate-name $(patsubst lib%.$(procmacro-extension),%,$(notdir $@)) \
                @$(objtree)/include/generated/rustc_cfg $<
 
 # Procedural macros can only be used with the `rustc` that compiled it.