blob: e294be2a4c4279e05cdc3b5d297d172a0833db7f [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001# SPDX-License-Identifier: GPL-2.0+
wdenke2211742002-11-02 23:30:20 +00002#
Wolfgang Denk1234ce72013-06-21 10:22:36 +02003# (C) Copyright 2000-2013
wdenke2211742002-11-02 23:30:20 +00004# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
wdenke2211742002-11-02 23:30:20 +00005#########################################################################
6
Masahiro Yamada958fe8f2014-03-05 16:59:40 +09007# 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 :=
Masahiro Yamada958fe8f2014-03-05 16:59:40 +090015LDFLAGS_FINAL :=
Daniel Schwierzeck9dc13da2018-09-23 19:15:15 +020016LDFLAGS_STANDALONE :=
Masahiro Yamada958fe8f2014-03-05 16:59:40 +090017OBJCOPYFLAGS :=
Masahiro Yamadadc1baa22014-10-21 13:18:32 +090018# clear VENDOR for tcsh
19VENDOR :=
wdenke2211742002-11-02 23:30:20 +000020#########################################################################
Wolfgang Denk979b4bd2008-05-03 22:25:00 +020021
Masahiro Yamada60bb7342014-07-30 14:08:17 +090022ARCH := $(CONFIG_SYS_ARCH:"%"=%)
23CPU := $(CONFIG_SYS_CPU:"%"=%)
Simon Glass0e84d962024-09-29 19:49:50 -060024ifdef CONFIG_XPL_BUILD
Trevor Woerner513f6402020-05-06 08:02:41 -040025ifdef CONFIG_ARCH_TEGRA
Masahiro Yamada72fb32b2015-02-24 22:26:20 +090026CPU := arm720t
27endif
28endif
Masahiro Yamada60bb7342014-07-30 14:08:17 +090029BOARD := $(CONFIG_SYS_BOARD:"%"=%)
30ifneq ($(CONFIG_SYS_VENDOR),)
31VENDOR := $(CONFIG_SYS_VENDOR:"%"=%)
32endif
33ifneq ($(CONFIG_SYS_SOC),)
34SOC := $(CONFIG_SYS_SOC:"%"=%)
35endif
36
Peter Tyserd53e8fd2010-04-12 22:28:02 -050037# 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.
Peter Tyser29514c72010-04-12 22:28:09 -050039# Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains
40# CPU-specific code.
Masahiro Yamadac5b2a002014-06-24 22:10:52 +090041CPUDIR=arch/$(ARCH)/cpu$(if $(CPU),/$(CPU),)
Peter Tyserd53e8fd2010-04-12 22:28:02 -050042
Masahiro Yamadae7944942014-03-11 11:05:19 +090043sinclude $(srctree)/arch/$(ARCH)/config.mk # include architecture dependend rules
44sinclude $(srctree)/$(CPUDIR)/config.mk # include CPU specific rules
Peter Tyserd53e8fd2010-04-12 22:28:02 -050045
Wolfgang Denk979b4bd2008-05-03 22:25:00 +020046ifdef SOC
Masahiro Yamadae7944942014-03-11 11:05:19 +090047sinclude $(srctree)/$(CPUDIR)/$(SOC)/config.mk # include SoC specific rules
Wolfgang Denk979b4bd2008-05-03 22:25:00 +020048endif
Masahiro Yamadab93b2132014-03-03 19:03:17 +090049ifneq ($(BOARD),)
Wolfgang Denk979b4bd2008-05-03 22:25:00 +020050ifdef VENDOR
51BOARDDIR = $(VENDOR)/$(BOARD)
Simon Glass7327fe72021-10-21 21:08:46 -060052ENVDIR=${vendor}/env
Wolfgang Denk979b4bd2008-05-03 22:25:00 +020053else
54BOARDDIR = $(BOARD)
Simon Glass7327fe72021-10-21 21:08:46 -060055ENVDIR=${board}/env
Wolfgang Denk979b4bd2008-05-03 22:25:00 +020056endif
Masahiro Yamadab93b2132014-03-03 19:03:17 +090057endif
Wolfgang Denk979b4bd2008-05-03 22:25:00 +020058ifdef BOARD
Masahiro Yamadae7944942014-03-11 11:05:19 +090059sinclude $(srctree)/board/$(BOARDDIR)/config.mk # include board specific rules
Wolfgang Denk979b4bd2008-05-03 22:25:00 +020060endif
61
Simon Glass385375d2014-09-14 12:40:14 -060062ifdef FTRACE
63PLATFORM_CPPFLAGS += -finstrument-functions -DFTRACE
64endif
65
Wolfgang Denk979b4bd2008-05-03 22:25:00 +020066#########################################################################
67
Masahiro Yamada958fe8f2014-03-05 16:59:40 +090068RELFLAGS := $(PLATFORM_RELFLAGS)
Scott Wood34c6dd22011-04-06 13:31:37 +000069
Masahiro Yamada958fe8f2014-03-05 16:59:40 +090070PLATFORM_CPPFLAGS += $(RELFLAGS)
71PLATFORM_CPPFLAGS += -pipe
Tom Rinib7f34132012-02-20 13:50:10 +000072
Haiying Wang39358732011-02-22 16:38:05 -050073LDFLAGS_FINAL += -Bstatic
Masahiro Yamada958fe8f2014-03-05 16:59:40 +090074
75export PLATFORM_CPPFLAGS
76export RELFLAGS
77export LDFLAGS_FINAL
Daniel Schwierzeck9dc13da2018-09-23 19:15:15 +020078export LDFLAGS_STANDALONE
Masahiro Yamada958fe8f2014-03-05 16:59:40 +090079export CONFIG_STANDALONE_LOAD_ADDR