1# SPDX-License-Identifier: GPL-2.0+
2#
3# (C) Copyright 2000-2013
4# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5#########################################################################
6
7# This file is included from ./Makefile and spl/Makefile.
8# Clean the state to avoid the same flags added twice.
9#
10# (Tegra needs different flags for SPL.
11#  That's the reason why this file must be included from spl/Makefile too.
12#  If we did not have Tegra SoCs, build system would be much simpler...)
13PLATFORM_RELFLAGS :=
14PLATFORM_CPPFLAGS :=
15LDFLAGS_FINAL :=
16LDFLAGS_STANDALONE :=
17OBJCOPYFLAGS :=
18# clear VENDOR for tcsh
19VENDOR :=
20#########################################################################
21
22ARCH := $(CONFIG_SYS_ARCH:"%"=%)
23CPU := $(CONFIG_SYS_CPU:"%"=%)
24ifdef CONFIG_SPL_BUILD
25ifdef CONFIG_ARCH_TEGRA
26CPU := arm720t
27endif
28endif
29BOARD := $(CONFIG_SYS_BOARD:"%"=%)
30ifneq ($(CONFIG_SYS_VENDOR),)
31VENDOR := $(CONFIG_SYS_VENDOR:"%"=%)
32endif
33ifneq ($(CONFIG_SYS_SOC),)
34SOC := $(CONFIG_SYS_SOC:"%"=%)
35endif
36
37# Some architecture config.mk files need to know what CPUDIR is set to,
38# so calculate CPUDIR before including ARCH/SOC/CPU config.mk files.
39# Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains
40# CPU-specific code.
41CPUDIR=arch/$(ARCH)/cpu$(if $(CPU),/$(CPU),)
42
43sinclude $(srctree)/arch/$(ARCH)/config.mk	# include architecture dependend rules
44sinclude $(srctree)/$(CPUDIR)/config.mk		# include  CPU	specific rules
45
46ifdef	SOC
47sinclude $(srctree)/$(CPUDIR)/$(SOC)/config.mk	# include  SoC	specific rules
48endif
49ifneq ($(BOARD),)
50ifdef	VENDOR
51BOARDDIR = $(VENDOR)/$(BOARD)
52ENVDIR=${vendor}/env
53else
54BOARDDIR = $(BOARD)
55ENVDIR=${board}/env
56endif
57endif
58ifdef	BOARD
59sinclude $(srctree)/board/$(BOARDDIR)/config.mk	# include board specific rules
60endif
61
62ifdef FTRACE
63PLATFORM_CPPFLAGS += -finstrument-functions -DFTRACE
64endif
65
66#########################################################################
67
68RELFLAGS := $(PLATFORM_RELFLAGS)
69
70PLATFORM_CPPFLAGS += $(RELFLAGS)
71PLATFORM_CPPFLAGS += -pipe
72
73LDFLAGS_FINAL += -Bstatic
74
75export PLATFORM_CPPFLAGS
76export RELFLAGS
77export LDFLAGS_FINAL
78export LDFLAGS_STANDALONE
79export CONFIG_STANDALONE_LOAD_ADDR
80