From patchwork Sat Aug 1 13:14:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 502813 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id BEA171402D5 for ; Sat, 1 Aug 2015 23:16:25 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 410814BBF2; Sat, 1 Aug 2015 15:16:18 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GnlF5Y2GVW-r; Sat, 1 Aug 2015 15:16:18 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4CE6C4BBFF; Sat, 1 Aug 2015 15:16:07 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1E72B4BB9A for ; Sat, 1 Aug 2015 15:15:59 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id e0C8Qtp2jYPE for ; Sat, 1 Aug 2015 15:15:59 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from conuserg009-v.nifty.com (conuserg009.nifty.com [202.248.44.35]) by theia.denx.de (Postfix) with ESMTPS id 5B5354BBA4 for ; Sat, 1 Aug 2015 15:15:58 +0200 (CEST) Received: from grover.sesame (FL1-125-192-212-42.osk.mesh.ad.jp [125.192.212.42]) (authenticated) by conuserg009-v.nifty.com with ESMTP id t71DEt3A022033; Sat, 1 Aug 2015 22:15:29 +0900 X-Nifty-SrcIP: [125.192.212.42] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Sat, 1 Aug 2015 22:14:32 +0900 Message-Id: <1438434891-8345-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1438434891-8345-1-git-send-email-yamada.masahiro@socionext.com> References: <1438434891-8345-1-git-send-email-yamada.masahiro@socionext.com> Cc: Michal Marek , Tom Rini , Jeroen Hofstee , Andrey Ryabinin , Heiko Carstens , Martin Schwidefsky Subject: [U-Boot] [PATCH v2 02/15] kbuild: add a makefile macro useful with per-image config options X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Commit e02ee2548afe ("kconfig: switch to single .config configuration") made the configuration itself pretty simple, instead, we lost the way to systematically enable/disable config options for each image independently. Our current strategy is, put entries into Makefile.spl for options we need separate enabling, or once enable the options globally in Kconfig and then undef them in Makefile.uncmd_spl if we do not want to compile the features for SPL at all. Things are getting really messy. Besides, "ifdef CONFIG_SPL_BUILD" are sprinkled everywhere in makefiles. This commit adds a variable to help describe makefile simpler. $(SPL_) evaluates to "SPL_" during the SPL build, while to an empty string during building U-boot proper. So, you can write obj-$(CONFIG_$(SPL_)FOO) += foo.o instead of ifdef CONFIG_SPL_BUILD obj-$(CONFIG_SPL_FOO) += foo.o else obj-$(CONFIG_FOO) += foo.o endif If CONFIG_SPL_FOO does not exist in Kconfig, it is equivalent to ifndef CONFIG_SPL_BUILD obj-$(CONFIG_SPL_FOO) += foo.o endif This is the pattern we often see in our current makefiles. To take advantage of this macro, we should prefix SPL_ for the SPL version of the option when we need independent control between U-boot and SPL. With this naming scheme, I hope our makefiles will be much simplified. It means we want to rename existing config options as follows in the long run: CONFIG_SPL_SERIAL_SUPPORT -> CONFIG_SPL_SERIAL CONFIG_SPL_I2C_SUPPORT -> CONFIG_SPL_I2C CONFIG_SPL_GPIO_SUPPORT -> CONFIG_SPL_GPIO CONFIG_SPL_SPI_SUPPORT -> CONFIG_SPL_SPI CONFIG_SPL_DISABLE_OF_CONTROL -> CONFIG_SPL_OF_CONTROL (inverting the logic) Then drivers/Makefile would be re-worked as follows: obj-$(CONFIG_$(SPL_)SERIAL) += serial/ obj-$(CONFIG_$(SPL_)I2C) += i2c/ obj-$(CONFIG_$(SPL_)GPIO) += gpio/ obj-$(CONFIG_$(SPL_)SPI) += spi/ ... Eventually, SPL-specialized entries in Makefile.spl would go away. Signed-off-by: Masahiro Yamada Reviewed-by: Tom Rini Reviewed-by: Simon Glass --- Changes in v2: None scripts/Kbuild.include | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index f02eb37..98e09ce 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -309,3 +309,9 @@ why = \ echo-why = $(call escsq, $(strip $(why))) endif + +ifdef CONFIG_SPL_BUILD +SPL_ := SPL_ +else +SPL_ := +endif