From patchwork Fri May 22 01:59:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11564329 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D0C2E90 for ; Fri, 22 May 2020 02:00:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AE8032072C for ; Fri, 22 May 2020 02:00:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590112845; bh=Y3P+dM0vde7SETgnVBpoe+YAhi4T5RpYnBP5lMtPM1w=; h=From:To:Cc:Subject:Date:List-ID:From; b=UpV73c6Y8Gf1jrJogzaeY4MwqDIswN+cY+SFMG2rrsEyQcDptqhZQ1UeXV0GDl8tp kpH+TCU/dKe4UqBvZ+LZ5RkPDUGtOx7sBRmBLY0/suyC40YgjXc+CpKAvWBcdSGWPt CdFVJEsBwhv/5E0K0RTN+1xZ7XAFOotRyM2ok6E8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727770AbgEVCA1 (ORCPT ); Thu, 21 May 2020 22:00:27 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:37241 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726940AbgEVCA1 (ORCPT ); Thu, 21 May 2020 22:00:27 -0400 Received: from oscar.flets-west.jp (softbank126090202047.bbtec.net [126.90.202.47]) (authenticated) by conuserg-10.nifty.com with ESMTP id 04M205UX009585; Fri, 22 May 2020 11:00:05 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com 04M205UX009585 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1590112808; bh=p68P5aztaSnVFKazuy1uvMsF2Jqe9k7v6DqDJgghFkw=; h=From:To:Cc:Subject:Date:From; b=xvfyE3QrXaukpL6qiDqUhwERD0uByfY7b4QEhBM0hOxuB3az0SVFKds9IEi+D3sYY nT3Tjt0F6eP3cK95/umJQye0pwczlNer+teeF2XGVLDDTIzeGeQQ5MJV4jCeEcdriA QXZOC8+l65LD5ocQVJzHRqZOK/LfxEAuySXwCZ+DyX4LxjV1WlUhRuuSZs3r0fU8OW 3lZPybxoO1ntBETAyUW2b5aHaPL7WY2zslzQrJewiC4fuU66RJRJg1rf/dvgcgaUYf /5n7zUb4g9dJM007ifmz7uodeVX0XiDCElMmc28qAd7M+qsA6HgYKch0dXOlgdnq0R 9fZ9lBjtAukMA== X-Nifty-SrcIP: [126.90.202.47] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 1/5] kbuild: remove ifdef builtin-target / lib-target Date: Fri, 22 May 2020 10:59:58 +0900 Message-Id: <20200522020002.504506-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org I do not see a good reason to add ifdef here. Signed-off-by: Masahiro Yamada --- scripts/Makefile.build | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 3665b1a0bc8e..9af88f4cacb8 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -384,16 +384,14 @@ $(obj)/%/built-in.a: $(obj)/% ; # # 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) cDPrST $@ $(real-prereqs) -$(builtin-target): $(real-obj-y) FORCE +$(obj)/built-in.a: $(real-obj-y) FORCE $(call if_changed,ar_builtin) targets += $(builtin-target) -endif # builtin-target # # Rule to create modules.order file @@ -408,15 +406,11 @@ $(modorder-target): $(subdir-ym) FORCE # # Rule to compile a set of .o files into one .a file (with symbol table) # -ifdef lib-target - -$(lib-target): $(lib-y) FORCE +$(obj)/lib.a: $(lib-y) FORCE $(call if_changed,ar) targets += $(lib-target) -endif - # NOTE: # Do not replace $(filter %.o,^) with $(real-prereqs). When a single object # module is turned into a multi object module, $^ will contain header file From patchwork Fri May 22 01:59:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11564321 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EDA451391 for ; Fri, 22 May 2020 02:00:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D48D42072C for ; Fri, 22 May 2020 02:00:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590112827; bh=SQmtTFuVd79cdfCcZYMqbZHmgdY3QmLi9wAgXaEyczc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=AoOphwBHb/AbblK5wSzbCL34JhyUbyrvIiB3p8qKLORdIFAWiIrQyRfwU2bolrSUZ vmchi7KJjG/Rqq7XK8hS5H2t0l27VOCkcG0yn/zN8rqnKtRCxpiUmS28AsOkvlhbgq 5GOb1TnnnqNDA5h1MzBgXcugKxDpGyvCw5vOPIew= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727109AbgEVCA1 (ORCPT ); Thu, 21 May 2020 22:00:27 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:37242 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726567AbgEVCA1 (ORCPT ); Thu, 21 May 2020 22:00:27 -0400 Received: from oscar.flets-west.jp (softbank126090202047.bbtec.net [126.90.202.47]) (authenticated) by conuserg-10.nifty.com with ESMTP id 04M205UY009585; Fri, 22 May 2020 11:00:09 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com 04M205UY009585 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1590112810; bh=dbhmn93DYcq1CwpbzW5tE0+OrtgaGmet5z0CDnvyloI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qgIScu1vmTas3XiGny1RBldzs77Tb9sXQ/0vDuHvptOROSDNeaxrDnaTFS7tGTAEq kUqOdbsqhT7mAcFm/CtJFOM7FNmFdXA4eykmnopV99SzWUqOVxXss+WF8duQWEYO6d FP3cXtRCsY6qCV/jpPfB6324TCH/G/t5HwqgzYZ4BENk3eUPZEBBBRMPohVH/k/brQ Or4PDgZwvp39G67E9APWYtmbq7O3HRMvVIxhZfLFuGjFEBQ/+r/dMyKp7roiz0OHGi aghZfFiAcIhKrXppUo6p26xfm1h8n3QBlApT3a/baaQ2mu00meHEWko6uPL5K00kxU c1wXJB2o1ttKQ== X-Nifty-SrcIP: [126.90.202.47] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 2/5] kbuild: clear KBUILD_MODULES in top Makefile if CONFIG_MODULES=n Date: Fri, 22 May 2020 10:59:59 +0900 Message-Id: <20200522020002.504506-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200522020002.504506-1-masahiroy@kernel.org> References: <20200522020002.504506-1-masahiroy@kernel.org> MIME-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Do not try to build any module-related artifacts when CONFIG_MODULES is disabled. Signed-off-by: Masahiro Yamada --- Makefile | 4 ++++ scripts/Makefile.build | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1f5bbfb31103..72eb55a36545 100644 --- a/Makefile +++ b/Makefile @@ -1724,6 +1724,10 @@ build-dirs := $(foreach d, $(build-dirs), \ endif +ifndef CONFIG_MODULES +KBUILD_MODULES := +endif + # Handle descending into subdirectories listed in $(build-dirs) # Preset locale variables to speed up the build process. Limit locale # tweaks to this spot to avoid wrong language settings when running diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 9af88f4cacb8..f46d25441804 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -77,7 +77,7 @@ ifdef need-builtin builtin-target := $(obj)/built-in.a endif -ifeq ($(CONFIG_MODULES)$(need-modorder),y1) +ifdef need-modorder modorder-target := $(obj)/modules.order endif From patchwork Fri May 22 02:00:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11564323 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9AD8A90 for ; Fri, 22 May 2020 02:00:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 84F3D20825 for ; Fri, 22 May 2020 02:00:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590112835; bh=uWz6LrHlZzcOscVDL1TvfihqQLUxn6MqNvgiN9ab3D0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ifr/B1EFM4aSLUveaMaNQ7SDZ87Kp8+xLzjz2ovfcSiQl+PNBM8VT/jMQOFEEJuc4 cRXKzOAnL57fr2SaCnzDHOj7LTniu995akdGe1Rbff77VEoaH4lttDquRJA5U50ZQW lCCexebNxfoE3roescEVco7dfTS1qEQofHMRlcOc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727818AbgEVCA2 (ORCPT ); Thu, 21 May 2020 22:00:28 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:37247 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727084AbgEVCA2 (ORCPT ); Thu, 21 May 2020 22:00:28 -0400 Received: from oscar.flets-west.jp (softbank126090202047.bbtec.net [126.90.202.47]) (authenticated) by conuserg-10.nifty.com with ESMTP id 04M205UZ009585; Fri, 22 May 2020 11:00:11 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com 04M205UZ009585 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1590112811; bh=eAVYzp2qo7mR9QsAot69dvdfW1xfxnf150PWTQtQKAM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hu49JF02RKIrGrDIo8TjQv1YBzNoVA40iBGPiB+KDSvhxHIPwQB1sX9+8bwOaCLAF V98Zf4w1ni744haIWqkAuJojJ8bvP+Ubs/icMh02rr8v1T/G+Qi5QUnrktrulQ1XHq wKnm80ZgDY91yD8f0qh6ev/GzWBiZXu6fwZPCp6gudJUs2v/QB2i3/apj2a7I86tXS N7coM1KliTqTEdbdfaCpbkasNAkRPHoX/rWHPGSX+bosaFd1zE4stl4z3h3gQiBPMG pTLBcZml1nXND2bHQF1U3sghf99LIq1mLy6obmuO0ljyDWwPEIu8vbI1n223WG9a+e HpmVt/hbJl3vg== X-Nifty-SrcIP: [126.90.202.47] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 3/5] kbuild: move subdir-obj-y to scripts/Makefile.build Date: Fri, 22 May 2020 11:00:00 +0900 Message-Id: <20200522020002.504506-3-masahiroy@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200522020002.504506-1-masahiroy@kernel.org> References: <20200522020002.504506-1-masahiroy@kernel.org> MIME-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Save $(addprefix ...) for subdir-obj-y. Signed-off-by: Masahiro Yamada --- scripts/Makefile.build | 2 ++ scripts/Makefile.lib | 5 ----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index f46d25441804..ee283efc1b45 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -69,6 +69,8 @@ endif # =========================================================================== +subdir-obj-y := $(filter %/built-in.a, $(real-obj-y)) + ifneq ($(strip $(lib-y) $(lib-m) $(lib-)),) lib-target := $(obj)/lib.a endif diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 52299d5dba28..a41a4bbd20e2 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -62,10 +62,6 @@ multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(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 -# tell kbuild to descend -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=-))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) @@ -91,7 +87,6 @@ targets := $(addprefix $(obj)/,$(targets)) modorder := $(addprefix $(obj)/,$(modorder)) obj-m := $(addprefix $(obj)/,$(obj-m)) 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)) From patchwork Fri May 22 02:00:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11564327 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8804B90 for ; Fri, 22 May 2020 02:00:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 707BC2072C for ; Fri, 22 May 2020 02:00:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590112843; bh=M/qsc8wu2R9iCG2I2q3dvOi0bwTIzV/zTs/BYllF8Tg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=cyHxL1vW9R2XH8ZIm3CbLTcNCKcM6ld3dkIvfWEjYB6Y1EAj8YU/6EFVZfZUsTxHs CpZi7dhr5Dgb4fYckkCVXNNzS181dCptHMFmBzRh0lhRif6qsGwa3fPGdB/Ei/pkbt eyJI1UF2bGJoOUkXCmeAJSUL2WRquJNrK1eVDBdI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727897AbgEVCAf (ORCPT ); Thu, 21 May 2020 22:00:35 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:37246 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727085AbgEVCA1 (ORCPT ); Thu, 21 May 2020 22:00:27 -0400 Received: from oscar.flets-west.jp (softbank126090202047.bbtec.net [126.90.202.47]) (authenticated) by conuserg-10.nifty.com with ESMTP id 04M205Ua009585; Fri, 22 May 2020 11:00:11 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com 04M205Ua009585 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1590112811; bh=56NMTqyBQgUoiCLp6nRjIb1YOCB6X+MUoUS2aIs4bik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kr5fh0dd0lz9MF50U0dJibt1MHplEC+QYycX5i/iDlKM3sXdcO5XMJ5o8ytyiXGXX zxVgAbXbR9a6DfsF60WzcXlK6+lFkWBriYk3aGiicliEqdMPTXdIRPXBsKdcJSW/wu UvMUnCLTyVml71l/J1YbBhV+LPX+65vJ0imthRMRWeJEFCIG5MB5pPiw2vAd7KqlwZ OAcqzGv3tIPhd/agbAFokiUUi8Ir/5uaDzmfmxAoFs3H97dAgjCuJZ9lMnsOKShXaG Wj+Tb+cEir/meL16bmswTVHpfYM2OEyOxgWij1UpPexfdu6wyE8ylYcDudkXyIEVQW tiws5qoMWPeJg== X-Nifty-SrcIP: [126.90.202.47] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 4/5] kbuild: rename subdir-obj-y to subdir-builtin Date: Fri, 22 May 2020 11:00:01 +0900 Message-Id: <20200522020002.504506-4-masahiroy@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200522020002.504506-1-masahiroy@kernel.org> References: <20200522020002.504506-1-masahiroy@kernel.org> MIME-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org I think subdir-builtin is clearer. While I was here, I made its build rule explicit. Signed-off-by: Masahiro Yamada --- scripts/Makefile.build | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index ee283efc1b45..323264607b9f 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -69,7 +69,8 @@ endif # =========================================================================== -subdir-obj-y := $(filter %/built-in.a, $(real-obj-y)) +# subdir-builtin may contain duplications. Use $(sort ...) +subdir-builtin := $(sort $(filter %/built-in.a, $(real-obj-y))) ifneq ($(strip $(lib-y) $(lib-m) $(lib-)),) lib-target := $(obj)/lib.a @@ -356,7 +357,7 @@ endif $(obj)/%.o: $(src)/%.S $(objtool_dep) FORCE $(call if_changed_rule,as_o_S) -targets += $(filter-out $(subdir-obj-y), $(real-obj-y)) $(real-obj-m) $(lib-y) +targets += $(filter-out $(subdir-builtin), $(real-obj-y)) $(real-obj-m) $(lib-y) targets += $(extra-y) $(always-y) $(MAKECMDGOALS) # Linker scripts preprocessor (.lds.S -> .lds) @@ -381,7 +382,7 @@ $(obj)/%.asn1.c $(obj)/%.asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler # --------------------------------------------------------------------------- # To build objects in subdirs, we need to descend into the directories -$(obj)/%/built-in.a: $(obj)/% ; +$(subdir-builtin): $(obj)/%/built-in.a: $(obj)/% ; # # Rule to compile a set of .o files into one .a file (without symbol table) @@ -489,7 +490,7 @@ PHONY += $(subdir-ym) $(subdir-ym): $(Q)$(MAKE) $(build)=$@ \ $(if $(filter $@/, $(KBUILD_SINGLE_TARGETS)),single-build=) \ - need-builtin=$(if $(filter $@/built-in.a, $(subdir-obj-y)),1) \ + need-builtin=$(if $(filter $@/built-in.a, $(subdir-builtin)),1) \ need-modorder=$(if $(need-modorder),$(if $(filter $@/modules.order, $(modorder)),1)) # Add FORCE to the prequisites of a target to force it to be always rebuilt. From patchwork Fri May 22 02:00:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11564325 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2AA0F90 for ; Fri, 22 May 2020 02:00:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1430E2072C for ; Fri, 22 May 2020 02:00:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590112840; bh=/Iwq8HLfKX/nV5U4BqkzpF6JbpqBHnadG5XF6PJ4uGA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=SKORGVo+oTrXcnIgrvZ6y4VxmrsDrVKPxCKWnvkHt1b4UsAGWx3sgvAp04yKEvXjB uRtqwN5L0eylmK7jOv8hEXGU5lM2yuSnW3Mbt2x9lQ3xjWR+zIwjEfJFT3qNB+aKv0 tYMwcNeP3cu4IqL6ALwKdyjbAEvjAxzHhUhIFb9Q= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727908AbgEVCAg (ORCPT ); Thu, 21 May 2020 22:00:36 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:37245 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726693AbgEVCA1 (ORCPT ); Thu, 21 May 2020 22:00:27 -0400 Received: from oscar.flets-west.jp (softbank126090202047.bbtec.net [126.90.202.47]) (authenticated) by conuserg-10.nifty.com with ESMTP id 04M205Ub009585; Fri, 22 May 2020 11:00:12 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com 04M205Ub009585 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1590112812; bh=kUNk2puxOGw5wB6h/50k6NCD7EdqXzokmtBZWpGX3kU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GEvh72F6vCfk9Qpnz+y19ou/fXPdiqLm15Rg3npELcvNn7sL+87u5IF/4UiVXiAMF MCTUEY5jH7mex02opwJ5CzCe4ZFKdQC4/8GUTM+5PQJQdk7gkIQ7h2Haf6wK87knP6 j6GANuq9nUKf05i/wk0dN8mVHJ6zA83y0a9ILclu4wYhfBSRXdtbFqdCd5a0Vsjh/1 THxMg+m+PGFGlca7yrgyKJWoSOaAc9QWoWkm48XoXAbTjXckU8zwpA5I83m/P1jPzA jmRVP3AV7Iev3h1ZljxtITs0ey8nk9/dV+bsyIqYUDcUc893dgsOhzIYhASbBKmWfY Pi0aAo2zmbxMA== X-Nifty-SrcIP: [126.90.202.47] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 5/5] kbuild: make modules.order rule consistent with built-in.a Date: Fri, 22 May 2020 11:00:02 +0900 Message-Id: <20200522020002.504506-5-masahiroy@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200522020002.504506-1-masahiroy@kernel.org> References: <20200522020002.504506-1-masahiroy@kernel.org> MIME-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org built-in.a contains the built-in object paths from the current and sub directories. module.order collects the module paths from the current and sub directories. Make their build rules look more symmetrical. Signed-off-by: Masahiro Yamada --- scripts/Makefile.build | 10 ++++++---- scripts/Makefile.lib | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 323264607b9f..ee9a817e19a3 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -69,8 +69,9 @@ endif # =========================================================================== -# subdir-builtin may contain duplications. Use $(sort ...) +# subdir-builtin and subdir-modorder may contain duplications. Use $(sort ...) subdir-builtin := $(sort $(filter %/built-in.a, $(real-obj-y))) +subdir-modorder := $(sort $(filter %/modules.order, $(modorder))) ifneq ($(strip $(lib-y) $(lib-m) $(lib-)),) lib-target := $(obj)/lib.a @@ -383,6 +384,7 @@ $(obj)/%.asn1.c $(obj)/%.asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler # To build objects in subdirs, we need to descend into the directories $(subdir-builtin): $(obj)/%/built-in.a: $(obj)/% ; +$(subdir-modorder): $(obj)/%/modules.order: $(obj)/% ; # # Rule to compile a set of .o files into one .a file (without symbol table) @@ -401,9 +403,9 @@ targets += $(builtin-target) # # Create commands to either record .ko file or cat modules.order from # a subdirectory -$(modorder-target): $(subdir-ym) FORCE +$(obj)/modules.order: $(subdir-modorder) FORCE $(Q){ $(foreach m, $(modorder), \ - $(if $(filter %/modules.order, $m), cat $m, echo $m);) :; } \ + $(if $(filter $^, $m), cat $m, echo $m);) :; } \ | $(AWK) '!x[$$0]++' - > $@ # @@ -491,7 +493,7 @@ $(subdir-ym): $(Q)$(MAKE) $(build)=$@ \ $(if $(filter $@/, $(KBUILD_SINGLE_TARGETS)),single-build=) \ need-builtin=$(if $(filter $@/built-in.a, $(subdir-builtin)),1) \ - need-modorder=$(if $(need-modorder),$(if $(filter $@/modules.order, $(modorder)),1)) + need-modorder=$(if $(filter $@/modules.order, $(subdir-modorder)),1) # 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 a41a4bbd20e2..0d931cc0df94 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -35,7 +35,9 @@ lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m))) # Determine modorder. # Unfortunately, we don't have information about ordering between -y # and -m subdirs. Just put -y's first. +ifdef need-modorder modorder := $(patsubst %/,%/modules.order, $(filter %/, $(obj-y)) $(obj-m:.o=.ko)) +endif # Handle objects in subdirs # ---------------------------------------------------------------------------