]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
kbuild: Use Kbuild.include
authorMasahiro Yamada <yamada.m@jp.panasonic.com>
Tue, 4 Feb 2014 08:24:18 +0000 (17:24 +0900)
committerTom Rini <trini@ti.com>
Wed, 19 Feb 2014 16:07:50 +0000 (11:07 -0500)
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 <yamada.m@jp.panasonic.com>
Makefile
config.mk
scripts/Kbuild.include
scripts/Makefile.build
spl/Makefile

index 0c1eef335d68b3f7168df5c018c0f93349732a5f..e4045bcba08d8d46fc2055370787b067f959f9c8 100644 (file)
--- 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
index dfe81fa10d734d5ab0ecae17cf68c854da8a557b..ba4264155e1e935075e7ee186ebd4a785c3947bb 100644 (file)
--- a/config.mk
+++ b/config.mk
@@ -47,35 +47,6 @@ PLATFORM_RELFLAGS =
 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
index 547e15daf03dc86dbfa72818122bc4c61929edb0..ca5fd56ca2543df1e3f4b30343040b00b4c53e8e 100644 (file)
@@ -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=
index 1b3d77fea24354ad8a8138e82efc4f3d816de2bc..7789efab82ccbfb867cd83574abbbe3613fd6f6e 100644 (file)
@@ -2,6 +2,7 @@
 .PHONY: all
 all:
 
+include $(srctree)/scripts/Kbuild.include
 include $(TOPDIR)/config.mk
 
 # variable LIB is used in examples/standalone/Makefile
index 5339338b2b6a3638b78c14cc4c3c1f6c21639804..f273015168e11765297b1b6f2f367eff00295521 100644 (file)
@@ -14,6 +14,8 @@
 # Based on top-level Makefile.
 #
 
+include $(srctree)/scripts/Kbuild.include
+
 CONFIG_SPL_BUILD := y
 export CONFIG_SPL_BUILD
 
@@ -127,8 +129,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.