From patchwork Mon Oct 21 02:53:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 285090 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 C8F1A2C012B for ; Mon, 21 Oct 2013 13:55:12 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 72F724A132; Mon, 21 Oct 2013 04:55:06 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 phhF4UAx7sx4; Mon, 21 Oct 2013 04:55:06 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B7DD14A14E; Mon, 21 Oct 2013 04:54:25 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B16264A130 for ; Mon, 21 Oct 2013 04:54:13 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 zl6E4RaBmCZP for ; Mon, 21 Oct 2013 04:54:09 +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 smtp.mei.co.jp (smtp.mei.co.jp [133.183.100.20]) by theia.denx.de (Postfix) with ESMTP id 638814A135 for ; Mon, 21 Oct 2013 04:53:56 +0200 (CEST) Received: from mail-gw.jp.panasonic.com ([157.8.1.157]) by smtp.mei.co.jp (8.12.11.20060614/3.7W/kc-maile11) with ESMTP id r9L2rre7007568 for ; Mon, 21 Oct 2013 11:53:53 +0900 (JST) Received: from epochmail.jp.panasonic.com ([157.8.1.130]) by mail.jp.panasonic.com (8.11.6p2/3.7W/kc-maili12) with ESMTP id r9L2rro32450 for ; Mon, 21 Oct 2013 11:53:53 +0900 Received: by epochmail.jp.panasonic.com (8.12.11.20060308/3.7W/lomi16) id r9L2rrUx001302; Mon, 21 Oct 2013 11:53:53 +0900 Received: from poodle by lomi16.jp.panasonic.com (8.12.11.20060308/3.7W) with ESMTP id r9L2rq69001202; Mon, 21 Oct 2013 11:53:53 +0900 Received: from beagle.diag.org (beagle.diag.org [10.184.179.16]) by poodle (Postfix) with ESMTP id 4DBF52743A60; Mon, 21 Oct 2013 11:53:53 +0900 (JST) From: Masahiro Yamada To: u-boot@lists.denx.de Date: Mon, 21 Oct 2013 11:53:41 +0900 Message-Id: <1382324021-18932-19-git-send-email-yamada.m@jp.panasonic.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1382324021-18932-1-git-send-email-yamada.m@jp.panasonic.com> References: <1382324021-18932-1-git-send-email-yamada.m@jp.panasonic.com> Subject: [U-Boot] [PATCH 18/18] Makefile: convert makefiles to Kbuild style and delete grep switch X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de We have converted all makefiles needed to build $(LIBS). Until this commit we used to grep switch so that U-Boot style and Kbuild style makefiles coexist. But we do not need any more. Goint forward, use always Kbuild style Makefile when adding a new Makefile Signed-off-by: Masahiro Yamada --- Makefile | 38 +++++-------------------------- board/avionic-design/medcom-wide/Makefile | 22 +----------------- board/avionic-design/plutux/Makefile | 22 +----------------- board/avionic-design/tec/Makefile | 22 +----------------- board/avnet/fx12mm/Makefile | 2 +- board/avnet/v5fx30teval/Makefile | 2 +- board/compal/paz00/Makefile | 22 +----------------- board/compulab/trimslice/Makefile | 22 +----------------- board/nvidia/common/Makefile | 26 --------------------- board/nvidia/common/common.mk | 4 ++-- board/xilinx/ml507/Makefile | 2 +- board/xilinx/ppc405-generic/Makefile | 21 +---------------- board/xilinx/ppc440-generic/Makefile | 23 ++----------------- spl/Makefile | 25 ++++---------------- 14 files changed, 23 insertions(+), 230 deletions(-) diff --git a/Makefile b/Makefile index 0d27b5b..b255733 100644 --- a/Makefile +++ b/Makefile @@ -558,32 +558,16 @@ ifeq ($(CONFIG_KALLSYMS),y) $(GEN_UBOOT) $(obj)common/system_map.o endif -# Tentative step for Kbuild-style makefiles coexist with conventional U-Boot style makefiles -# U-Boot conventional sub makefiles always include some other makefiles. -# So, the build system searches a line beginning with "include" before entering into the sub makefile -# in order to distinguish which style it is. -# If the Makefile include a "include" line, we assume it is an U-Boot style makefile. -# Otherwise, it is treated as a Kbuild-style makefile. -select_makefile = \ - +if grep -q "^include" $1/Makefile; then \ - $(MAKE) -C $1; \ - else \ - $(MAKE) -C $1 -f $(TOPDIR)/scripts/Makefile.build; \ - mv $(dir $@)built-in.o $@; \ - fi - -# We do not need to build $(OBJS) explicitly. -# It is built while we are at $(CPUDIR)/lib$(CPU).o build. -$(OBJS): depend - if grep -q "^include" $(CPUDIR)/Makefile; then \ - $(MAKE) -C $(CPUDIR) $(if $(REMOTE_BUILD),$@,$(notdir $@)); \ - fi +$(OBJS): + @: $(LIBS): depend $(SUBDIR_TOOLS) - +$(call select_makefile, $(dir $(subst $(obj),,$@))) + $(MAKE) $(build) $(dir $(subst $(obj),,$@)) + mv $(dir $@)built-in.o $@ $(LIBBOARD): depend $(LIBS) - +$(call select_makefile, $(dir $(subst $(obj),,$@))) + $(MAKE) $(build) $(dir $(subst $(obj),,$@)) + mv $(dir $@)built-in.o $@ $(SUBDIRS): depend $(MAKE) -C $@ all @@ -611,13 +595,6 @@ $(obj)tpl/u-boot-tpl.bin: $(SUBDIR_TOOLS) depend updater: $(MAKE) -C tools/updater all -select_makefile2 = \ - if grep -q "^include" $1/Makefile; then \ - $(MAKE) -C $1 _depend; \ - else \ - $(MAKE) -C $1 -f $(TOPDIR)/scripts/Makefile.build _depend; \ - fi - # Explicitly make _depend in subdirs containing multiple targets to prevent # parallel sub-makes creating .depend files simultaneously. depend dep: $(TIMESTAMP_FILE) $(VERSION_FILE) \ @@ -626,9 +603,6 @@ depend dep: $(TIMESTAMP_FILE) $(VERSION_FILE) \ $(obj)include/autoconf.mk \ $(obj)include/generated/generic-asm-offsets.h \ $(obj)include/generated/asm-offsets.h - +for dir in $(SUBDIRS) $(CPUDIR) $(LDSCRIPT_MAKEFILE_DIR) ; do \ - $(call select_makefile2, $$dir); \ - done TAG_SUBDIRS = $(SUBDIRS) TAG_SUBDIRS += $(dir $(__LIBS)) diff --git a/board/avionic-design/medcom-wide/Makefile b/board/avionic-design/medcom-wide/Makefile index 3077319..6c4ab64 100644 --- a/board/avionic-design/medcom-wide/Makefile +++ b/board/avionic-design/medcom-wide/Makefile @@ -7,28 +7,8 @@ # SPDX-License-Identifier: GPL-2.0+ # -include $(TOPDIR)/config.mk - $(shell mkdir -p $(obj)../common $(obj)../../nvidia/common) -LIB = $(obj)lib$(BOARD).o - -COBJS-y := ../common/tamonten.o +obj-y := ../common/tamonten.o include ../../nvidia/common/common.mk - -COBJS := $(COBJS-y) -SRCS := $(COBJS:.o=.c) -OBJS := $(addprefix $(obj),$(COBJS)) - -$(LIB): $(obj).depend $(OBJS) - $(call cmd_link_o_target, $(OBJS)) - -######################################################################### - -# defines $(obj).depend target -include $(SRCTREE)/rules.mk - -sinclude $(obj).depend - -######################################################################### diff --git a/board/avionic-design/plutux/Makefile b/board/avionic-design/plutux/Makefile index 3077319..6c4ab64 100644 --- a/board/avionic-design/plutux/Makefile +++ b/board/avionic-design/plutux/Makefile @@ -7,28 +7,8 @@ # SPDX-License-Identifier: GPL-2.0+ # -include $(TOPDIR)/config.mk - $(shell mkdir -p $(obj)../common $(obj)../../nvidia/common) -LIB = $(obj)lib$(BOARD).o - -COBJS-y := ../common/tamonten.o +obj-y := ../common/tamonten.o include ../../nvidia/common/common.mk - -COBJS := $(COBJS-y) -SRCS := $(COBJS:.o=.c) -OBJS := $(addprefix $(obj),$(COBJS)) - -$(LIB): $(obj).depend $(OBJS) - $(call cmd_link_o_target, $(OBJS)) - -######################################################################### - -# defines $(obj).depend target -include $(SRCTREE)/rules.mk - -sinclude $(obj).depend - -######################################################################### diff --git a/board/avionic-design/tec/Makefile b/board/avionic-design/tec/Makefile index 3077319..6c4ab64 100644 --- a/board/avionic-design/tec/Makefile +++ b/board/avionic-design/tec/Makefile @@ -7,28 +7,8 @@ # SPDX-License-Identifier: GPL-2.0+ # -include $(TOPDIR)/config.mk - $(shell mkdir -p $(obj)../common $(obj)../../nvidia/common) -LIB = $(obj)lib$(BOARD).o - -COBJS-y := ../common/tamonten.o +obj-y := ../common/tamonten.o include ../../nvidia/common/common.mk - -COBJS := $(COBJS-y) -SRCS := $(COBJS:.o=.c) -OBJS := $(addprefix $(obj),$(COBJS)) - -$(LIB): $(obj).depend $(OBJS) - $(call cmd_link_o_target, $(OBJS)) - -######################################################################### - -# defines $(obj).depend target -include $(SRCTREE)/rules.mk - -sinclude $(obj).depend - -######################################################################### diff --git a/board/avnet/fx12mm/Makefile b/board/avnet/fx12mm/Makefile index 2dd48b6..37fb02f 100644 --- a/board/avnet/fx12mm/Makefile +++ b/board/avnet/fx12mm/Makefile @@ -6,6 +6,6 @@ # SPDX-License-Identifier: GPL-2.0+ # -COBJS += $(BOARD).o +obj-y += fx12mm.o include $(SRCTREE)/board/xilinx/ppc405-generic/Makefile diff --git a/board/avnet/v5fx30teval/Makefile b/board/avnet/v5fx30teval/Makefile index 51b777c..f7d0417 100644 --- a/board/avnet/v5fx30teval/Makefile +++ b/board/avnet/v5fx30teval/Makefile @@ -6,6 +6,6 @@ # SPDX-License-Identifier: GPL-2.0+ # -COBJS += $(BOARD).o +obj-y += v5fx30teval.o include $(SRCTREE)/board/xilinx/ppc440-generic/Makefile diff --git a/board/compal/paz00/Makefile b/board/compal/paz00/Makefile index fa5c510..824cd2e 100644 --- a/board/compal/paz00/Makefile +++ b/board/compal/paz00/Makefile @@ -14,28 +14,8 @@ # more details. # -include $(TOPDIR)/config.mk - $(shell mkdir -p $(obj)../../nvidia/common) -LIB = $(obj)lib$(BOARD).o - -COBJS-y := $(BOARD).o +obj-y := paz00.o include ../../nvidia/common/common.mk - -COBJS := $(COBJS-y) -SRCS := $(COBJS:.o=.c) -OBJS := $(addprefix $(obj),$(COBJS)) - -$(LIB): $(obj).depend $(OBJS) - $(call cmd_link_o_target, $(OBJS)) - -######################################################################### - -# defines $(obj).depend target -include $(SRCTREE)/rules.mk - -sinclude $(obj).depend - -######################################################################### diff --git a/board/compulab/trimslice/Makefile b/board/compulab/trimslice/Makefile index 3ce180c..0818673 100644 --- a/board/compulab/trimslice/Makefile +++ b/board/compulab/trimslice/Makefile @@ -5,28 +5,8 @@ # SPDX-License-Identifier: GPL-2.0+ # -include $(TOPDIR)/config.mk - $(shell mkdir -p $(obj)../../nvidia/common) -LIB = $(obj)lib$(BOARD).o - -COBJS-y := $(BOARD).o +obj-y := trimslice.o include ../../nvidia/common/common.mk - -COBJS := $(COBJS-y) -SRCS := $(COBJS:.o=.c) -OBJS := $(addprefix $(obj),$(COBJS)) - -$(LIB): $(obj).depend $(OBJS) - $(call cmd_link_o_target, $(OBJS)) - -######################################################################### - -# defines $(obj).depend target -include $(SRCTREE)/rules.mk - -sinclude $(obj).depend - -######################################################################### diff --git a/board/nvidia/common/Makefile b/board/nvidia/common/Makefile index 6215caf..e3fcf2b 100644 --- a/board/nvidia/common/Makefile +++ b/board/nvidia/common/Makefile @@ -1,30 +1,4 @@ # Copyright (c) 2011 The Chromium OS Authors. # SPDX-License-Identifier: GPL-2.0+ -include $(TOPDIR)/config.mk - -ifneq ($(OBJTREE),$(SRCTREE)) -$(shell mkdir -p $(obj)board/$(VENDOR)/common) -endif - -LIB = $(obj)lib$(VENDOR).o - include common.mk - -COBJS := $(COBJS-y) -SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) -OBJS := $(addprefix $(obj),$(COBJS)) -SOBJS := $(addprefix $(obj),$(SOBJS)) - -all: $(LIB) - -$(LIB): $(obj).depend $(OBJS) $(SOBJS) - $(call cmd_link_o_target, $(OBJS) $(SOBJS)) - -######################################################################### -# This is for $(obj).depend target -include $(SRCTREE)/rules.mk - -sinclude $(obj).depend - -######################################################################### diff --git a/board/nvidia/common/common.mk b/board/nvidia/common/common.mk index d9bcb85..9a9b529 100644 --- a/board/nvidia/common/common.mk +++ b/board/nvidia/common/common.mk @@ -1,3 +1,3 @@ # common options for all tegra boards -COBJS-y += ../../nvidia/common/board.o -COBJS-$(CONFIG_TEGRA_CLOCK_SCALING) += ../../nvidia/common/emc.o +obj-y += ../../nvidia/common/board.o +obj-$(CONFIG_TEGRA_CLOCK_SCALING) += ../../nvidia/common/emc.o diff --git a/board/xilinx/ml507/Makefile b/board/xilinx/ml507/Makefile index 51b777c..3c84651 100644 --- a/board/xilinx/ml507/Makefile +++ b/board/xilinx/ml507/Makefile @@ -6,6 +6,6 @@ # SPDX-License-Identifier: GPL-2.0+ # -COBJS += $(BOARD).o +obj-y += ml507.o include $(SRCTREE)/board/xilinx/ppc440-generic/Makefile diff --git a/board/xilinx/ppc405-generic/Makefile b/board/xilinx/ppc405-generic/Makefile index cc161ae..1562f17 100644 --- a/board/xilinx/ppc405-generic/Makefile +++ b/board/xilinx/ppc405-generic/Makefile @@ -9,27 +9,8 @@ # SPDX-License-Identifier: GPL-2.0+ # -include $(TOPDIR)/config.mk ifneq ($(OBJTREE),$(SRCTREE)) $(shell mkdir -p $(obj)../../xilinx/ppc405-generic) endif -LIB = $(obj)lib$(BOARD).o - -COBJS += ../../xilinx/ppc405-generic/xilinx_ppc405_generic.o - -SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) -OBJS := $(addprefix $(obj),$(COBJS)) -SOBJS := $(addprefix $(obj),$(SOBJS)) - -$(LIB): $(obj).depend $(OBJS) $(SOBJS) - $(call cmd_link_o_target, $(OBJS)) - -######################################################################### - -# defines $(obj).depend target -include $(SRCTREE)/rules.mk - -sinclude $(obj).depend - -######################################################################### +obj-y += ../../xilinx/ppc405-generic/xilinx_ppc405_generic.o diff --git a/board/xilinx/ppc440-generic/Makefile b/board/xilinx/ppc440-generic/Makefile index 597afde..b2227c5 100644 --- a/board/xilinx/ppc440-generic/Makefile +++ b/board/xilinx/ppc440-generic/Makefile @@ -9,28 +9,9 @@ # SPDX-License-Identifier: GPL-2.0+ # -include $(TOPDIR)/config.mk ifneq ($(OBJTREE),$(SRCTREE)) $(shell mkdir -p $(obj)../../xilinx/ppc440-generic) endif -LIB = $(obj)lib$(BOARD).o - -COBJS += ../../xilinx/ppc440-generic/xilinx_ppc440_generic.o -SOBJS += ../../xilinx/ppc440-generic/init.o - -SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) -OBJS := $(addprefix $(obj),$(COBJS)) -SOBJS := $(addprefix $(obj),$(SOBJS)) - -$(LIB): $(obj).depend $(OBJS) $(SOBJS) - $(call cmd_link_o_target, $(OBJS)) - -######################################################################### - -# defines $(obj).depend target -include $(SRCTREE)/rules.mk - -sinclude $(obj).depend - -######################################################################### +obj-y += ../../xilinx/ppc440-generic/xilinx_ppc440_generic.o +extra-y += ../../xilinx/ppc440-generic/init.o diff --git a/spl/Makefile b/spl/Makefile index bf7271d..cbd3d27 100644 --- a/spl/Makefile +++ b/spl/Makefile @@ -190,29 +190,12 @@ GEN_UBOOT = \ $(obj)$(SPL_BIN): depend $(START) $(LIBS) $(obj)u-boot-spl.lds $(GEN_UBOOT) -# Tentative step for Kbuild-style makefiles coexist with conventional U-Boot style makefiles -# U-Boot conventional sub makefiles always include some other makefiles. -# So, the build system searches a line beginning with "include" before entering into the sub makefile -# in order to distinguish which style it is. -# If the Makefile include a "include" line, we assume it is an U-Boot style makefile. -# Otherwise, it is treated as a Kbuild-style makefile. -select_makefile = \ - if grep -q "^include" $1/Makefile; then \ - $(MAKE) -C $1; \ - else \ - $(MAKE) -C $1 -f $(TOPDIR)/scripts/Makefile.build; \ - mv $(dir $@)built-in.o $@; \ - fi - -# We do not need to build $(START) explicitly. -# It is built while we are at $(CPUDIR)/lib$(CPU).o build. -$(START): depend - if grep -q "^include" $(SRCTREE)$(dir $(subst $(SPLTREE),,$@))Makefile; then \ - $(MAKE) -C $(SRCTREE)/$(START_PATH) $@; \ - fi +$(START): + @: $(LIBS): depend - +$(call select_makefile, $(SRCTREE)$(dir $(subst $(SPLTREE),,$@))) + $(MAKE) $(build) $(SRCTREE)$(dir $(subst $(SPLTREE),,$@)) + mv $(dir $@)built-in.o $@ $(obj)u-boot-spl.lds: $(LDSCRIPT) depend $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -I$(obj). -ansi -D__ASSEMBLY__ -P - < $< > $@