From patchwork Tue Aug 6 06:39:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 170627 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp5270463ile; Mon, 5 Aug 2019 23:40:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqx69hNYisOngX3WceeiJvcyOnnzEtx6W9Mm9UKFnrvPsTaXAriV0QntFolxW6ZRYfqC/LMI X-Received: by 2002:a62:3c3:: with SMTP id 186mr2059901pfd.21.1565073624534; Mon, 05 Aug 2019 23:40:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565073624; cv=none; d=google.com; s=arc-20160816; b=Nf15ITxh/M98x+byv0/5OexXdfq6E8nZ7jFePv1J6jHW2JKBYVQd+shyM2ujIVgZF3 saEDi/ddcDkNF5F4KDa8vH0AqgxZ7Q6DCWYL7p7EqfPQSlhuvxU0qKh+idVxKsIdtAm/ d5LRU+r5L1DiKdH1Z3fY3aoREqZuAH0LXlW3K/tKmKDExsAOrSbi1RIS3wAMW2s7Eq5g hvxcZb++k3Ruum5/t1Z59ICg2uakpw/0s0q58NRV/LguXzl0qao/tISojQLq01KlciZR vs/vN1Rrb3orjShZdCjB/LABzahoj8xMTRVg0Z7qod8TrXxKJ0zmbAubEsgrAucW3/hP 55rw== 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=JlCMJ6teUrNcdw5nNAsjPH8LD60KsqUoMPPEo50W3xc=; b=zKMNYBnioBozxEEwaRh1gARiqrX3ckhWKjfA4GddF1nlfaZmkhRPJ6IR+QmPlE8ru9 z2zqy0oXQFCgM1+wVzqaFIl1hsyJGA0NzowWHPuHbt0d7a7WnPUz3kIPWqtG9dhWCvbf EvnLkOyd8a5ndJxReeJyG5sLzYOgWJAj5uZQe0fNyn9SWisnV41Ln8ooAd7XonoNQMTC ttZ+h1tDWzdrTlJwrZdhwBPXlbJt7bdteUf5zrKgQ3RAedwxQu0VOo4jycfb1StosGZD MPGZAtFSZl8WIn2ooz0LWnX3XcIKwhfNF2iiCFYffdWjfSK6TXeLyoE5FPtmetz3FUtH LwkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=o38ZfvGh; 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 y7si46215084pgi.401.2019.08.05.23.40.24; Mon, 05 Aug 2019 23:40:24 -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=o38ZfvGh; 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 S1731882AbfHFGkX (ORCPT + 29 others); Tue, 6 Aug 2019 02:40:23 -0400 Received: from conuserg-12.nifty.com ([210.131.2.79]:39569 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731560AbfHFGkW (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 x766dO7o002982; Tue, 6 Aug 2019 15:39:26 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com x766dO7o002982 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1565073566; bh=JlCMJ6teUrNcdw5nNAsjPH8LD60KsqUoMPPEo50W3xc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o38ZfvGh/J6sdmxHNVHbtsTBc2XwPxzojhdjO4Tpd5Jc6Kzy3Zyr1LlhLCxVY+2f9 uk76CsF2MDxirJh84AVmMmt6NOth+0HBQPu5zFCIvUBB9oIDLxBAVuAbmyjDh7EzI1 3DsBEU6VC8lh+rnT/JTp0odTWLocGhmPr6h+S4phlAxrKXp32wW51UWyJkZMsKfTUE IlFNSH6XyHBqMuOWmUMKRl7IVl3vH4lNHWSeNApCXuk5fda/N4ooUM9ZJ7jVazWlVq JHln5DDcHshnn+BrPkCbnohTiM/CkKCA1sdMz+B2qsu7/29jB2Ov327e/YC8obEZ3K JOX12HqWukreA== 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 1/5] kbuild: treat an object as multi-used when $(foo-) is set Date: Tue, 6 Aug 2019 15:39:19 +0900 Message-Id: <20190806063923.1266-2-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 Currently, Kbuild treats an object as multi-used when any of $(foo-objs), $(foo-y), $(foo-m) is set. It makes more sense to check $(foo-) as well. In the context of foo-$(CONFIG_FOO_FEATURE1), CONFIG_FOO_FEATURE1 could be unset. Signed-off-by: Masahiro Yamada --- scripts/Makefile.lib | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 41c50f9461e5..0a540599823e 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -41,9 +41,9 @@ obj-m := $(filter-out %/, $(obj-m)) # Subdirectories we need to descend into subdir-ym := $(sort $(subdir-y) $(subdir-m)) -# if $(foo-objs), $(foo-y), or $(foo-m) exists, foo.o is a composite object -multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m)))) -multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))), $(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) # $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to @@ -52,8 +52,8 @@ subdir-obj-y := $(filter %/built-in.a, $(obj-y)) # Replace multi-part objects by their individual parts, # including built-in.a from subdirectories -real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) -real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m))) +real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) +real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m))) # DTB # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built 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)) From patchwork Tue Aug 6 06:39:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 170628 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp5270536ile; Mon, 5 Aug 2019 23:40:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqwSp9pg+hix65tAIe88pcQpqoMgYyvDKiqV44SfEFKCmftwrOBcs6f0wDJYou7AF7TttjOG X-Received: by 2002:a63:607:: with SMTP id 7mr1631991pgg.240.1565073628096; Mon, 05 Aug 2019 23:40:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565073628; cv=none; d=google.com; s=arc-20160816; b=VQD3Rjdt3yV5hYnoA/k5VOGha6sPfqBCub3aVlxTdTfK0MietxzD846zTKeCGPO9Qo 8v8o7Hl4zR23oF0GMo6WNSe3rTrXwhSgmJ9yRJ+0rsf/JlrkOLT+DtZV239zkU/TZx9u Bj4MHxdJ+aV2LEOirLLMJa6eCbsNEFqDh4xm92vF1vBblcL8+uVQ7BducrWb/OkpV1p1 ASooPQ+U+8Ds2HzPT/duLmykFu+bUO22jeU0dgBX6Wyh9jNOB+N/DV3Sak9X2TvVSTr5 WhF650avxCfvB1cq4K6UrrHn3uXsXwOl8u1iuYTdbhYosrOt4RUaBG7bQTL24rUxOZca CWAQ== 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=sw9gOrsRe1Xt1eVzCXiD4YS6wfm2vzRin5darkdpJ1A=; b=fvhvqNv4lTsTluHQUb06ONfck/eQvYvpNQZzYXEStxPgCWw2ZJHtGlyDjTAAsNglYX QbRucA1oaHAyqgf3dG8CbhEaKocecPm/4WBn7KWNq6zs0WaH/4tyhHRs7UBWg8JkP4c6 GcJPZvJgmqUDMZtjsSpF4LEnxyUnw61XSJ0LLZnuYHTyJb2Zoi7GKDU9lyGcqzl4gkb6 PsUGqleG3fq3vK9bb8kXCYPZN3kRib3exNW5TYIfs+kaTjcpx/CTFrrw1jJtfLZN0MfM EY++cH5EIuMUsNFFsJ8DdgUd2dOD1PFd0wZQ41rADeTdIYjyP6cXPCDeBl0ZUR0zF0wn KmzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Xo7yNbFF; 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 y7si46215084pgi.401.2019.08.05.23.40.27; Mon, 05 Aug 2019 23:40:28 -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=Xo7yNbFF; 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 S1731940AbfHFGk1 (ORCPT + 29 others); Tue, 6 Aug 2019 02:40:27 -0400 Received: from conuserg-12.nifty.com ([210.131.2.79]:39558 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731576AbfHFGkX (ORCPT ); Tue, 6 Aug 2019 02:40:23 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-12.nifty.com with ESMTP id x766dO7q002982; Tue, 6 Aug 2019 15:39:27 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com x766dO7q002982 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1565073568; bh=sw9gOrsRe1Xt1eVzCXiD4YS6wfm2vzRin5darkdpJ1A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xo7yNbFFf7vTcp5uurMMAUy6l1kcnjkSAIb7IRnyaHiiyAlAcXxZ3cyxMRIfAF3IA RJFKw5LdIswvKCFYjwKmz9RHp15n+CtAag32hNQlL5eiKbQKP59yVdqQefLpzLnsBF 7+WEC4FrwSP86RG8SrayMPhEWuED4gZLTGefyiXp+Blnnr6roMqkmKeufvt0/eZ5+/ IXrQ/CPghsEJrEJoVgp3IH3wNvtsG+cHXqxylzZyT6FP1jPzUfG/dVubZ37i/9KlhW pHXreWssCbxLY4DZEzBl/6Mg57IBK5JdSPtXlRzBRD4m6CZ02CkgdgA+qjNtiNZZTS sTT+Z9Yk9Drlg== 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 3/5] kbuild: rename cmd_ar_builtin to cmd_ar_no_sym Date: Tue, 6 Aug 2019 15:39:21 +0900 Message-Id: <20190806063923.1266-4-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 In the next commit, I will re-use this for thin-archives of objects liked into modules. Rename cmd_ar_builtin to a more generic cmd_ar_no_sym. (cmd_ar is already defined in scripts/Makefile.lib) I removed unneeded ifdef builtin-target. No functional change intended. Signed-off-by: Masahiro Yamada --- scripts/Makefile.build | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/scripts/Makefile.build b/scripts/Makefile.build index b0ff60ac0c42..68622cbdfda5 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -404,16 +404,14 @@ $(sort $(subdir-obj-y)): $(subdir-ym) ; # # Rule to compile a set of .o files into one .a file (without symbol table) # -ifdef builtin-target -quiet_cmd_ar_builtin = AR $@ - cmd_ar_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(real-prereqs) +quiet_cmd_ar_no_sym = AR $@ + cmd_ar_no_sym = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(real-prereqs) $(builtin-target): $(real-obj-y) FORCE - $(call if_changed,ar_builtin) + $(call if_changed,ar_no_sym) targets += $(builtin-target) -endif # builtin-target # # Rule to create modules.order file From patchwork Tue Aug 6 06:39:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 170629 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp5270664ile; Mon, 5 Aug 2019 23:40:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwJ7wRVTq6blJqjyAIQ0CuGlwjlGC4OI0cecJ3p/ascUxNb0p+YdNYD9E4mACg5x7RmMd1g X-Received: by 2002:aa7:8502:: with SMTP id v2mr2033524pfn.98.1565073635128; Mon, 05 Aug 2019 23:40:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565073635; cv=none; d=google.com; s=arc-20160816; b=c47rrLSH6A9xyyVf9N6FclUzAVP4Jqd4HLvy1GEo6kkv+a/0FDI8ioc6k3fDVAcicY ldFXLOC8ZtF8SeCDS423zXKMPkAJEVVZIWIzWBq0aqOeSAUO/3V6vMK1G379jq+6XbEr WoyumdMBy/2xJuYE7cyPgL1tAUbZjvtpxOzu1FjKzWz3kCbXMGsY3XVrv4Y7lVNIMp2q AtaKaUQsHsLEpc7MTh0pTO4jiGOuGbVE4F0HZ7XLvfADAv0z6wsOmkTlD+HuXqV4gP+O yV7eGw0L5ANkLDwHZmchRn/pJs7/mevyvVVXKco1ufWLATF0cohIs2fD+jL4MUU8F30U OOhg== 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=5gUHgNcICorO6cqCrPrkJFv4onerI26ClAdRbUjrZRs=; b=R496VEAluuUpmw+Q5O7xv5NEvxR9omOKyZDVrEtQu76QRrA5VDDcJyo5GFk+VcRczP 5WZ8EB3LVrkJlIN7imJbU38MSeEyzstzD0pvStfAMI1HjHlESoZ3kXNEBcRGIfzWOpUQ AOHCLFDFGI3nuN3rlB3R2Eu3EDXDayoDJhUSSgIsTj7gXIqYwlct8p8+3WrTeQJqIoCb iL93k4kybxrxJK1cms7CFrqZgEVMwMEp/AnIWv3Fic9EvtRJdKgIUG12gbqaTsDUMdNN u6vlFlll6JoEy5aM5fVlw78Qgqv1K1clrnLNYWYrVHcqd59qNbjLivfQCtepo2ZJsyTC QBLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=c8oYM8MZ; 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 l70si5747011pgd.363.2019.08.05.23.40.34; Mon, 05 Aug 2019 23:40:35 -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=c8oYM8MZ; 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 S1731928AbfHFGk0 (ORCPT + 29 others); Tue, 6 Aug 2019 02:40:26 -0400 Received: from conuserg-12.nifty.com ([210.131.2.79]:39559 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731644AbfHFGkX (ORCPT ); Tue, 6 Aug 2019 02:40:23 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-12.nifty.com with ESMTP id x766dO7r002982; Tue, 6 Aug 2019 15:39:28 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com x766dO7r002982 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1565073569; bh=5gUHgNcICorO6cqCrPrkJFv4onerI26ClAdRbUjrZRs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c8oYM8MZ1/hIlfUSZ+9uXKDDwIbePv/xndaZbSbK/gWGXDMbGWBPUYWFg2oENKDuN cyiGBzbpUhfPrO5l+yRb0JfLyPDUbTdgUJIT+X5yrKPjpuR7/IXKmBrXU8omiTSIPZ r++sKgPANrzeqCMhLSwzCo99ZK2a/Ibq2uuwmiFBONi4mdA92XdgShVN9ruBdK1RJf 5DcypP7JOgomtZ6NUreCLKEnYPbAzMU0Qp9nmEsGHQkmyyZLMTBqH6cTew4N9vTKNl KX8qrTzHDf2/eGfvHsjG4F/+3tHcjYHqe1nh7hC+U51lfiGIgoN1/Ubd9Oui57a/RK //H8yTyBEk3AQ== 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 4/5] kbuild: support composite objects spanning across multiple Makefiles Date: Tue, 6 Aug 2019 15:39:22 +0900 Message-Id: <20190806063923.1266-5-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 For a module that consists of multiple objects, the Makefile typically looks like this: obj-$(CONFIG_FOO) += foo.o foo-y += foo-main.o foo-$(CONFIG_FOO_FEATURE1) += foo-feature1.o foo-$(CONFIG_FOO_FEATURE2) += foo-feature2.o Since other Makefiles do not understand foo-y, all modules must have a flat structure. As Documentation/kbuild/modules.rst section 4.3 says, Kbuild can handle files that are spread over several sub-directories, but the top Makefile of a module must specify everything. Some modules (drm, fs, etc.) have grown quite big, and the current limitation is getting more and more painful. This commit allows modules to recurse into sub-directories. The child Makefiles inherit composite object names from the parent. TODO: Add documentation for this syntax. Signed-off-by: Masahiro Yamada --- scripts/Makefile.build | 27 ++++++++++++++++------ scripts/Makefile.lib | 51 +++++++++++++++++++++++++----------------- 2 files changed, 51 insertions(+), 27 deletions(-) -- 2.17.1 diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 68622cbdfda5..cea2bb25787a 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -70,7 +70,7 @@ endif mod-targets := $(patsubst %.o, %.mod, $(obj-m)) __build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ - $(if $(KBUILD_MODULES),$(obj-m) $(mod-targets) $(modorder-target)) \ + $(if $(KBUILD_MODULES),$(obj-m) $(ar-m) $(mod-targets) $(modorder-target)) \ $(subdir-ym) $(always) @: @@ -274,7 +274,10 @@ $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE $(call if_changed_rule,cc_o_c) cmd_mod = { \ - echo $(if $($*-objs)$($*-y)$($*-m), $(addprefix $(obj)/, $($*-objs) $($*-y) $($*-m)), $(@:.mod=.o)); \ + echo $(if $($*-objs)$($*-y)$($*-m), \ + $(foreach m, $(addprefix $(obj)/, $($*-objs) $($*-y) $($*-m)), \ + $(if $(filter %.a, $(m)), $(shell $(AR) t $(m)), $(m))), \ + $(@:.mod=.o)); \ $(cmd_undef_syms); \ } > $@ @@ -399,19 +402,24 @@ $(obj)/%.asn1.c $(obj)/%.asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler # --------------------------------------------------------------------------- # To build objects in subdirs, we need to descend into the directories -$(sort $(subdir-obj-y)): $(subdir-ym) ; +$(sort $(subdir-obj-y) $(subdir-ar-m)): $(subdir-ym); # # Rule to compile a set of .o files into one .a file (without symbol table) # -quiet_cmd_ar_no_sym = AR $@ +quiet_cmd_ar_no_sym = AR $(quiet_modtag) $@ cmd_ar_no_sym = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(real-prereqs) $(builtin-target): $(real-obj-y) FORCE $(call if_changed,ar_no_sym) -targets += $(builtin-target) +$(ar-m): part-of-module := y +$(ar-m): FORCE + $(call if_changed,ar_no_sym) +$(call multi_depend, $(ar-m), .a, -objs -y -m) + +targets += $(builtin-target) $(ar-m) # # Rule to create modules.order file @@ -456,7 +464,7 @@ endif # module is turned into a multi object module, $^ will contain header file # dependencies recorded in the .*.cmd file. quiet_cmd_link_multi-m = LD [M] $@ - cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(filter %.o,$^) + cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ --whole-archive $(filter %.o %a,$^) --no-whole-archive $(modules-multi): FORCE $(call if_changed,link_multi-m) @@ -485,7 +493,12 @@ targets += $(call intermediate_targets, .asn1.o, .asn1.c .asn1.h) \ PHONY += $(subdir-ym) $(subdir-ym): - $(Q)$(MAKE) $(build)=$@ need-builtin=$(if $(findstring $@,$(subdir-obj-y)),1) + $(MAKE) $(build)=$@ \ + need-builtin=$(if $(filter $@/built-in.a,$(subdir-obj-y)),1) \ + multi-used2-y="$(sort $(foreach m, $(subdir-multi-used-y), \ + $(if $(filter $@/,$(dir $(m))), $(notdir $m))))" \ + multi-used2-m="$(sort $(foreach m, $(subdir-multi-used-m), \ + $(if $(filter $@/,$(dir $(m))), $(notdir $m))))" # Add FORCE to the prequisites of a target to force it to be always rebuilt. # --------------------------------------------------------------------------- diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index e503f12e8e9c..e4e4ed869cad 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -25,38 +25,44 @@ lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m))) # and -m subdirs. Just put -y's first. modorder := $(patsubst %/,%/modules.order, $(filter %/, $(obj-y)) $(obj-m:.o=.ko)) -# Handle objects in subdirs -# --------------------------------------------------------------------------- -# o if we encounter foo/ in $(obj-y), replace it by foo/built-in.a -# and add the directory to the list of dirs to descend into: $(subdir-y) -# o if we encounter foo/ in $(obj-m), remove it from $(obj-m) -# and add the directory to the list of dirs to descend into: $(subdir-m) -__subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y))) -subdir-y += $(__subdir-y) -__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m))) -subdir-m += $(__subdir-m) -obj-y := $(patsubst %/, %/built-in.a, $(obj-y)) -obj-m := $(filter-out %/, $(obj-m)) + +# Replace multi-part objects by their individual parts, +# including built-in.a from subdirectories +real-obj-y := $(foreach m, $(obj-y),$(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-))), $($(m:.o=-objs)) $($(m:.o=-y)), $(m))) +real-obj-y += $(foreach m, $(multi-used2-y),$(if $(strip $($(m)-objs) $($(m)-y) $($(m)-)),$($(m)-objs) $($(m)-y))) +real-obj-m := $(foreach m, $(obj-m),$(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)), $(m))) +real-obj-m += $(foreach m, $(multi-used2-m),$(if $(strip $($(m)-objs) $($(m)-y) $($(m)-m) $($(m)-)), $($(m)-objs) $($(m)-y) $($(m)-m))) + +# all objects and thin archives combined into built-in.a in this directory # Subdirectories we need to descend into -subdir-ym := $(sort $(subdir-y) $(subdir-m)) +subdir-ym := $(sort $(subdir-y) $(subdir-m) \ + $(patsubst %/,%,$(filter %/,$(real-obj-y) $(real-obj-m)))) + +real-obj-y := $(patsubst %/, %/built-in.a, $(real-obj-y)) +subdir-obj-y := $(filter %/built-in.a, $(real-obj-y)) + +obj-m := $(filter-out %/, $(obj-m)) +real-obj-m := $(filter-out %/, $(real-obj-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)) +ar-m := $(addsuffix .a, $(multi-used2-m)) + +multi-used-y += $(multi-used2-y) +multi-used-m += $(multi-used2-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 -subdir-obj-y := $(filter %/built-in.a, $(obj-y)) +# multi-used (composite) objects propagated to sub-directories +subdir-multi-used-y := $(foreach m, $(multi-used-y), $(addsuffix $(m), $(filter %/, $($(m)-objs) $($(m)-y)))) +subdir-multi-used-m := $(foreach m, $(multi-used-m), $(addsuffix $(m), $(filter %/, $($(m)-objs) $($(m)-y) $($(m)-m)))) -# Replace multi-part objects by their individual parts, -# including built-in.a from subdirectories -real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) -real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m))) +$(foreach m, $(patsubst %.o,%,$(multi-used-m) $(multi-used2-m)), $(foreach s, -objs -y -m, \ + $(eval $(m)$(s) := $(patsubst %/,%/$(m).a, $($(m)$(s)))))) # DTB # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built @@ -95,6 +101,11 @@ real-obj-y := $(addprefix $(obj)/,$(real-obj-y)) real-obj-m := $(addprefix $(obj)/,$(real-obj-m)) modules-multi := $(addprefix $(obj)/,$(modules-multi)) subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) +ar-m := $(addprefix $(obj)/,$(ar-m)) +subdir-multi-used-y := $(addprefix $(obj)/,$(subdir-multi-used-y)) +subdir-multi-used-m := $(addprefix $(obj)/,$(subdir-multi-used-m)) + +subdir-ar-m := $(addsuffix .a, $(subdir-multi-used-m)) # 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 From patchwork Tue Aug 6 06:39:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 170632 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp5270911ile; Mon, 5 Aug 2019 23:40:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqzEAGAP97AD4usSYlenVWfcsbOe57iAoQPhlXPlUf9e7B1TuXDxvBeJgDD2wJzWBGvcJ2Qe X-Received: by 2002:a65:6114:: with SMTP id z20mr1648432pgu.141.1565073648085; Mon, 05 Aug 2019 23:40:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565073648; cv=none; d=google.com; s=arc-20160816; b=ElwN2dlZLFuvnqAGuV7kKZ6nHnLBiT1sc258ls/a4Br+oCD0dX7Y1SJe4m5csgWY0y +wge5APqY7+LoxS0Nblzo0OKwShfh3zeedJ1+4cCrxEccmWAQKjicMlItoDcST3zqCN/ c+d/B1XNUiEcDvHYi9Pirmq9NV3KD3qUret87fTtZyn4V+sYncc4/sn3XFc1KfrlDkFP EWMMXbtTIVxZYIP3WmOzYQ77fLT8sFpJ6ENIU1TwT3B2wAudCdCeSuo17M/5Qzjmy5Ve iUzYvaEy+PxQ+EhSUjrI6f3RPgwzutgFanD7ig8n7CkQ5QlZDi4oYzEAG9s08nLSVvSY 2WnQ== 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=NHKB+RcwJX9tNIjEMmZ3uK4qIjZTelU5Onq9zKuQPU8=; b=n1yoznIB9d8xqc7aIKHUpBQGj+fnzFAUz7/gbQouKKK1W1HK/G2FUdui2TwuI9slU7 YCPTqVnS+Jxuv7BbXwn+c70IeIemh6ORHt8mGD/Eas4KjC7OWmWN6ppkmIaLoGXxBEa6 PTy+O9PZOkh8UTHi6G+x7VLCkPQZ6gGFU6cft2nqKPqA6vDzHWVbHlwAjnNHrMggrC9F 9Tol0ha6IwR2cLdfF7Txve8iLSIQeAncZo08VyEY/z2bue29ymxcsldM4NtkeJbnLu80 C5EYXeQVVW5G7Prgz3RSlYR1HFkE07SUbJQuCyiNjJwbQVArFIjaAxYUUF0M948GVCtt Zd7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=1czhhUjZ; 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 r17si45786899pgg.155.2019.08.05.23.40.47; Mon, 05 Aug 2019 23:40:48 -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=1czhhUjZ; 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 S1732001AbfHFGkq (ORCPT + 29 others); Tue, 6 Aug 2019 02:40:46 -0400 Received: from conuserg-12.nifty.com ([210.131.2.79]:40143 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731976AbfHFGko (ORCPT ); Tue, 6 Aug 2019 02:40:44 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-12.nifty.com with ESMTP id x766dO7s002982; Tue, 6 Aug 2019 15:39:29 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com x766dO7s002982 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1565073570; bh=NHKB+RcwJX9tNIjEMmZ3uK4qIjZTelU5Onq9zKuQPU8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1czhhUjZIDKICC0g7fyRzg51PmtWgjB1i4MvtPqab9fEajQ0lRcfnksDCFerqRlph unCwjFQ775zT5+tV/VfY1ipMRAEYuRVi0pK4zKLDFQb07BGtD5Tva6Fs00h7l65Hzr FM9aw191ln8QtwH187M1/MTUVa19G55lWLnKx5fSuY3CT8yIQQ1585eCOAjfTpghyy 0hMngY9kEM8RhPHDOmMivWKUrpwtTFTpsCMLTRgtEiG3NioBL488ptfT157wmZMumX PVqpn6K/khWACOLaK8gXI2y61aX+YBlyY+4kCYlTIjavosYIwL900eBBTY7/JrbSSI fuOSvgLZu+Gxg== 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 , Daniel Vetter , David Airlie , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Zhenyu Wang , Zhi Wang , dri-devel@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/5] drm: i915: hierachize Makefiles Date: Tue, 6 Aug 2019 15:39:23 +0900 Message-Id: <20190806063923.1266-6-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 You can use the -y syntax in sub-directory Makefiles of modules. Demonstrate how it works. PLEASE DO NOT APPLY FOR NOW: this is only for comments. Signed-off-by: Masahiro Yamada --- drivers/gpu/drm/i915/Makefile | 126 ++------------------ drivers/gpu/drm/i915/display/Makefile | 64 ++++++++++ drivers/gpu/drm/i915/gem/Makefile | 27 +++++ drivers/gpu/drm/i915/gem/selftests/Makefile | 3 + drivers/gpu/drm/i915/gt/Makefile | 16 +++ drivers/gpu/drm/i915/gvt/Makefile | 32 ++++- drivers/gpu/drm/i915/selftests/Makefile | 9 ++ 7 files changed, 153 insertions(+), 124 deletions(-) create mode 100644 drivers/gpu/drm/i915/gem/selftests/Makefile create mode 100644 drivers/gpu/drm/i915/selftests/Makefile -- 2.17.1 diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile index 8cace65f50ce..6319c670bfb8 100644 --- a/drivers/gpu/drm/i915/Makefile +++ b/drivers/gpu/drm/i915/Makefile @@ -63,56 +63,16 @@ i915-y += \ i915_user_extensions.o i915-$(CONFIG_COMPAT) += i915_ioc32.o -i915-$(CONFIG_DEBUG_FS) += i915_debugfs.o display/intel_pipe_crc.o +i915-$(CONFIG_DEBUG_FS) += i915_debugfs.o i915-$(CONFIG_PERF_EVENTS) += i915_pmu.o # "Graphics Technology" (aka we talk to the gpu) -obj-y += gt/ -gt-y += \ - gt/intel_breadcrumbs.o \ - gt/intel_context.o \ - gt/intel_engine_cs.o \ - gt/intel_engine_pm.o \ - gt/intel_gt_pm.o \ - gt/intel_hangcheck.o \ - gt/intel_lrc.o \ - gt/intel_reset.o \ - gt/intel_ringbuffer.o \ - gt/intel_mocs.o \ - gt/intel_sseu.o \ - gt/intel_workarounds.o -gt-$(CONFIG_DRM_I915_SELFTEST) += \ - gt/mock_engine.o -i915-y += $(gt-y) +i915-y += gt/ # GEM (Graphics Execution Management) code -obj-y += gem/ -gem-y += \ - gem/i915_gem_busy.o \ - gem/i915_gem_clflush.o \ - gem/i915_gem_client_blt.o \ - gem/i915_gem_context.o \ - gem/i915_gem_dmabuf.o \ - gem/i915_gem_domain.o \ - gem/i915_gem_execbuffer.o \ - gem/i915_gem_fence.o \ - gem/i915_gem_internal.o \ - gem/i915_gem_object.o \ - gem/i915_gem_object_blt.o \ - gem/i915_gem_mman.o \ - gem/i915_gem_pages.o \ - gem/i915_gem_phys.o \ - gem/i915_gem_pm.o \ - gem/i915_gem_shmem.o \ - gem/i915_gem_shrinker.o \ - gem/i915_gem_stolen.o \ - gem/i915_gem_throttle.o \ - gem/i915_gem_tiling.o \ - gem/i915_gem_userptr.o \ - gem/i915_gem_wait.o \ - gem/i915_gemfs.o +i915-y += gem/ + i915-y += \ - $(gem-y) \ i915_active.o \ i915_cmd_parser.o \ i915_gem_batch_pool.o \ @@ -148,78 +108,11 @@ i915-y += intel_renderstate_gen6.o \ intel_renderstate_gen8.o \ intel_renderstate_gen9.o -# modesetting core code -obj-y += display/ -i915-y += \ - display/intel_atomic.o \ - display/intel_atomic_plane.o \ - display/intel_audio.o \ - display/intel_bios.o \ - display/intel_bw.o \ - display/intel_cdclk.o \ - display/intel_color.o \ - display/intel_combo_phy.o \ - display/intel_connector.o \ - display/intel_display.o \ - display/intel_display_power.o \ - display/intel_dpio_phy.o \ - display/intel_dpll_mgr.o \ - display/intel_fbc.o \ - display/intel_fifo_underrun.o \ - display/intel_frontbuffer.o \ - display/intel_hdcp.o \ - display/intel_hotplug.o \ - display/intel_lpe_audio.o \ - display/intel_overlay.o \ - display/intel_psr.o \ - display/intel_quirks.o \ - display/intel_sprite.o -i915-$(CONFIG_ACPI) += \ - display/intel_acpi.o \ - display/intel_opregion.o -i915-$(CONFIG_DRM_FBDEV_EMULATION) += \ - display/intel_fbdev.o - -# modesetting output/encoder code -i915-y += \ - display/dvo_ch7017.o \ - display/dvo_ch7xxx.o \ - display/dvo_ivch.o \ - display/dvo_ns2501.o \ - display/dvo_sil164.o \ - display/dvo_tfp410.o \ - display/icl_dsi.o \ - display/intel_crt.o \ - display/intel_ddi.o \ - display/intel_dp.o \ - display/intel_dp_aux_backlight.o \ - display/intel_dp_link_training.o \ - display/intel_dp_mst.o \ - display/intel_dsi.o \ - display/intel_dsi_dcs_backlight.o \ - display/intel_dsi_vbt.o \ - display/intel_dvo.o \ - display/intel_gmbus.o \ - display/intel_hdmi.o \ - display/intel_lspcon.o \ - display/intel_lvds.o \ - display/intel_panel.o \ - display/intel_sdvo.o \ - display/intel_tv.o \ - display/intel_vdsc.o \ - display/vlv_dsi.o \ - display/vlv_dsi_pll.o +i915-y += display/ # Post-mortem debug and GPU hang state capture i915-$(CONFIG_DRM_I915_CAPTURE_ERROR) += i915_gpu_error.o -i915-$(CONFIG_DRM_I915_SELFTEST) += \ - gem/selftests/igt_gem_utils.o \ - selftests/i915_random.o \ - selftests/i915_selftest.o \ - selftests/igt_flush_test.o \ - selftests/igt_live_test.o \ - selftests/igt_reset.o \ - selftests/igt_spinner.o +i915-$(CONFIG_DRM_I915_SELFTEST) += selftests/ # virtual gpu code i915-y += i915_vgpu.o @@ -241,10 +134,7 @@ i915-y += i915_perf.o \ i915_oa_cnl.o \ i915_oa_icl.o -ifeq ($(CONFIG_DRM_I915_GVT),y) -i915-y += intel_gvt.o -include $(src)/gvt/Makefile -endif +i915-$(CONFIG_DRM_I915_GVT) += intel_gvt.o gvt/ obj-$(CONFIG_DRM_I915) += i915.o -obj-$(CONFIG_DRM_I915_GVT_KVMGT) += gvt/kvmgt.o +obj-$(CONFIG_DRM_I915_GVT_KVMGT) += gvt/ diff --git a/drivers/gpu/drm/i915/display/Makefile b/drivers/gpu/drm/i915/display/Makefile index 1c75b5c9790c..1fd26c5e68b5 100644 --- a/drivers/gpu/drm/i915/display/Makefile +++ b/drivers/gpu/drm/i915/display/Makefile @@ -1,2 +1,66 @@ # Extra header tests include $(src)/Makefile.header-test + +i915-$(CONFIG_DEBUG_FS) += \ + intel_pipe_crc.o + +# modesetting core code +i915-y += \ + intel_atomic.o \ + intel_atomic_plane.o \ + intel_audio.o \ + intel_bios.o \ + intel_bw.o \ + intel_cdclk.o \ + intel_color.o \ + intel_combo_phy.o \ + intel_connector.o \ + intel_display.o \ + intel_display_power.o \ + intel_dpio_phy.o \ + intel_dpll_mgr.o \ + intel_fbc.o \ + intel_fifo_underrun.o \ + intel_frontbuffer.o \ + intel_hdcp.o \ + intel_hotplug.o \ + intel_lpe_audio.o \ + intel_overlay.o \ + intel_psr.o \ + intel_quirks.o \ + intel_sprite.o +i915-$(CONFIG_ACPI) += \ + intel_acpi.o \ + intel_opregion.o +i915-$(CONFIG_DRM_FBDEV_EMULATION) += \ + intel_fbdev.o + +# modesetting output/encoder code +i915-y += \ + dvo_ch7017.o \ + dvo_ch7xxx.o \ + dvo_ivch.o \ + dvo_ns2501.o \ + dvo_sil164.o \ + dvo_tfp410.o \ + icl_dsi.o \ + intel_crt.o \ + intel_ddi.o \ + intel_dp.o \ + intel_dp_aux_backlight.o \ + intel_dp_link_training.o \ + intel_dp_mst.o \ + intel_dsi.o \ + intel_dsi_dcs_backlight.o \ + intel_dsi_vbt.o \ + intel_dvo.o \ + intel_gmbus.o \ + intel_hdmi.o \ + intel_lspcon.o \ + intel_lvds.o \ + intel_panel.o \ + intel_sdvo.o \ + intel_tv.o \ + intel_vdsc.o \ + vlv_dsi.o \ + vlv_dsi_pll.o diff --git a/drivers/gpu/drm/i915/gem/Makefile b/drivers/gpu/drm/i915/gem/Makefile index 07e7b8b840ea..1d9da1287bef 100644 --- a/drivers/gpu/drm/i915/gem/Makefile +++ b/drivers/gpu/drm/i915/gem/Makefile @@ -1 +1,28 @@ include $(src)/Makefile.header-test # Extra header tests + +i915-y += \ + i915_gem_busy.o \ + i915_gem_clflush.o \ + i915_gem_client_blt.o \ + i915_gem_context.o \ + i915_gem_dmabuf.o \ + i915_gem_domain.o \ + i915_gem_execbuffer.o \ + i915_gem_fence.o \ + i915_gem_internal.o \ + i915_gem_object.o \ + i915_gem_object_blt.o \ + i915_gem_mman.o \ + i915_gem_pages.o \ + i915_gem_phys.o \ + i915_gem_pm.o \ + i915_gem_shmem.o \ + i915_gem_shrinker.o \ + i915_gem_stolen.o \ + i915_gem_throttle.o \ + i915_gem_tiling.o \ + i915_gem_userptr.o \ + i915_gem_wait.o \ + i915_gemfs.o + +i915-$(CONFIG_DRM_I915_SELFTEST) += selftests/ diff --git a/drivers/gpu/drm/i915/gem/selftests/Makefile b/drivers/gpu/drm/i915/gem/selftests/Makefile new file mode 100644 index 000000000000..80f96f51b623 --- /dev/null +++ b/drivers/gpu/drm/i915/gem/selftests/Makefile @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0-only + +i915-y += igt_gem_utils.o diff --git a/drivers/gpu/drm/i915/gt/Makefile b/drivers/gpu/drm/i915/gt/Makefile index 1c75b5c9790c..1a3401e7dde5 100644 --- a/drivers/gpu/drm/i915/gt/Makefile +++ b/drivers/gpu/drm/i915/gt/Makefile @@ -1,2 +1,18 @@ # Extra header tests include $(src)/Makefile.header-test + +i915-y += \ + intel_breadcrumbs.o \ + intel_context.o \ + intel_engine_cs.o \ + intel_engine_pm.o \ + intel_gt_pm.o \ + intel_hangcheck.o \ + intel_lrc.o \ + intel_reset.o \ + intel_ringbuffer.o \ + intel_mocs.o \ + intel_sseu.o \ + intel_workarounds.o +i915-$(CONFIG_DRM_I915_SELFTEST) += \ + mock_engine.o diff --git a/drivers/gpu/drm/i915/gvt/Makefile b/drivers/gpu/drm/i915/gvt/Makefile index ea8324abc784..2bd07b7935d3 100644 --- a/drivers/gpu/drm/i915/gvt/Makefile +++ b/drivers/gpu/drm/i915/gvt/Makefile @@ -1,9 +1,29 @@ # SPDX-License-Identifier: GPL-2.0 -GVT_DIR := gvt -GVT_SOURCE := gvt.o aperture_gm.o handlers.o vgpu.o trace_points.o firmware.o \ - interrupt.o gtt.o cfg_space.o opregion.o mmio.o display.o edid.o \ - execlist.o scheduler.o sched_policy.o mmio_context.o cmd_parser.o debugfs.o \ - fb_decoder.o dmabuf.o page_track.o ccflags-y += -I $(srctree)/$(src) -I $(srctree)/$(src)/$(GVT_DIR)/ -i915-y += $(addprefix $(GVT_DIR)/, $(GVT_SOURCE)) + +i915-y += \ + gvt.o \ + aperture_gm.o \ + handlers.o \ + vgpu.o \ + trace_points.o \ + firmware.o \ + interrupt.o \ + gtt.o \ + cfg_space.o \ + opregion.o \ + mmio.o \ + display.o \ + edid.o \ + execlist.o \ + scheduler.o \ + sched_policy.o \ + mmio_context.o \ + cmd_parser.o \ + debugfs.o \ + fb_decoder.o \ + dmabuf.o \ + page_track.o + +obj-$(CONFIG_DRM_I915_GVT_KVMGT) += kvmgt.o diff --git a/drivers/gpu/drm/i915/selftests/Makefile b/drivers/gpu/drm/i915/selftests/Makefile new file mode 100644 index 000000000000..19ca8e7b3b80 --- /dev/null +++ b/drivers/gpu/drm/i915/selftests/Makefile @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0-only + +i915-y += \ + i915_random.o \ + i915_selftest.o \ + igt_flush_test.o \ + igt_live_test.o \ + igt_reset.o \ + igt_spinner.o