]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - config.mk
Makefile: move BFD_ROOT_DIR to tools/gdb/Makefile
[karo-tx-uboot.git] / config.mk
index 499eed134868d1494e2f40fa6a46719d45eda71f..dfe81fa10d734d5ab0ecae17cf68c854da8a557b 100644 (file)
--- a/config.mk
+++ b/config.mk
@@ -6,13 +6,6 @@
 #
 #########################################################################
 
-# Set shell to bash if possible, otherwise fall back to sh
-SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
-       else if [ -x /bin/bash ]; then echo /bin/bash; \
-       else echo sh; fi; fi)
-
-export SHELL
-
 ifeq ($(CURDIR),$(SRCTREE))
 dir :=
 else
@@ -22,7 +15,11 @@ endif
 ifneq ($(OBJTREE),$(SRCTREE))
 # Create object files for SPL in a separate directory
 ifeq ($(CONFIG_SPL_BUILD),y)
+ifeq ($(CONFIG_TPL_BUILD),y)
+obj := $(if $(dir),$(TPLTREE)/$(dir)/,$(TPLTREE)/)
+else
 obj := $(if $(dir),$(SPLTREE)/$(dir)/,$(SPLTREE)/)
+endif
 else
 obj := $(if $(dir),$(OBJTREE)/$(dir)/,$(OBJTREE)/)
 endif
@@ -32,8 +29,12 @@ $(shell mkdir -p $(obj))
 else
 # Create object files for SPL in a separate directory
 ifeq ($(CONFIG_SPL_BUILD),y)
+ifeq ($(CONFIG_TPL_BUILD),y)
+obj := $(if $(dir),$(TPLTREE)/$(dir)/,$(TPLTREE)/)
+else
 obj := $(if $(dir),$(SPLTREE)/$(dir)/,$(SPLTREE)/)
 
+endif
 $(shell mkdir -p $(obj))
 else
 obj :=
@@ -46,52 +47,6 @@ PLATFORM_RELFLAGS =
 PLATFORM_CPPFLAGS =
 PLATFORM_LDFLAGS =
 
-#########################################################################
-
-HOSTCFLAGS     = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer \
-                 $(HOSTCPPFLAGS)
-HOSTSTRIP      = strip
-
-#
-# Mac OS X / Darwin's C preprocessor is Apple specific.  It
-# generates numerous errors and warnings.  We want to bypass it
-# and use GNU C's cpp. To do this we pass the -traditional-cpp
-# option to the compiler.  Note that the -traditional-cpp flag
-# DOES NOT have the same semantics as GNU C's flag, all it does
-# is invoke the GNU preprocessor in stock ANSI/ISO C fashion.
-#
-# Apple's linker is similar, thanks to the new 2 stage linking
-# multiple symbol definitions are treated as errors, hence the
-# -multiply_defined suppress option to turn off this error.
-#
-
-ifeq ($(HOSTOS),darwin)
-# get major and minor product version (e.g. '10' and '6' for Snow Leopard)
-DARWIN_MAJOR_VERSION   = $(shell sw_vers -productVersion | cut -f 1 -d '.')
-DARWIN_MINOR_VERSION   = $(shell sw_vers -productVersion | cut -f 2 -d '.')
-
-os_x_before    = $(shell if [ $(DARWIN_MAJOR_VERSION) -le $(1) -a \
-       $(DARWIN_MINOR_VERSION) -le $(2) ] ; then echo "$(3)"; else echo "$(4)"; fi ;)
-
-# Snow Leopards build environment has no longer restrictions as described above
-HOSTCC          = $(call os_x_before, 10, 5, "cc", "gcc")
-HOSTCFLAGS     += $(call os_x_before, 10, 4, "-traditional-cpp")
-HOSTLDFLAGS    += $(call os_x_before, 10, 5, "-multiply_defined suppress")
-else
-HOSTCC         = gcc
-endif
-
-ifeq ($(HOSTOS),cygwin)
-HOSTCFLAGS     += -ansi
-endif
-
-# We build some files with extra pedantic flags to try to minimize things
-# that won't build on some weird host compiler -- though there are lots of
-# exceptions for files that aren't complaint.
-
-HOSTCFLAGS_NOPED = $(filter-out -pedantic,$(HOSTCFLAGS))
-HOSTCFLAGS     += -pedantic
-
 #########################################################################
 #
 # Option checker, gcc version (courtesy linux kernel) to ensure
@@ -117,34 +72,25 @@ endif
 
 # cc-version
 # Usage gcc-ver := $(call cc-version)
-cc-version = $(shell $(SHELL) $(SRCTREE)/tools/gcc-version.sh $(CC))
-binutils-version = $(shell $(SHELL) $(SRCTREE)/tools/binutils-version.sh $(AS))
-
-#
-# Include the make variables (CC, etc...)
-#
-AS     = $(CROSS_COMPILE)as
-
-# Always use GNU ld
-LD     = $(shell if $(CROSS_COMPILE)ld.bfd -v > /dev/null 2>&1; \
-               then echo "$(CROSS_COMPILE)ld.bfd"; else echo "$(CROSS_COMPILE)ld"; fi;)
-
-CC     = $(CROSS_COMPILE)gcc
-CPP    = $(CC) -E
-AR     = $(CROSS_COMPILE)ar
-NM     = $(CROSS_COMPILE)nm
-LDR    = $(CROSS_COMPILE)ldr
-STRIP  = $(CROSS_COMPILE)strip
-OBJCOPY = $(CROSS_COMPILE)objcopy
-OBJDUMP = $(CROSS_COMPILE)objdump
-RANLIB = $(CROSS_COMPILE)RANLIB
-DTC    = dtc
-CHECK  = sparse
+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)
+# Include TPL autoconf
+sinclude $(OBJTREE)/include/tpl-autoconf.mk
+else
+ifeq ($(CONFIG_SPL_BUILD),y)
+# Include SPL autoconf
+sinclude $(OBJTREE)/include/spl-autoconf.mk
+else
+# Include normal autoconf
 sinclude $(OBJTREE)/include/autoconf.mk
+endif
+endif
 sinclude $(OBJTREE)/include/config.mk
 
 # Some architecture config.mk files need to know what CPUDIR is set to,
@@ -193,33 +139,15 @@ CPPFLAGS += -ffunction-sections -fdata-sections
 LDFLAGS_FINAL += --gc-sections
 endif
 
-# TODO(sjg@chromium.org): Is this correct on Mac OS?
-ifdef CONFIG_FIT_SIGNATURE
-HOSTLIBS       += -lssl -lcrypto
-
-# This affects include/image.h, but including the board config file
-# is tricky, so manually define this options here.
-HOSTCFLAGS     += -DCONFIG_FIT_SIGNATURE
-endif
-
 ifneq ($(CONFIG_SYS_TEXT_BASE),)
 CPPFLAGS += -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE)
 endif
 
-ifneq ($(CONFIG_SPL_TEXT_BASE),)
-CPPFLAGS += -DCONFIG_SPL_TEXT_BASE=$(CONFIG_SPL_TEXT_BASE)
-endif
-
-ifneq ($(CONFIG_SPL_PAD_TO),)
-CPPFLAGS += -DCONFIG_SPL_PAD_TO=$(CONFIG_SPL_PAD_TO)
-endif
-
-ifneq ($(CONFIG_UBOOT_PAD_TO),)
-CPPFLAGS += -DCONFIG_UBOOT_PAD_TO=$(CONFIG_UBOOT_PAD_TO)
-endif
-
 ifeq ($(CONFIG_SPL_BUILD),y)
 CPPFLAGS += -DCONFIG_SPL_BUILD
+ifeq ($(CONFIG_TPL_BUILD),y)
+CPPFLAGS += -DCONFIG_TPL_BUILD
+endif
 endif
 
 # Does this architecture support generic board init?
@@ -230,15 +158,11 @@ Please undefined CONFIG_SYS_GENERIC_BOARD in your board config file)
 endif
 endif
 
-ifneq ($(RESET_VECTOR_ADDRESS),)
-CPPFLAGS += -DRESET_VECTOR_ADDRESS=$(RESET_VECTOR_ADDRESS)
-endif
-
 ifneq ($(OBJTREE),$(SRCTREE))
-CPPFLAGS += -I$(OBJTREE)/include2 -I$(OBJTREE)/include
+CPPFLAGS += -I$(OBJTREE)/include
 endif
 
-CPPFLAGS += -I$(TOPDIR)/include
+CPPFLAGS += -I$(TOPDIR)/include -I$(SRCTREE)/arch/$(ARCH)/include
 CPPFLAGS += -fno-builtin -ffreestanding -nostdinc      \
        -isystem $(gccincdir) -pipe $(PLATFORM_CPPFLAGS)
 
@@ -291,75 +215,11 @@ ifneq ($(CONFIG_SYS_TEXT_BASE),)
 LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE)
 endif
 
-LDFLAGS_u-boot-spl += -T $(obj)u-boot-spl.lds $(LDFLAGS_FINAL)
+LDFLAGS_$(SPL_BIN) += -T $(obj)u-boot-spl.lds $(LDFLAGS_FINAL)
 ifneq ($(CONFIG_SPL_TEXT_BASE),)
-LDFLAGS_u-boot-spl += -Ttext $(CONFIG_SPL_TEXT_BASE)
-endif
-
-# Linus' kernel sanity checking tool
-CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
-                  -Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF)
-
-# Location of a usable BFD library, where we define "usable" as
-# "built for ${HOST}, supports ${TARGET}".  Sensible values are
-# - When cross-compiling: the root of the cross-environment
-# - Linux/ppc (native): /usr
-# - NetBSD/ppc (native): you lose ... (must extract these from the
-#   binutils build directory, plus the native and U-Boot include
-#   files don't like each other)
-#
-# So far, this is used only by tools/gdb/Makefile.
-
-ifeq ($(HOSTOS),darwin)
-BFD_ROOT_DIR =         /usr/local/tools
-else
-ifeq ($(HOSTARCH),$(ARCH))
-# native
-BFD_ROOT_DIR =         /usr
-else
-#BFD_ROOT_DIR =                /LinuxPPC/CDK           # Linux/i386
-#BFD_ROOT_DIR =                /usr/pkg/cross          # NetBSD/i386
-BFD_ROOT_DIR =         /opt/powerpc
-endif
+LDFLAGS_$(SPL_BIN) += -Ttext $(CONFIG_SPL_TEXT_BASE)
 endif
 
 #########################################################################
 
-export HOSTCC HOSTCFLAGS HOSTLDFLAGS PEDCFLAGS HOSTSTRIP CROSS_COMPILE \
-       AS LD CC CPP AR NM STRIP OBJCOPY OBJDUMP MAKE
 export CONFIG_SYS_TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS
-
-#########################################################################
-
-# Allow boards to use custom optimize flags on a per dir/file basis
-ALL_AFLAGS = $(AFLAGS) $(AFLAGS_$(BCURDIR)/$(@F)) $(AFLAGS_$(BCURDIR))
-ALL_CFLAGS = $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR))
-EXTRA_CPPFLAGS = $(CPPFLAGS_$(BCURDIR)/$(@F)) $(CPPFLAGS_$(BCURDIR))
-ALL_CFLAGS += $(EXTRA_CPPFLAGS)
-
-# The _DEP version uses the $< file target (for dependency generation)
-# See rules.mk
-EXTRA_CPPFLAGS_DEP = $(CPPFLAGS_$(BCURDIR)/$(addsuffix .o,$(basename $<))) \
-               $(CPPFLAGS_$(BCURDIR))
-$(obj)%.s:     %.S
-       $(CPP) $(ALL_AFLAGS) -o $@ $<
-$(obj)%.o:     %.S
-       $(CC)  $(ALL_AFLAGS) -o $@ $< -c
-$(obj)%.o:     %.c
-ifneq ($(CHECKSRC),0)
-       $(CHECK) $(CHECKFLAGS) $(ALL_CFLAGS) $<
-endif
-       $(CC)  $(ALL_CFLAGS) -o $@ $< -c
-$(obj)%.i:     %.c
-       $(CPP) $(ALL_CFLAGS) -o $@ $< -c
-$(obj)%.s:     %.c
-       $(CC)  $(ALL_CFLAGS) -o $@ $< -c -S
-
-#########################################################################
-
-# If the list of objects to link is empty, just create an empty built-in.o
-cmd_link_o_target = $(if $(strip $1),\
-                     $(LD) $(LDFLAGS) -r -o $@ $1,\
-                     rm -f $@; $(AR) rcs $@ )
-
-#########################################################################