Skip to content

Commit e174dd1

Browse files
nbdd0121ojeda
authored andcommitted
rust: kbuild: emit dep-info into $(depfile) directly
After commit 295d839 ("kbuild: specify output names separately for each emission type from rustc"), the preferred pattern is to ask rustc to emit dependency information into $(depfile) directly, and after commit 2185242 ("kbuild: remove sed commands after rustc rules"), the post-processing to remove comments is no longer necessary as fixdep can handle comments directly. Thus, emit dep-info into $(depfile) directly and remove the mv and sed invocation. This fixes the issue where a non-ignored .d file is emitted during compilation and removed shortly afterwards. [ Like Gary mentioned in Zulip, this likely happened due to rebasing the builds part of the old `syn` work I had. - Miguel ] Reported-by: Onur Özkan <work@onurozkan.dev> Closes: https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/syn.20artifact.20being.20tracked.20by.20git/with/575467879 Fixes: 7dbe46c ("rust: kbuild: add proc macro library support") Signed-off-by: Gary Guo <gary@garyguo.net> Tested-by: Onur Özkan <work@onurozkan.dev> Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260224072957.214979-1-gary@garyguo.net [ Reworded for a couple of typos. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
1 parent 3ac88a9 commit e174dd1

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

rust/Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -526,11 +526,9 @@ quiet_cmd_rustc_procmacrolibrary = $(RUSTC_OR_CLIPPY_QUIET) PL $@
526526
cmd_rustc_procmacrolibrary = \
527527
$(if $(skip_clippy),$(RUSTC),$(RUSTC_OR_CLIPPY)) \
528528
$(filter-out $(skip_flags),$(rust_common_flags) $(rustc_target_flags)) \
529-
--emit=dep-info,link --crate-type rlib -O \
529+
--emit=dep-info=$(depfile) --emit=link=$@ --crate-type rlib -O \
530530
--out-dir $(objtree)/$(obj) -L$(objtree)/$(obj) \
531-
--crate-name $(patsubst lib%.rlib,%,$(notdir $@)) $<; \
532-
mv $(objtree)/$(obj)/$(patsubst lib%.rlib,%,$(notdir $@)).d $(depfile); \
533-
sed -i '/^\#/d' $(depfile)
531+
--crate-name $(patsubst lib%.rlib,%,$(notdir $@)) $<
534532

535533
$(obj)/libproc_macro2.rlib: private skip_clippy = 1
536534
$(obj)/libproc_macro2.rlib: private rustc_target_flags = $(proc_macro2-flags)

0 commit comments

Comments
 (0)