Commit bf4b3de1013c1643ffb8f071292c0f0eabb265c3

Authored by Masahiro Yamada
Committed by Tom Rini
1 parent ceec4c8746

kbuild: Use Kbuild.include

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>

Showing 5 changed files with 16 additions and 35 deletions Side-by-side Diff

... ... @@ -102,9 +102,10 @@
102 102 SPLTREE := $(OBJTREE)/spl
103 103 TPLTREE := $(OBJTREE)/tpl
104 104 SRCTREE := $(CURDIR)
  105 +srctree := $(SRCTREE)
105 106 TOPDIR := $(SRCTREE)
106 107 LNDIR := $(OBJTREE)
107   -export TOPDIR SRCTREE OBJTREE SPLTREE TPLTREE
  108 +export TOPDIR SRCTREE srctree OBJTREE SPLTREE TPLTREE
108 109  
109 110 MKCONFIG := $(SRCTREE)/mkconfig
110 111 export MKCONFIG
... ... @@ -126,8 +127,6 @@
126 127  
127 128 #########################################################################
128 129  
129   -build := -f $(TOPDIR)/scripts/Makefile.build -C
130   -
131 130 # The "tools" are needed early, so put this first
132 131 # Don't include stuff already done in $(LIBS)
133 132 # The "examples" conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC
... ... @@ -197,6 +196,10 @@
197 196 HOSTCFLAGS += $(call os_x_before, 10, 4, "-traditional-cpp")
198 197 HOSTLDFLAGS += $(call os_x_before, 10, 5, "-multiply_defined suppress")
199 198 endif
  199 +
  200 +# We need some generic definitions (do not try to remake the file).
  201 +$(srctree)/scripts/Kbuild.include: ;
  202 +include $(srctree)/scripts/Kbuild.include
200 203  
201 204 # Make variables (CC, etc...)
202 205  
... ... @@ -48,35 +48,6 @@
48 48 PLATFORM_LDFLAGS =
49 49  
50 50 #########################################################################
51   -#
52   -# Option checker, gcc version (courtesy linux kernel) to ensure
53   -# only supported compiler options are used
54   -#
55   -CC_OPTIONS_CACHE_FILE := $(OBJTREE)/include/generated/cc_options.mk
56   -CC_TEST_OFILE := $(OBJTREE)/include/generated/cc_test_file.o
57   -
58   --include $(CC_OPTIONS_CACHE_FILE)
59   -
60   -cc-option-sys = $(shell mkdir -p $(dir $(CC_TEST_OFILE)); \
61   - if $(CC) $(CFLAGS) $(1) -S -xc /dev/null -o $(CC_TEST_OFILE) \
62   - > /dev/null 2>&1; then \
63   - echo 'CC_OPTIONS += $(strip $1)' >> $(CC_OPTIONS_CACHE_FILE); \
64   - echo "$(1)"; fi)
65   -
66   -ifeq ($(CONFIG_CC_OPT_CACHE_DISABLE),y)
67   -cc-option = $(strip $(if $(call cc-option-sys,$1),$1,$2))
68   -else
69   -cc-option = $(strip $(if $(findstring $1,$(CC_OPTIONS)),$1,\
70   - $(if $(call cc-option-sys,$1),$1,$2)))
71   -endif
72   -
73   -# cc-version
74   -# Usage gcc-ver := $(call cc-version)
75   -cc-version = $(shell $(CONFIG_SHELL) $(SRCTREE)/scripts/gcc-version.sh $(CC))
76   -binutils-version = $(shell $(CONFIG_SHELL) $(SRCTREE)/scripts/binutils-version.sh $(AS))
77   -dtc-version = $(shell $(CONFIG_SHELL) $(SRCTREE)/scripts/dtc-version.sh $(DTC))
78   -
79   -#########################################################################
80 51  
81 52 # Load generated board configuration
82 53 ifeq ($(CONFIG_TPL_BUILD),y)
scripts/Kbuild.include
... ... @@ -140,6 +140,10 @@
140 140 # Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)
141 141 cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3))
142 142  
  143 +# added for U-Boot
  144 +binutils-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/binutils-version.sh $(AS))
  145 +dtc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/dtc-version.sh $(DTC))
  146 +
143 147 # cc-ldoption
144 148 # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both)
145 149 cc-ldoption = $(call try-run,\
... ... @@ -161,7 +165,9 @@
161 165 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=
162 166 # Usage:
163 167 # $(Q)$(MAKE) $(build)=dir
164   -build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
  168 +#build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
  169 +# temporary
  170 +build := -f $(srctree)/scripts/Makefile.build -C
165 171  
166 172 ###
167 173 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.modbuiltin obj=
scripts/Makefile.build
... ... @@ -2,6 +2,7 @@
2 2 .PHONY: all
3 3 all:
4 4  
  5 +include $(srctree)/scripts/Kbuild.include
5 6 include $(TOPDIR)/config.mk
6 7  
7 8 # variable LIB is used in examples/standalone/Makefile
... ... @@ -14,6 +14,8 @@
14 14 # Based on top-level Makefile.
15 15 #
16 16  
  17 +include $(srctree)/scripts/Kbuild.include
  18 +
17 19 CONFIG_SPL_BUILD := y
18 20 export CONFIG_SPL_BUILD
19 21  
... ... @@ -126,8 +128,6 @@
126 128 ifeq ($(wildcard $(LDSCRIPT)),)
127 129 $(error could not find linker script)
128 130 endif
129   -
130   -build := -f $(TOPDIR)/scripts/Makefile.build -C
131 131  
132 132 # Special flags for CPP when processing the linker script.
133 133 # Pass the version down so we can handle backwards compatibility