Commit 2185242f authored by Masahiro Yamada's avatar Masahiro Yamada

kbuild: remove sed commands after rustc rules

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: default avatarMasahiro Yamada <masahiroy@kernel.org>
Reviewed-by: default avatarMiguel Ojeda <ojeda@kernel.org>
Tested-by: default avatarMiguel Ojeda <ojeda@kernel.org>
Reviewed-by: default avatarVincenzo Palazzo <vincenzopalazzodev@gmail.com>
parent bc6df812
...@@ -333,8 +333,7 @@ quiet_cmd_rustc_procmacro = $(RUSTC_OR_CLIPPY_QUIET) P $@ ...@@ -333,8 +333,7 @@ quiet_cmd_rustc_procmacro = $(RUSTC_OR_CLIPPY_QUIET) P $@
$(RUSTC_OR_CLIPPY) $(rust_common_flags) \ $(RUSTC_OR_CLIPPY) $(rust_common_flags) \
--emit=dep-info=$(depfile) --emit=link=$@ --extern proc_macro \ --emit=dep-info=$(depfile) --emit=link=$@ --extern proc_macro \
--crate-type proc-macro \ --crate-type proc-macro \
--crate-name $(patsubst lib%.so,%,$(notdir $@)) $<; \ --crate-name $(patsubst lib%.so,%,$(notdir $@)) $<
sed -i '/^\#/d' $(depfile)
# Procedural macros can only be used with the `rustc` that compiled it. # Procedural macros can only be used with the `rustc` that compiled it.
# Therefore, to get `libmacros.so` automatically recompiled when the compiler # Therefore, to get `libmacros.so` automatically recompiled when the compiler
...@@ -350,8 +349,7 @@ quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L ...@@ -350,8 +349,7 @@ quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L
--emit=dep-info=$(depfile) --emit=obj=$@ \ --emit=dep-info=$(depfile) --emit=obj=$@ \
--emit=metadata=$(dir $@)$(patsubst %.o,lib%.rmeta,$(notdir $@)) \ --emit=metadata=$(dir $@)$(patsubst %.o,lib%.rmeta,$(notdir $@)) \
--crate-type rlib -L$(objtree)/$(obj) \ --crate-type rlib -L$(objtree)/$(obj) \
--crate-name $(patsubst %.o,%,$(notdir $@)) $<; \ --crate-name $(patsubst %.o,%,$(notdir $@)) $< \
sed -i '/^\#/d' $(depfile) \
$(if $(rustc_objcopy),;$(OBJCOPY) $(rustc_objcopy) $@) $(if $(rustc_objcopy),;$(OBJCOPY) $(rustc_objcopy) $@)
rust-analyzer: rust-analyzer:
......
...@@ -289,9 +289,6 @@ rust_common_cmd = \ ...@@ -289,9 +289,6 @@ rust_common_cmd = \
--crate-name $(basename $(notdir $@)) \ --crate-name $(basename $(notdir $@)) \
--emit=dep-info=$(depfile) --emit=dep-info=$(depfile)
rust_handle_depfile = \
sed -i '/^\#/d' $(depfile)
# `--emit=obj`, `--emit=asm` and `--emit=llvm-ir` imply a single codegen unit # `--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 # 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 # the compiler shows a warning if it is not 1. However, if we ever stop
...@@ -301,9 +298,7 @@ rust_handle_depfile = \ ...@@ -301,9 +298,7 @@ rust_handle_depfile = \
# would not match each other. # would not match each other.
quiet_cmd_rustc_o_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@ quiet_cmd_rustc_o_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@
cmd_rustc_o_rs = \ cmd_rustc_o_rs = $(rust_common_cmd) --emit=obj=$@ $<
$(rust_common_cmd) --emit=obj=$@ $<; \
$(rust_handle_depfile)
$(obj)/%.o: $(src)/%.rs FORCE $(obj)/%.o: $(src)/%.rs FORCE
$(call if_changed_dep,rustc_o_rs) $(call if_changed_dep,rustc_o_rs)
...@@ -311,24 +306,19 @@ $(obj)/%.o: $(src)/%.rs FORCE ...@@ -311,24 +306,19 @@ $(obj)/%.o: $(src)/%.rs FORCE
quiet_cmd_rustc_rsi_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@ quiet_cmd_rustc_rsi_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@
cmd_rustc_rsi_rs = \ cmd_rustc_rsi_rs = \
$(rust_common_cmd) -Zunpretty=expanded $< >$@; \ $(rust_common_cmd) -Zunpretty=expanded $< >$@; \
command -v $(RUSTFMT) >/dev/null && $(RUSTFMT) $@; \ command -v $(RUSTFMT) >/dev/null && $(RUSTFMT) $@
$(rust_handle_depfile)
$(obj)/%.rsi: $(src)/%.rs FORCE $(obj)/%.rsi: $(src)/%.rs FORCE
$(call if_changed_dep,rustc_rsi_rs) $(call if_changed_dep,rustc_rsi_rs)
quiet_cmd_rustc_s_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@ quiet_cmd_rustc_s_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@
cmd_rustc_s_rs = \ cmd_rustc_s_rs = $(rust_common_cmd) --emit=asm=$@ $<
$(rust_common_cmd) --emit=asm=$@ $<; \
$(rust_handle_depfile)
$(obj)/%.s: $(src)/%.rs FORCE $(obj)/%.s: $(src)/%.rs FORCE
$(call if_changed_dep,rustc_s_rs) $(call if_changed_dep,rustc_s_rs)
quiet_cmd_rustc_ll_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@ quiet_cmd_rustc_ll_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@
cmd_rustc_ll_rs = \ cmd_rustc_ll_rs = $(rust_common_cmd) --emit=llvm-ir=$@ $<
$(rust_common_cmd) --emit=llvm-ir=$@ $<; \
$(rust_handle_depfile)
$(obj)/%.ll: $(src)/%.rs FORCE $(obj)/%.ll: $(src)/%.rs FORCE
$(call if_changed_dep,rustc_ll_rs) $(call if_changed_dep,rustc_ll_rs)
......
...@@ -148,8 +148,7 @@ $(host-cxxobjs): $(obj)/%.o: $(src)/%.cc FORCE ...@@ -148,8 +148,7 @@ $(host-cxxobjs): $(obj)/%.o: $(src)/%.cc FORCE
# host-rust -> Executable # host-rust -> Executable
quiet_cmd_host-rust = HOSTRUSTC $@ quiet_cmd_host-rust = HOSTRUSTC $@
cmd_host-rust = \ cmd_host-rust = \
$(HOSTRUSTC) $(hostrust_flags) --emit=link=$@ $<; \ $(HOSTRUSTC) $(hostrust_flags) --emit=link=$@ $<
sed -i '/^\#/d' $(depfile)
$(host-rust): $(obj)/%: $(src)/%.rs FORCE $(host-rust): $(obj)/%: $(src)/%.rs FORCE
$(call if_changed_dep,host-rust) $(call if_changed_dep,host-rust)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment