From patchwork Sat Jan 7 09:18:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 40323 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1224126wrt; Sat, 7 Jan 2023 01:20:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXs9eHjwQL/P5/DSywFaDlZLtNNHp/I0BWPUmf1sDYf7oB3IVTk/XvXHbrda3+Ajf3+237S4 X-Received: by 2002:a17:902:aa96:b0:18e:8223:6447 with SMTP id d22-20020a170902aa9600b0018e82236447mr57073078plr.22.1673083220810; Sat, 07 Jan 2023 01:20:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673083220; cv=none; d=google.com; s=arc-20160816; b=fjezQcDUoAcgXia6LAb5QC1MMgiJ42zv7tDS/e8DbJZkWjeGZlltQeuA/y7KP0sDcH NIZKfe5ALsSWfFYs4lOyDd1wdpXmJAaDt5QrTG5mohu6R4U0Qbck+7fgqApnbgQZuUjc z63FRgnN933JLQzRVY4va/wO7Ga9Qbphye2HentDP3BeKO18yefWC5Tr/I+5JwMKa/yK 13hSfyLjXdbpcmo2ro8QiDJwABSDXsIocbnJxgyMfTAXfELwx1CXYWB2UsVbnX+jP2// 9Ah9F2DdgBcz9vXARLIWVPUwpR8F0D3UpaF/R7od9ZrOHAYsD0B2HU3MnApsI1gApKU+ mH3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SruosgFiPV5303uHQRvtkt+TtpeX7iXv/PL8yxYUTQA=; b=Yn9cG9vRkAzhJQtVHmUE2kjxgbdWs2j7VF35uHi75nG/LjjNKR6K2xefPb3oDS8q9M Q8z2p+QpbHlRZF1HG3hye6tS7PDdCWpfFCKp6aTOlOj6P2I1OqHKs8hR+W5Qdg5s3GmB QbGNsiVAV90bKv2Z8KCCmLrz1yKLaa7YWwF9gNtYQF8P4qJc0YzQt2ZS/HQyOIwTglg/ KocMIa401MPR6EsEVp5iQDlE68c++VrULS5AulmtZYlM1BuCsf+Dk6v5ieZ8HhMCUEAK 7jLEuC+0w5SBju4R+MWV/sAoEuzaSYDM/aLgP0K8WeSH/h2kUJZGZy69DvZ/pMpQHX5z +Wag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="U/ETtaOt"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y24-20020a634958000000b004790510bfe5si3753772pgk.692.2023.01.07.01.20.07; Sat, 07 Jan 2023 01:20:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="U/ETtaOt"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231915AbjAGJT2 (ORCPT + 99 others); Sat, 7 Jan 2023 04:19:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231905AbjAGJSy (ORCPT ); Sat, 7 Jan 2023 04:18:54 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D654B87902; Sat, 7 Jan 2023 01:18:43 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 844F2B81F74; Sat, 7 Jan 2023 09:18:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9051C433F1; Sat, 7 Jan 2023 09:18:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673083121; bh=Gydwsigs3s+UcKgjKjO+8mlNk6k/2GkoKY1BjgMibbo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U/ETtaOtHHRMupIDCoDQClmyyS1Xhi7LQgTA/ixQVGgyw8c7DHOZtx+gNMx3DDmQ9 xo/N5kdIQXblY+sPnJ5sBRNscHwtKeFIGhMFT4KXlE2Nd9f+nD1erBi9Y36Z6DC8e2 8RkM7W1ZlyFFyuMFNURCGw7VXAXQ9EZQaJ44EOOyUgZCyJbCzWY64HU2IhqnJzuAGx z2uv8RXGSTMB9JNa3J6davMmbPHg+QLczxGW6gIco0M8p/58/y8P1siTuJcj76M3uN m0RuNWtzKjQgLWm8vsT67Vc9XhyowUTj9TitP7fWWyMtmfli9Db/on3obOHHp3q0je gJtnVpU6JFa4A== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , rust-for-linux@vger.kernel.org, Masahiro Yamada , Vincenzo Palazzo , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , Tom Rix , llvm@lists.linux.dev Subject: [PATCH v2 4/7] kbuild: remove sed commands after rustc rules Date: Sat, 7 Jan 2023 18:18:17 +0900 Message-Id: <20230107091820.3382134-4-masahiroy@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230107091820.3382134-1-masahiroy@kernel.org> References: <20230107091820.3382134-1-masahiroy@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754354911316895953?= X-GMAIL-MSGID: =?utf-8?q?1754354911316895953?= 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 Reviewed-by: Miguel Ojeda Tested-by: Miguel Ojeda Reviewed-by: Vincenzo Palazzo --- (no changes since v1) 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 865afb87bc9b..f403b79cae5a 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 @@ -350,8 +349,7 @@ quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L --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 67ef852712d4..a45a97b027d1 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host @@ -145,8 +145,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)