blob: 6282919482bc8b8cc7c879e44e3814858573fa9a [file] [log] [blame]
wdenke2211742002-11-02 23:30:20 +00001#
Wolfgang Denk1234ce72013-06-21 10:22:36 +02002# (C) Copyright 2000-2013
wdenke2211742002-11-02 23:30:20 +00003# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4#
Wolfgang Denk1234ce72013-06-21 10:22:36 +02005# SPDX-License-Identifier: GPL-2.0+
wdenke2211742002-11-02 23:30:20 +00006#
wdenke2211742002-11-02 23:30:20 +00007#########################################################################
8
Masahiro Yamada958fe8f2014-03-05 16:59:40 +09009# This file is included from ./Makefile and spl/Makefile.
10# Clean the state to avoid the same flags added twice.
11#
12# (Tegra needs different flags for SPL.
13# That's the reason why this file must be included from spl/Makefile too.
14# If we did not have Tegra SoCs, build system would be much simpler...)
15PLATFORM_RELFLAGS :=
16PLATFORM_CPPFLAGS :=
17PLATFORM_LDFLAGS :=
18LDFLAGS :=
19LDFLAGS_FINAL :=
20OBJCOPYFLAGS :=
Masahiro Yamadadc1baa22014-10-21 13:18:32 +090021# clear VENDOR for tcsh
22VENDOR :=
wdenke2211742002-11-02 23:30:20 +000023#########################################################################
Wolfgang Denk979b4bd2008-05-03 22:25:00 +020024
Masahiro Yamada60bb7342014-07-30 14:08:17 +090025ARCH := $(CONFIG_SYS_ARCH:"%"=%)
26CPU := $(CONFIG_SYS_CPU:"%"=%)
Masahiro Yamada72fb32b2015-02-24 22:26:20 +090027ifdef CONFIG_SPL_BUILD
28ifdef CONFIG_TEGRA
29CPU := arm720t
30endif
31endif
Masahiro Yamada60bb7342014-07-30 14:08:17 +090032BOARD := $(CONFIG_SYS_BOARD:"%"=%)
33ifneq ($(CONFIG_SYS_VENDOR),)
34VENDOR := $(CONFIG_SYS_VENDOR:"%"=%)
35endif
36ifneq ($(CONFIG_SYS_SOC),)
37SOC := $(CONFIG_SYS_SOC:"%"=%)
38endif
39
Peter Tyserd53e8fd2010-04-12 22:28:02 -050040# Some architecture config.mk files need to know what CPUDIR is set to,
41# so calculate CPUDIR before including ARCH/SOC/CPU config.mk files.
Peter Tyser29514c72010-04-12 22:28:09 -050042# Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains
43# CPU-specific code.
Masahiro Yamadac5b2a002014-06-24 22:10:52 +090044CPUDIR=arch/$(ARCH)/cpu$(if $(CPU),/$(CPU),)
Peter Tyserd53e8fd2010-04-12 22:28:02 -050045
Masahiro Yamadae7944942014-03-11 11:05:19 +090046sinclude $(srctree)/arch/$(ARCH)/config.mk # include architecture dependend rules
47sinclude $(srctree)/$(CPUDIR)/config.mk # include CPU specific rules
Peter Tyserd53e8fd2010-04-12 22:28:02 -050048
Wolfgang Denk979b4bd2008-05-03 22:25:00 +020049ifdef SOC
Masahiro Yamadae7944942014-03-11 11:05:19 +090050sinclude $(srctree)/$(CPUDIR)/$(SOC)/config.mk # include SoC specific rules
Wolfgang Denk979b4bd2008-05-03 22:25:00 +020051endif
Masahiro Yamadab93b2132014-03-03 19:03:17 +090052ifneq ($(BOARD),)
Wolfgang Denk979b4bd2008-05-03 22:25:00 +020053ifdef VENDOR
54BOARDDIR = $(VENDOR)/$(BOARD)
55else
56BOARDDIR = $(BOARD)
57endif
Masahiro Yamadab93b2132014-03-03 19:03:17 +090058endif
Wolfgang Denk979b4bd2008-05-03 22:25:00 +020059ifdef BOARD
Masahiro Yamadae7944942014-03-11 11:05:19 +090060sinclude $(srctree)/board/$(BOARDDIR)/config.mk # include board specific rules
Wolfgang Denk979b4bd2008-05-03 22:25:00 +020061endif
62
Simon Glass385375d2014-09-14 12:40:14 -060063ifdef FTRACE
64PLATFORM_CPPFLAGS += -finstrument-functions -DFTRACE
65endif
66
Gabe Black3687fe42014-10-15 04:38:30 -060067# Allow use of stdint.h if available
68ifneq ($(USE_STDINT),)
69PLATFORM_CPPFLAGS += -DCONFIG_USE_STDINT
70endif
71
Wolfgang Denk979b4bd2008-05-03 22:25:00 +020072#########################################################################
73
Masahiro Yamada958fe8f2014-03-05 16:59:40 +090074RELFLAGS := $(PLATFORM_RELFLAGS)
Scott Wood34c6dd22011-04-06 13:31:37 +000075
Masahiro Yamadac9c83ba2014-02-24 11:12:12 +090076OBJCOPYFLAGS += --gap-fill=0xff
wdenke2211742002-11-02 23:30:20 +000077
Masahiro Yamada958fe8f2014-03-05 16:59:40 +090078PLATFORM_CPPFLAGS += $(RELFLAGS)
79PLATFORM_CPPFLAGS += -pipe
Tom Rinib7f34132012-02-20 13:50:10 +000080
Nobuhiro Iwamatsub859b8c2011-01-06 10:23:54 +090081LDFLAGS += $(PLATFORM_LDFLAGS)
Haiying Wang39358732011-02-22 16:38:05 -050082LDFLAGS_FINAL += -Bstatic
Masahiro Yamada958fe8f2014-03-05 16:59:40 +090083
84export PLATFORM_CPPFLAGS
85export RELFLAGS
86export LDFLAGS_FINAL
87export CONFIG_STANDALONE_LOAD_ADDR