blob: 2595aed218b951fa240789dfa3dba2a507565328 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001# SPDX-License-Identifier: GPL-2.0+
wdenke2211742002-11-02 23:30:20 +00002#
Wolfgang Denkeca3aeb2013-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 Yamada026f9cf2014-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 :=
Tom Rini587e4a42020-03-27 11:46:27 -040015KBUILD_LDFLAGS :=
Masahiro Yamada026f9cf2014-03-05 16:59:40 +090016LDFLAGS_FINAL :=
Daniel Schwierzeck1d3b97c2018-09-23 19:15:15 +020017LDFLAGS_STANDALONE :=
Masahiro Yamada026f9cf2014-03-05 16:59:40 +090018OBJCOPYFLAGS :=
Masahiro Yamada5b3ee382014-10-21 13:18:32 +090019# clear VENDOR for tcsh
20VENDOR :=
wdenke2211742002-11-02 23:30:20 +000021#########################################################################
Wolfgang Denkc4e5f522008-05-03 22:25:00 +020022
Masahiro Yamada51148792014-07-30 14:08:17 +090023ARCH := $(CONFIG_SYS_ARCH:"%"=%)
24CPU := $(CONFIG_SYS_CPU:"%"=%)
Masahiro Yamadae02ee252015-02-24 22:26:20 +090025ifdef CONFIG_SPL_BUILD
Trevor Woerner18138ab2020-05-06 08:02:41 -040026ifdef CONFIG_ARCH_TEGRA
Masahiro Yamadae02ee252015-02-24 22:26:20 +090027CPU := arm720t
28endif
29endif
Masahiro Yamada51148792014-07-30 14:08:17 +090030BOARD := $(CONFIG_SYS_BOARD:"%"=%)
31ifneq ($(CONFIG_SYS_VENDOR),)
32VENDOR := $(CONFIG_SYS_VENDOR:"%"=%)
33endif
34ifneq ($(CONFIG_SYS_SOC),)
35SOC := $(CONFIG_SYS_SOC:"%"=%)
36endif
37
Peter Tyser03b70042010-04-12 22:28:02 -050038# 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.
Peter Tyser8d1f2682010-04-12 22:28:09 -050040# Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains
41# CPU-specific code.
Masahiro Yamadaa8b0f9b2014-06-24 22:10:52 +090042CPUDIR=arch/$(ARCH)/cpu$(if $(CPU),/$(CPU),)
Peter Tyser03b70042010-04-12 22:28:02 -050043
Masahiro Yamada4379ac62014-03-11 11:05:19 +090044sinclude $(srctree)/arch/$(ARCH)/config.mk # include architecture dependend rules
45sinclude $(srctree)/$(CPUDIR)/config.mk # include CPU specific rules
Peter Tyser03b70042010-04-12 22:28:02 -050046
Wolfgang Denkc4e5f522008-05-03 22:25:00 +020047ifdef SOC
Masahiro Yamada4379ac62014-03-11 11:05:19 +090048sinclude $(srctree)/$(CPUDIR)/$(SOC)/config.mk # include SoC specific rules
Wolfgang Denkc4e5f522008-05-03 22:25:00 +020049endif
Masahiro Yamada33a02da2014-03-03 19:03:17 +090050ifneq ($(BOARD),)
Wolfgang Denkc4e5f522008-05-03 22:25:00 +020051ifdef VENDOR
52BOARDDIR = $(VENDOR)/$(BOARD)
Simon Glass86b9c3e2021-10-21 21:08:46 -060053ENVDIR=${vendor}/env
Wolfgang Denkc4e5f522008-05-03 22:25:00 +020054else
55BOARDDIR = $(BOARD)
Simon Glass86b9c3e2021-10-21 21:08:46 -060056ENVDIR=${board}/env
Wolfgang Denkc4e5f522008-05-03 22:25:00 +020057endif
Masahiro Yamada33a02da2014-03-03 19:03:17 +090058endif
Wolfgang Denkc4e5f522008-05-03 22:25:00 +020059ifdef BOARD
Masahiro Yamada4379ac62014-03-11 11:05:19 +090060sinclude $(srctree)/board/$(BOARDDIR)/config.mk # include board specific rules
Wolfgang Denkc4e5f522008-05-03 22:25:00 +020061endif
62
Simon Glassb8450522014-09-14 12:40:14 -060063ifdef FTRACE
64PLATFORM_CPPFLAGS += -finstrument-functions -DFTRACE
65endif
66
Wolfgang Denkc4e5f522008-05-03 22:25:00 +020067#########################################################################
68
Masahiro Yamada026f9cf2014-03-05 16:59:40 +090069RELFLAGS := $(PLATFORM_RELFLAGS)
Scott Wood83b7e2a2011-04-06 13:31:37 +000070
Masahiro Yamada026f9cf2014-03-05 16:59:40 +090071PLATFORM_CPPFLAGS += $(RELFLAGS)
72PLATFORM_CPPFLAGS += -pipe
Tom Rini4a30f1e2012-02-20 13:50:10 +000073
Haiying Wang6dc1eceb2011-02-22 16:38:05 -050074LDFLAGS_FINAL += -Bstatic
Masahiro Yamada026f9cf2014-03-05 16:59:40 +090075
76export PLATFORM_CPPFLAGS
77export RELFLAGS
78export LDFLAGS_FINAL
Daniel Schwierzeck1d3b97c2018-09-23 19:15:15 +020079export LDFLAGS_STANDALONE
Masahiro Yamada026f9cf2014-03-05 16:59:40 +090080export CONFIG_STANDALONE_LOAD_ADDR