blob: 097d1f67d24ee2f17af3205fbf36047f785f8b69 [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 :=
Tom Rini5d4ecf22020-03-27 11:46:27 -040015KBUILD_LDFLAGS :=
Masahiro Yamada958fe8f2014-03-05 16:59:40 +090016LDFLAGS_FINAL :=
Daniel Schwierzeck9dc13da2018-09-23 19:15:15 +020017LDFLAGS_STANDALONE :=
Masahiro Yamada958fe8f2014-03-05 16:59:40 +090018OBJCOPYFLAGS :=
Masahiro Yamadadc1baa22014-10-21 13:18:32 +090019# clear VENDOR for tcsh
20VENDOR :=
wdenke2211742002-11-02 23:30:20 +000021#########################################################################
Wolfgang Denk979b4bd2008-05-03 22:25:00 +020022
Masahiro Yamada60bb7342014-07-30 14:08:17 +090023ARCH := $(CONFIG_SYS_ARCH:"%"=%)
24CPU := $(CONFIG_SYS_CPU:"%"=%)
Masahiro Yamada72fb32b2015-02-24 22:26:20 +090025ifdef CONFIG_SPL_BUILD
26ifdef CONFIG_TEGRA
27CPU := arm720t
28endif
29endif
Masahiro Yamada60bb7342014-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 Tyserd53e8fd2010-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 Tyser29514c72010-04-12 22:28:09 -050040# Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains
41# CPU-specific code.
Masahiro Yamadac5b2a002014-06-24 22:10:52 +090042CPUDIR=arch/$(ARCH)/cpu$(if $(CPU),/$(CPU),)
Peter Tyserd53e8fd2010-04-12 22:28:02 -050043
Masahiro Yamadae7944942014-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 Tyserd53e8fd2010-04-12 22:28:02 -050046
Wolfgang Denk979b4bd2008-05-03 22:25:00 +020047ifdef SOC
Masahiro Yamadae7944942014-03-11 11:05:19 +090048sinclude $(srctree)/$(CPUDIR)/$(SOC)/config.mk # include SoC specific rules
Wolfgang Denk979b4bd2008-05-03 22:25:00 +020049endif
Masahiro Yamadab93b2132014-03-03 19:03:17 +090050ifneq ($(BOARD),)
Wolfgang Denk979b4bd2008-05-03 22:25:00 +020051ifdef VENDOR
52BOARDDIR = $(VENDOR)/$(BOARD)
53else
54BOARDDIR = $(BOARD)
55endif
Masahiro Yamadab93b2132014-03-03 19:03:17 +090056endif
Wolfgang Denk979b4bd2008-05-03 22:25:00 +020057ifdef BOARD
Masahiro Yamadae7944942014-03-11 11:05:19 +090058sinclude $(srctree)/board/$(BOARDDIR)/config.mk # include board specific rules
Wolfgang Denk979b4bd2008-05-03 22:25:00 +020059endif
60
Simon Glass385375d2014-09-14 12:40:14 -060061ifdef FTRACE
62PLATFORM_CPPFLAGS += -finstrument-functions -DFTRACE
63endif
64
Wolfgang Denk979b4bd2008-05-03 22:25:00 +020065#########################################################################
66
Masahiro Yamada958fe8f2014-03-05 16:59:40 +090067RELFLAGS := $(PLATFORM_RELFLAGS)
Scott Wood34c6dd22011-04-06 13:31:37 +000068
Masahiro Yamada958fe8f2014-03-05 16:59:40 +090069PLATFORM_CPPFLAGS += $(RELFLAGS)
70PLATFORM_CPPFLAGS += -pipe
Tom Rinib7f34132012-02-20 13:50:10 +000071
Haiying Wang39358732011-02-22 16:38:05 -050072LDFLAGS_FINAL += -Bstatic
Masahiro Yamada958fe8f2014-03-05 16:59:40 +090073
74export PLATFORM_CPPFLAGS
75export RELFLAGS
76export LDFLAGS_FINAL
Daniel Schwierzeck9dc13da2018-09-23 19:15:15 +020077export LDFLAGS_STANDALONE
Masahiro Yamada958fe8f2014-03-05 16:59:40 +090078export CONFIG_STANDALONE_LOAD_ADDR