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 :=
15KBUILD_LDFLAGS :=
16LDFLAGS_FINAL :=
17LDFLAGS_STANDALONE :=
18OBJCOPYFLAGS :=
19# clear VENDOR for tcsh
20VENDOR :=
21#########################################################################
22
23ARCH := $(CONFIG_SYS_ARCH:"%"=%)
24CPU := $(CONFIG_SYS_CPU:"%"=%)
25ifdef CONFIG_SPL_BUILD
26ifdef CONFIG_ARCH_TEGRA
27CPU := arm720t
28endif
29endif
30BOARD := $(CONFIG_SYS_BOARD:"%"=%)
31ifneq ($(CONFIG_SYS_VENDOR),)
32VENDOR := $(CONFIG_SYS_VENDOR:"%"=%)
33endif
34ifneq ($(CONFIG_SYS_SOC),)
35SOC := $(CONFIG_SYS_SOC:"%"=%)
36endif
37
38# Some architecture config.mk files need to know what CPUDIR is set to,
39# so calculate CPUDIR before including ARCH/SOC/CPU config.mk files.
40# Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains
41# CPU-specific code.
42CPUDIR=arch/$(ARCH)/cpu$(if $(CPU),/$(CPU),)
43
44sinclude $(srctree)/arch/$(ARCH)/config.mk	# include architecture dependend rules
45sinclude $(srctree)/$(CPUDIR)/config.mk		# include  CPU	specific rules
46
47ifdef	SOC
48sinclude $(srctree)/$(CPUDIR)/$(SOC)/config.mk	# include  SoC	specific rules
49endif
50ifneq ($(BOARD),)
51ifdef	VENDOR
52BOARDDIR = $(VENDOR)/$(BOARD)
53else
54BOARDDIR = $(BOARD)
55endif
56endif
57ifdef	BOARD
58sinclude $(srctree)/board/$(BOARDDIR)/config.mk	# include board specific rules
59endif
60
61ifdef FTRACE
62PLATFORM_CPPFLAGS += -finstrument-functions -DFTRACE
63endif
64
65#########################################################################
66
67RELFLAGS := $(PLATFORM_RELFLAGS)
68
69PLATFORM_CPPFLAGS += $(RELFLAGS)
70PLATFORM_CPPFLAGS += -pipe
71
72LDFLAGS_FINAL += -Bstatic
73
74export PLATFORM_CPPFLAGS
75export RELFLAGS
76export LDFLAGS_FINAL
77export LDFLAGS_STANDALONE
78export CONFIG_STANDALONE_LOAD_ADDR
79