From mboxrd@z Thu Jan 1 00:00:00 1970 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 B07FAC35276 for ; Tue, 5 Apr 2022 21:24:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347757AbiDEVXC (ORCPT ); Tue, 5 Apr 2022 17:23:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384122AbiDEM1L (ORCPT ); Tue, 5 Apr 2022 08:27:11 -0400 Received: from conuserg-12.nifty.com (conuserg-12.nifty.com [210.131.2.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4D39574BC; Tue, 5 Apr 2022 04:35:18 -0700 (PDT) Received: from grover.. (133-32-177-133.west.xps.vectant.ne.jp [133.32.177.133]) (authenticated) by conuserg-12.nifty.com with ESMTP id 235BYCGt000464; Tue, 5 Apr 2022 20:34:17 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com 235BYCGt000464 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1649158457; bh=g76dlQF6mmZzr43YQ6WiTAVzfZji/JTWeTt9/x6nhy8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fhkX7GfZ1icPtiA7cEpfvegqzI8mfJATIDbetdt2odNtdCLvwcVJbCeOwONU77Vz4 nSePOhux0lQk44IYWxfyYxJwmKw8ZT5qQwaQuMa5RRkjeByWbGxewF0m8GzKNhEjpw 3mU7LXD1uWZhPhC1MGCcPsytnpd6qEDZCSRBIG9xJU5clVEv4nv0OImbzNqdgNIc+w qo+J86PA3PYHQr/pkfo5OdrBlC7XpaF3HaBw8740gCbiiKgtIXY7z0/ZilnObun8OT /qBp6C97UmE0EJKvHrXoC8t1Wuct2SKs4qOzErdjGLh5jpcHfrUWWjudhk5MWbXJya dvzaDo8oWbJeg== 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 07/10] kbuild: get rid of duplication in the first line of *.mod files Date: Tue, 5 Apr 2022 20:33:55 +0900 Message-Id: <20220405113359.2880241-8-masahiroy@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220405113359.2880241-1-masahiroy@kernel.org> References: <20220405113359.2880241-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The first line of *.mod lists the member objects of the module. This list may contain duplication if the same object is added multiple times, like this: obj-m := foo.o foo-$(CONFIG_FOO1_X) += foo1.o foo-$(CONFIG_FOO1_Y) += foo1.o foo-$(CONFIG_FOO2_X) += foo2.o foo-$(CONFIG_FOO2_Y) += foo2.o This is probably not a big deal. As far as I know, the only small problem is scripts/mod/sumversion.c parses the same file over again. This can be avoided by adding $(sort ...). It has a side-effect that sorts the objects alphabetically, but it is not a big deal, either. Signed-off-by: Masahiro Yamada --- Changes in v2: - new scripts/Makefile.build | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 3ef2373f0a57..63625877aeae 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -307,8 +307,10 @@ $(obj)/%.prelink.o: $(obj)/%.o FORCE $(call if_changed,cc_prelink_modules) endif +multi-m-prereqs = $(sort $(addprefix $(obj)/, $($*-objs) $($*-y) $($*-m))) + cmd_mod = { \ - echo $(if $($*-objs)$($*-y)$($*-m), $(addprefix $(obj)/, $($*-objs) $($*-y) $($*-m)), $(@:.mod=.o)); \ + echo $(if $(multi-m-prereqs), $(multi-m-prereqs), $(@:.mod=.o)); \ $(undefined_syms) echo; \ } > $@ -- 2.32.0