mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 02:17:36 -04:00
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>
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user