From patchwork Fri Dec 27 05:35:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 305357 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 7781B2C0084 for ; Fri, 27 Dec 2013 16:38:32 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 061914A075; Fri, 27 Dec 2013 06:38:30 +0100 (CET) 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 6KF-gt1+irks; Fri, 27 Dec 2013 06:38:29 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C778C4A3D3; Fri, 27 Dec 2013 06:37:09 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6FD4B4A077 for ; Fri, 27 Dec 2013 06:37:04 +0100 (CET) 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 oYMO5ucbj36b for ; Fri, 27 Dec 2013 06:37:03 +0100 (CET) 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 6369C4A073 for ; Fri, 27 Dec 2013 06:36:55 +0100 (CET) Received: from mail-gw.jp.panasonic.com ([157.8.1.157]) by smtp.mei.co.jp (8.12.11.20060614/3.7W/kc-maile12) with ESMTP id rBR5aqHQ003795; Fri, 27 Dec 2013 14:36:52 +0900 (JST) Received: from epochmail.jp.panasonic.com ([157.8.1.130]) by mail.jp.panasonic.com (8.11.6p2/3.7W/kc-maili11) with ESMTP id rBR5arR06825; Fri, 27 Dec 2013 14:36:53 +0900 Received: by epochmail.jp.panasonic.com (8.12.11.20060308/3.7W/lomi12) id rBR5arfN022965; Fri, 27 Dec 2013 14:36:53 +0900 Received: from poodle by lomi12.jp.panasonic.com (8.12.11.20060308/3.7W) with ESMTP id rBR5arTg022938; Fri, 27 Dec 2013 14:36:53 +0900 Received: from beagle.diag.org (beagle.diag.org [10.184.179.16]) by poodle (Postfix) with ESMTP id 074902743A5D; Fri, 27 Dec 2013 14:36:53 +0900 (JST) From: Masahiro Yamada To: u-boot@lists.denx.de Date: Fri, 27 Dec 2013 14:35:39 +0900 Message-Id: <1388122564-17606-12-git-send-email-yamada.m@jp.panasonic.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1388122564-17606-1-git-send-email-yamada.m@jp.panasonic.com> References: <1388122564-17606-1-git-send-email-yamada.m@jp.panasonic.com> Cc: Tom Rini Subject: [U-Boot] [PATCH v3 11/36] Kbuild: Use Kbuild.include 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 This commit adjusts some files to use Kbuild.include. - Use cc-option defined in Kbuild.include (Delete cc-option in config.mk) - Use cc-version defined in (Delete cc-version in config.mk) - Move binutils-version and dtc-version to Kbuild.include by analogy to cc-version This commit also adds srctree (same as SRCTREE) to use Kbuild scripts. Signed-off-by: Masahiro Yamada --- Changes in v3: None Changes in v2: None Makefile | 9 ++++++--- config.mk | 29 ----------------------------- scripts/Kbuild.include | 8 +++++++- scripts/Makefile.build | 1 + spl/Makefile | 4 ++-- 5 files changed, 16 insertions(+), 35 deletions(-) diff --git a/Makefile b/Makefile index 7328216..b166ccc 100644 --- a/Makefile +++ b/Makefile @@ -102,9 +102,10 @@ OBJTREE := $(if $(BUILD_DIR),$(BUILD_DIR),$(CURDIR)) SPLTREE := $(OBJTREE)/spl TPLTREE := $(OBJTREE)/tpl SRCTREE := $(CURDIR) +srctree := $(SRCTREE) TOPDIR := $(SRCTREE) LNDIR := $(OBJTREE) -export TOPDIR SRCTREE OBJTREE SPLTREE TPLTREE +export TOPDIR SRCTREE srctree OBJTREE SPLTREE TPLTREE MKCONFIG := $(SRCTREE)/mkconfig export MKCONFIG @@ -126,8 +127,6 @@ unexport CDPATH ######################################################################### -build := -f $(TOPDIR)/scripts/Makefile.build -C - # The "tools" are needed early, so put this first # Don't include stuff already done in $(LIBS) # The "examples" conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC @@ -198,6 +197,10 @@ HOSTCFLAGS += $(call os_x_before, 10, 4, "-traditional-cpp") HOSTLDFLAGS += $(call os_x_before, 10, 5, "-multiply_defined suppress") endif +# We need some generic definitions (do not try to remake the file). +$(srctree)/scripts/Kbuild.include: ; +include $(srctree)/scripts/Kbuild.include + # Make variables (CC, etc...) AS = $(CROSS_COMPILE)as diff --git a/config.mk b/config.mk index dfe81fa..ba42641 100644 --- a/config.mk +++ b/config.mk @@ -48,35 +48,6 @@ PLATFORM_CPPFLAGS = PLATFORM_LDFLAGS = ######################################################################### -# -# Option checker, gcc version (courtesy linux kernel) to ensure -# only supported compiler options are used -# -CC_OPTIONS_CACHE_FILE := $(OBJTREE)/include/generated/cc_options.mk -CC_TEST_OFILE := $(OBJTREE)/include/generated/cc_test_file.o - --include $(CC_OPTIONS_CACHE_FILE) - -cc-option-sys = $(shell mkdir -p $(dir $(CC_TEST_OFILE)); \ - if $(CC) $(CFLAGS) $(1) -S -xc /dev/null -o $(CC_TEST_OFILE) \ - > /dev/null 2>&1; then \ - echo 'CC_OPTIONS += $(strip $1)' >> $(CC_OPTIONS_CACHE_FILE); \ - echo "$(1)"; fi) - -ifeq ($(CONFIG_CC_OPT_CACHE_DISABLE),y) -cc-option = $(strip $(if $(call cc-option-sys,$1),$1,$2)) -else -cc-option = $(strip $(if $(findstring $1,$(CC_OPTIONS)),$1,\ - $(if $(call cc-option-sys,$1),$1,$2))) -endif - -# cc-version -# Usage gcc-ver := $(call cc-version) -cc-version = $(shell $(CONFIG_SHELL) $(SRCTREE)/scripts/gcc-version.sh $(CC)) -binutils-version = $(shell $(CONFIG_SHELL) $(SRCTREE)/scripts/binutils-version.sh $(AS)) -dtc-version = $(shell $(CONFIG_SHELL) $(SRCTREE)/scripts/dtc-version.sh $(DTC)) - -######################################################################### # Load generated board configuration ifeq ($(CONFIG_TPL_BUILD),y) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 547e15d..ca5fd56 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -140,6 +140,10 @@ cc-fullversion = $(shell $(CONFIG_SHELL) \ # Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3)) +# added for U-Boot +binutils-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/binutils-version.sh $(AS)) +dtc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/dtc-version.sh $(DTC)) + # cc-ldoption # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both) cc-ldoption = $(call try-run,\ @@ -161,7 +165,9 @@ ar-option = $(call try-run, $(AR) rc$(1) "$$TMP",$(1),$(2)) # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj= # Usage: # $(Q)$(MAKE) $(build)=dir -build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj +#build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj +# temporary +build := -f $(srctree)/scripts/Makefile.build -C ### # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.modbuiltin obj= diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 1b3d77f..7789efa 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -2,6 +2,7 @@ .PHONY: all all: +include $(srctree)/scripts/Kbuild.include include $(TOPDIR)/config.mk # variable LIB is used in examples/standalone/Makefile diff --git a/spl/Makefile b/spl/Makefile index a3253ba..13dd616 100644 --- a/spl/Makefile +++ b/spl/Makefile @@ -24,6 +24,8 @@ else SPL_BIN := u-boot-spl endif +include $(srctree)/scripts/Kbuild.include + include $(TOPDIR)/config.mk # We want the final binaries in this directory @@ -123,8 +125,6 @@ ifeq ($(wildcard $(LDSCRIPT)),) $(error could not find linker script) endif -build := -f $(TOPDIR)/scripts/Makefile.build -C - # Special flags for CPP when processing the linker script. # Pass the version down so we can handle backwards compatibility # on the fly.