summaryrefslogtreecommitdiff
path: root/rust
diff options
context:
space:
mode:
authorMiguel Ojeda <ojeda@kernel.org>2026-06-08 17:14:24 +0300
committerMiguel Ojeda <ojeda@kernel.org>2026-06-09 05:13:22 +0300
commit2846ebc836bbb3c09211ff298de74ee7dd6b0f28 (patch)
tree81aaea31baa29746d4d444a727809879e9619194 /rust
parent50f3637a459a420ec84e73fa93c0ea469c7acdec (diff)
downloadlinux-2846ebc836bbb3c09211ff298de74ee7dd6b0f28.tar.xz
rust: kbuild: define `procmacro-extension` variable
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>
Diffstat (limited to 'rust')
-rw-r--r--rust/Makefile5
1 files changed, 2 insertions, 3 deletions
diff --git a/rust/Makefile b/rust/Makefile
index 8dfccf7399d9..df90fabefb70 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -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.