From patchwork Tue Aug 6 06:39:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 170630 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp5270747ile; Mon, 5 Aug 2019 23:40:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqx3t4exvccSwrDeDd4aOItyWozeVKVl4QYMLF356vWgndlDN5d/L5K7jfUC6ZztqufWH+H0 X-Received: by 2002:a17:90a:8688:: with SMTP id p8mr1586808pjn.57.1565073638840; Mon, 05 Aug 2019 23:40:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565073638; cv=none; d=google.com; s=arc-20160816; b=Ciwyte0OP6OBXpIdPGzqGRkElUgYxGhrf4nd9hTHXyach7O2BQ1sfTHZhW+u83Fgl8 SeFbDX395X6ICR/8NtPR/kIqS6sNbFVSCnVUaZh8+pz3alxjDRBXKw5ptMoEdpQuAUGK tBUp/nXxkhV8Urm1z/WAlMGeTGPi9VCKD6TNgf6SqdeYaVbiScbLp4i0CmjJ/f5rMysn ovm/m2LlItOA8A4Wgh80ycVyO2xU9uhUGQvaEEk2lrSqapaM7BzSA78q1j9A28KsA3PA TcDXPpTIGm9qV//rSX24+kzfmuxc/fSZsRKEFQGvnMgE0sfvY1In22gO1ZHReqIqMjub LzUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=WuuYZLz5z+C5ByPickHqXjcy+trxgXoTZfNCL4q0+ek=; b=l/iMEivHlb1Pxlfqg1BRvDolOeZB8PZbBE5UoYSh3lW670ZwEMfLmZcW9SkO8+Kc7v 6GyanDSLewMamFZ7L0iqSY2NFagv+wICfeb2er2+Q/mr5AwnoUg5y0t4xxmBgSWzDt2V qASbRSSDaBC3bdHJ5RKK4YgCowMFmZ4UPRs2VguS0grjEKUKou+37Cr+b20wj86kKcIX GANWIKjaGXyXqJGd3bQjBqARuW2XrjzgnnDdn2CpftZIdSR/v0ylkUBtiPU0gsjXMDm0 n0sjQ0IcgRgOphG48ds+ogwxiPk6syEHlJlXJBiVxlWM0BccmVnu499M/cPAeT8gIypt cSwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="wZP3k/5m"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o31si46176355pgb.579.2019.08.05.23.40.38; Mon, 05 Aug 2019 23:40:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="wZP3k/5m"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731965AbfHFGkh (ORCPT + 29 others); Tue, 6 Aug 2019 02:40:37 -0400 Received: from conuserg-12.nifty.com ([210.131.2.79]:39570 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731731AbfHFGkW (ORCPT ); Tue, 6 Aug 2019 02:40:22 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-12.nifty.com with ESMTP id x766dO7p002982; Tue, 6 Aug 2019 15:39:27 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com x766dO7p002982 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1565073567; bh=WuuYZLz5z+C5ByPickHqXjcy+trxgXoTZfNCL4q0+ek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wZP3k/5mLGK/rx72rRKUp6Fflr4SFpT0/nbDK73dPtFRSCq+FIMJ6AFUdjAuYREoQ EAoB0nlX3+1RRxB0U/vlYlvpU95Uhe8+Msw90FPV9xLbEfeZHIWePv2+3Bn7jqRTQe Uh+mh36iRXvl6s62Jz/UaHL/Wojga/DMWusWL+o+vZo52M+vTCYI7lmFoWhQ9tR3D2 1rFNPX0nTg1KndQuNruLobq/a82uM/s6hzhb1Ws0DyCqENCPOiAG8ud3yRQvfi/Ste viHvqiBOcXazcEmxmzsheRHLk4djPhzzPUHdJK7FFJ6/M/DfcQipQieljKkQpp3Bdv RRKN76F/VEWJg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Jani Nikula , intel-gfx@lists.freedesktop.org, Sam Ravnborg , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 2/5] kbuild: clean up modname calculation Date: Tue, 6 Aug 2019 15:39:20 +0900 Message-Id: <20190806063923.1266-3-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190806063923.1266-1-yamada.masahiro@socionext.com> References: <20190806063923.1266-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 'multi-used' is used for computing the modname. Improve the code readability by removing the .o suffix before the foreach loop. I renamed multi-used-m to modules-multi. No functional change intended. Signed-off-by: Masahiro Yamada --- scripts/Makefile.build | 6 +++--- scripts/Makefile.lib | 15 +++++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) -- 2.17.1 diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 0d434d0afc0b..b0ff60ac0c42 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -460,11 +460,11 @@ endif quiet_cmd_link_multi-m = LD [M] $@ cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(filter %.o,$^) -$(multi-used-m): FORCE +$(modules-multi): FORCE $(call if_changed,link_multi-m) -$(call multi_depend, $(multi-used-m), .o, -objs -y -m) +$(call multi_depend, $(modules-multi), .o, -objs -y -m) -targets += $(multi-used-m) +targets += $(modules-multi) targets := $(filter-out $(PHONY), $(targets)) # Add intermediate targets: diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 0a540599823e..e503f12e8e9c 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -41,10 +41,13 @@ obj-m := $(filter-out %/, $(obj-m)) # Subdirectories we need to descend into subdir-ym := $(sort $(subdir-y) $(subdir-m)) -# If $(foo-objs), $(foo-y), $(foo-m), or $(foo-) exists, foo.o is a composite object -multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-))), $(m)))) -multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)) $($(m:.o=-))), $(m)))) -multi-used := $(multi-used-y) $(multi-used-m) +# If $(foo-objs), $(foo-y), $(foo-m), or $(foo-) exists, foo is multi-used +multi-used-y := $(sort $(foreach m, $(patsubst %.o,%,$(obj-y)), $(if $(strip $($(m)-objs) $($(m)-y) $($(m)-)), $(m)))) +multi-used-m := $(sort $(foreach m, $(patsubst %.o,%,$(obj-m)), $(if $(strip $($(m)-objs) $($(m)-y) $($(m)-m) $($(m)-)), $(m)))) + +modules-multi := $(addsuffix .o, $(multi-used-m)) + +multi-used := $(multi-used-y) $(multi-used-m) # $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to # tell kbuild to descend @@ -90,14 +93,14 @@ lib-y := $(addprefix $(obj)/,$(lib-y)) subdir-obj-y := $(addprefix $(obj)/,$(subdir-obj-y)) real-obj-y := $(addprefix $(obj)/,$(real-obj-y)) real-obj-m := $(addprefix $(obj)/,$(real-obj-m)) -multi-used-m := $(addprefix $(obj)/,$(multi-used-m)) +modules-multi := $(addprefix $(obj)/,$(modules-multi)) subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) # Finds the multi-part object the current object will be linked into. # If the object belongs to two or more multi-part objects, all of them are # concatenated with a colon separator. modname-multi = $(subst $(space),:,$(sort $(foreach m,$(multi-used),\ - $(if $(filter $*.o, $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$(m:.o=))))) + $(if $(filter $*.o, $($(m)-objs) $($(m)-y) $($(m)-m)),$(m))))) modname = $(if $(modname-multi),$(modname-multi),$(basetarget))