From patchwork Tue Apr 5 14:02:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 12802239 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 936B2C43217 for ; Wed, 6 Apr 2022 00:44:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1453694AbiDFAnS (ORCPT ); Tue, 5 Apr 2022 20:43:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444179AbiDEPk6 (ORCPT ); Tue, 5 Apr 2022 11:40:58 -0400 Received: from conuserg-09.nifty.com (conuserg-09.nifty.com [210.131.2.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28738B8D; Tue, 5 Apr 2022 07:03:30 -0700 (PDT) Received: from grover.. (133-32-177-133.west.xps.vectant.ne.jp [133.32.177.133]) (authenticated) by conuserg-09.nifty.com with ESMTP id 235E2k8J021295; Tue, 5 Apr 2022 23:02:47 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com 235E2k8J021295 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1649167367; bh=3DqNNvADXzvHcLCX0JSWQu0LGeQKS0pcjU6by571POs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LfieR2VmMKTxTNyd2rEQ8kIzgpwQ0gGElm/+R4Gv+yUizsZAMUx7OlekL+Cq87W/w oaeFGyDYwcDQqttYW2cDoatDLf+PgAPBsMGOgvbhcLfAnFi0XWqAPcD+JRfi0JXyyf BjZimdPTSqSBoscR0piS+f9exDxwYD25UdNtjyImjudR175ZrZRHaFhv9IGjfp3OWE kkpnQtRrh69J5UNewWEJ95BZ5LvGCym/qqCpJTFn5rd3SDRbhcKSoFitacvlRV+R5l aOqfb4EVoT8vdO2BhH1u9woz+RhCizmkuLuIFpRYz8ox5IFg71M0uMm9/z7vJmZ/+L qmQID8zdlEKWQ== X-Nifty-SrcIP: [133.32.177.133] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Michal Marek , Nick Desaulniers Subject: [PATCH v2 01/10] kbuild: factor out genksyms command from cmd_gensymtypes_{c,S} Date: Tue, 5 Apr 2022 23:02:20 +0900 Message-Id: <20220405140229.2895394-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220405140229.2895394-1-masahiroy@kernel.org> References: <20220405140229.2895394-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org The genksyms command part in cmd_gensymtypes_{c,S} is duplicated. Factor it out into the 'genksyms' macro. For the readability, I slightly refactor the arguments to genksyms. Signed-off-by: Masahiro Yamada --- Changes in v2: - Fix the location of the closing parenthesis scripts/Makefile.build | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 9717e6f6fb31..31e0e33dfe5d 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -125,13 +125,14 @@ cmd_cpp_i_c = $(CPP) $(c_flags) -o $@ $< $(obj)/%.i: $(src)/%.c FORCE $(call if_changed_dep,cpp_i_c) +genksyms = scripts/genksyms/genksyms \ + $(if $(1), -T $(2)) \ + $(if $(CONFIG_MODULE_REL_CRCS), -R) \ + $(if $(KBUILD_PRESERVE), -p) \ + -r $(or $(wildcard $(2:.symtypes=.symref)), /dev/null) + # These mirror gensymtypes_S and co below, keep them in synch. -cmd_gensymtypes_c = \ - $(CPP) -D__GENKSYMS__ $(c_flags) $< | \ - scripts/genksyms/genksyms $(if $(1), -T $(2)) \ - $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS)) \ - $(if $(KBUILD_PRESERVE),-p) \ - -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null)) +cmd_gensymtypes_c = $(CPP) -D__GENKSYMS__ $(c_flags) $< | $(genksyms) quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@ cmd_cc_symtypes_c = \ @@ -344,11 +345,7 @@ cmd_gensymtypes_S = \ $(CPP) $(a_flags) $< | \ grep "\<___EXPORT_SYMBOL\>" | \ sed 's/.*___EXPORT_SYMBOL[[:space:]]*\([a-zA-Z0-9_]*\)[[:space:]]*,.*/EXPORT_SYMBOL(\1);/' ; } | \ - $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | \ - scripts/genksyms/genksyms $(if $(1), -T $(2)) \ - $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS)) \ - $(if $(KBUILD_PRESERVE),-p) \ - -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null)) + $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | $(genksyms) quiet_cmd_cc_symtypes_S = SYM $(quiet_modtag) $@ cmd_cc_symtypes_S = \