From: "Vincenzo" <vincenzopalazzodev@gmail.com>
To: "Masahiro Yamada" <masahiroy@kernel.org>, <linux-kbuild@vger.kernel.org>
Cc: linux-kernel@vger.kernel.org, "Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Nathan Chancellor" <nathan@kernel.org>,
"Nick Desaulniers" <ndesaulniers@google.com>,
"Nicolas Schier" <nicolas@fjasle.eu>, "Tom Rix" <trix@redhat.com>,
"Wedson Almeida Filho" <wedsonaf@gmail.com>,
llvm@lists.linux.dev, rust-for-linux@vger.kernel.org
Subject: Re: [PATCH 3/6] kbuild: remove sed commands after rustc rules
Date: Fri, 06 Jan 2023 10:28:00 +0100 [thread overview]
Message-ID: <CPL01GLA72E1.N4D1Z43Y3NY@vincent> (raw)
In-Reply-To: <20221231064203.1623793-4-masahiroy@kernel.org>
Reviewed-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
> rustc may put comments in dep-info, so sed is used to drop them before
> passing it to fixdep.
>
> Now that fixdep can remove comments, Makefiles do not need to run sed.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
>
> rust/Makefile | 6 ++----
> scripts/Makefile.build | 18 ++++--------------
> scripts/Makefile.host | 3 +--
> 3 files changed, 7 insertions(+), 20 deletions(-)
>
> diff --git a/rust/Makefile b/rust/Makefile
> index 0e2a32f4b3e9..c8941fec6955 100644
> --- a/rust/Makefile
> +++ b/rust/Makefile
> @@ -333,8 +333,7 @@ quiet_cmd_rustc_procmacro = $(RUSTC_OR_CLIPPY_QUIET) P $@
> $(RUSTC_OR_CLIPPY) $(rust_common_flags) \
> --emit=dep-info=$(depfile) --emit=link=$@ --extern proc_macro \
> --crate-type proc-macro \
> - --crate-name $(patsubst lib%.so,%,$(notdir $@)) $<; \
> - sed -i '/^\#/d' $(depfile)
> + --crate-name $(patsubst lib%.so,%,$(notdir $@)) $<
>
> # Procedural macros can only be used with the `rustc` that compiled it.
> # Therefore, to get `libmacros.so` automatically recompiled when the compiler
> @@ -349,8 +348,7 @@ quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L
> $(filter-out $(skip_flags),$(rust_flags) $(rustc_target_flags)) \
> --emit=dep-info=$(depfile) --emit=obj=$@ --emit=metadata=$(dir $@)$(patsubst %.o,lib%.rmeta,$(notdir $@)) \
> --crate-type rlib -L$(objtree)/$(obj) \
> - --crate-name $(patsubst %.o,%,$(notdir $@)) $<; \
> - sed -i '/^\#/d' $(depfile) \
> + --crate-name $(patsubst %.o,%,$(notdir $@)) $< \
> $(if $(rustc_objcopy),;$(OBJCOPY) $(rustc_objcopy) $@)
>
> rust-analyzer:
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 40de20246e50..76323201232a 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -289,9 +289,6 @@ rust_common_cmd = \
> --crate-name $(basename $(notdir $@)) \
> --emit=dep-info=$(depfile)
>
> -rust_handle_depfile = \
> - sed -i '/^\#/d' $(depfile)
> -
> # `--emit=obj`, `--emit=asm` and `--emit=llvm-ir` imply a single codegen unit
> # will be used. We explicitly request `-Ccodegen-units=1` in any case, and
> # the compiler shows a warning if it is not 1. However, if we ever stop
> @@ -301,9 +298,7 @@ rust_handle_depfile = \
> # would not match each other.
>
> quiet_cmd_rustc_o_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@
> - cmd_rustc_o_rs = \
> - $(rust_common_cmd) --emit=obj=$@ $<; \
> - $(rust_handle_depfile)
> + cmd_rustc_o_rs = $(rust_common_cmd) --emit=obj=$@ $<
>
> $(obj)/%.o: $(src)/%.rs FORCE
> $(call if_changed_dep,rustc_o_rs)
> @@ -311,24 +306,19 @@ $(obj)/%.o: $(src)/%.rs FORCE
> quiet_cmd_rustc_rsi_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@
> cmd_rustc_rsi_rs = \
> $(rust_common_cmd) -Zunpretty=expanded $< >$@; \
> - command -v $(RUSTFMT) >/dev/null && $(RUSTFMT) $@; \
> - $(rust_handle_depfile)
> + command -v $(RUSTFMT) >/dev/null && $(RUSTFMT) $@
>
> $(obj)/%.rsi: $(src)/%.rs FORCE
> $(call if_changed_dep,rustc_rsi_rs)
>
> quiet_cmd_rustc_s_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@
> - cmd_rustc_s_rs = \
> - $(rust_common_cmd) --emit=asm=$@ $<; \
> - $(rust_handle_depfile)
> + cmd_rustc_s_rs = $(rust_common_cmd) --emit=asm=$@ $<
>
> $(obj)/%.s: $(src)/%.rs FORCE
> $(call if_changed_dep,rustc_s_rs)
>
> quiet_cmd_rustc_ll_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@
> - cmd_rustc_ll_rs = \
> - $(rust_common_cmd) --emit=llvm-ir=$@ $<; \
> - $(rust_handle_depfile)
> + cmd_rustc_ll_rs = $(rust_common_cmd) --emit=llvm-ir=$@ $<
>
> $(obj)/%.ll: $(src)/%.rs FORCE
> $(call if_changed_dep,rustc_ll_rs)
> diff --git a/scripts/Makefile.host b/scripts/Makefile.host
> index 4434cdbf7b8e..bc782655d09e 100644
> --- a/scripts/Makefile.host
> +++ b/scripts/Makefile.host
> @@ -148,8 +148,7 @@ $(host-cxxobjs): $(obj)/%.o: $(src)/%.cc FORCE
> # host-rust -> Executable
> quiet_cmd_host-rust = HOSTRUSTC $@
> cmd_host-rust = \
> - $(HOSTRUSTC) $(hostrust_flags) --emit=link=$@ $<; \
> - sed -i '/^\#/d' $(depfile)
> + $(HOSTRUSTC) $(hostrust_flags) --emit=link=$@ $<
> $(host-rust): $(obj)/%: $(src)/%.rs FORCE
> $(call if_changed_dep,host-rust)
>
> --
> 2.34.1
next prev parent reply other threads:[~2023-01-06 9:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-31 6:41 [PATCH 0/6] kbuild: fix dep-file processing for rust Masahiro Yamada
2022-12-31 6:41 ` [PATCH 1/6] kbuild: specify output names separately for each emission type from rustc Masahiro Yamada
2022-12-31 20:01 ` Gary Guo
2023-01-03 20:44 ` Miguel Ojeda
2023-01-07 9:09 ` Masahiro Yamada
2023-01-06 9:24 ` Vincenzo
2022-12-31 6:42 ` [PATCH 3/6] kbuild: remove sed commands after rustc rules Masahiro Yamada
2023-01-03 20:45 ` Miguel Ojeda
2023-01-06 9:28 ` Vincenzo [this message]
2022-12-31 6:42 ` [PATCH 5/6] fixdep: avoid parsing the same file over again Masahiro Yamada
2023-01-03 20:46 ` Miguel Ojeda
2023-01-06 9:31 ` Vincenzo
2022-12-31 13:34 ` [PATCH 0/6] kbuild: fix dep-file processing for rust Miguel Ojeda
2022-12-31 15:05 ` Masahiro Yamada
2023-01-03 20:48 ` Miguel Ojeda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CPL01GLA72E1.N4D1Z43Y3NY@vincent \
--to=vincenzopalazzodev@gmail.com \
--cc=alex.gaynor@gmail.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=gary@garyguo.net \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=masahiroy@kernel.org \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=nicolas@fjasle.eu \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=trix@redhat.com \
--cc=wedsonaf@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).