blob: 25c59a7eba19e1c02f7e83ec9ee07e277c5e83c9 [file] [log] [blame]
wdenke2211742002-11-02 23:30:20 +00001#
Wolfgang Denkeca3aeb2013-06-21 10:22:36 +02002# (C) Copyright 2000-2013
wdenke2211742002-11-02 23:30:20 +00003# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4#
Wolfgang Denkeca3aeb2013-06-21 10:22:36 +02005# SPDX-License-Identifier: GPL-2.0+
wdenke2211742002-11-02 23:30:20 +00006#
wdenke2211742002-11-02 23:30:20 +00007#########################################################################
8
Masahiro Yamada026f9cf2014-03-05 16:59:40 +09009# This file is included from ./Makefile and spl/Makefile.
10# Clean the state to avoid the same flags added twice.
11#
12# (Tegra needs different flags for SPL.
13# That's the reason why this file must be included from spl/Makefile too.
14# If we did not have Tegra SoCs, build system would be much simpler...)
15PLATFORM_RELFLAGS :=
16PLATFORM_CPPFLAGS :=
17PLATFORM_LDFLAGS :=
18LDFLAGS :=
19LDFLAGS_FINAL :=
20OBJCOPYFLAGS :=
Masahiro Yamada5b3ee382014-10-21 13:18:32 +090021# clear VENDOR for tcsh
22VENDOR :=
wdenke2211742002-11-02 23:30:20 +000023#########################################################################
Wolfgang Denkc4e5f522008-05-03 22:25:00 +020024
Masahiro Yamada51148792014-07-30 14:08:17 +090025ARCH := $(CONFIG_SYS_ARCH:"%"=%)
26CPU := $(CONFIG_SYS_CPU:"%"=%)
Masahiro Yamadae02ee252015-02-24 22:26:20 +090027ifdef CONFIG_SPL_BUILD
28ifdef CONFIG_TEGRA
29CPU := arm720t
30endif
31endif
Masahiro Yamada51148792014-07-30 14:08:17 +090032BOARD := $(CONFIG_SYS_BOARD:"%"=%)
33ifneq ($(CONFIG_SYS_VENDOR),)
34VENDOR := $(CONFIG_SYS_VENDOR:"%"=%)
35endif
36ifneq ($(CONFIG_SYS_SOC),)
37SOC := $(CONFIG_SYS_SOC:"%"=%)
38endif
Manoharan Vijaya Raghavanf338b812016-10-06 22:44:38 +053039ifeq ($(CONFIG_OF_COMBINE),)
40ifneq ($(CONFIG_OF_SEPERATE),)
41OBJCOPYFLAGS += -j .text -j .secure_text -j .rodata -j .hash -j .data -j .got -j .got.plt -j .u_boot_list
42endif
43else
44OBJCOPYFLAGS += -j .text -j .secure_text -j .rodata -j .hash -j .data -j .got -j .got.plt -j .u_boot_list -j .dtb
45endif
46
Masahiro Yamada51148792014-07-30 14:08:17 +090047
Peter Tyser03b70042010-04-12 22:28:02 -050048# Some architecture config.mk files need to know what CPUDIR is set to,
49# so calculate CPUDIR before including ARCH/SOC/CPU config.mk files.
Peter Tyser8d1f2682010-04-12 22:28:09 -050050# Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains
51# CPU-specific code.
Masahiro Yamadaa8b0f9b2014-06-24 22:10:52 +090052CPUDIR=arch/$(ARCH)/cpu$(if $(CPU),/$(CPU),)
Peter Tyser03b70042010-04-12 22:28:02 -050053
Masahiro Yamada4379ac62014-03-11 11:05:19 +090054sinclude $(srctree)/arch/$(ARCH)/config.mk # include architecture dependend rules
55sinclude $(srctree)/$(CPUDIR)/config.mk # include CPU specific rules
Peter Tyser03b70042010-04-12 22:28:02 -050056
Wolfgang Denkc4e5f522008-05-03 22:25:00 +020057ifdef SOC
Masahiro Yamada4379ac62014-03-11 11:05:19 +090058sinclude $(srctree)/$(CPUDIR)/$(SOC)/config.mk # include SoC specific rules
Wolfgang Denkc4e5f522008-05-03 22:25:00 +020059endif
Masahiro Yamada33a02da2014-03-03 19:03:17 +090060ifneq ($(BOARD),)
Wolfgang Denkc4e5f522008-05-03 22:25:00 +020061ifdef VENDOR
62BOARDDIR = $(VENDOR)/$(BOARD)
63else
64BOARDDIR = $(BOARD)
65endif
Masahiro Yamada33a02da2014-03-03 19:03:17 +090066endif
Wolfgang Denkc4e5f522008-05-03 22:25:00 +020067ifdef BOARD
Masahiro Yamada4379ac62014-03-11 11:05:19 +090068sinclude $(srctree)/board/$(BOARDDIR)/config.mk # include board specific rules
Wolfgang Denkc4e5f522008-05-03 22:25:00 +020069endif
70
Simon Glassb8450522014-09-14 12:40:14 -060071ifdef FTRACE
72PLATFORM_CPPFLAGS += -finstrument-functions -DFTRACE
73endif
74
Gabe Black0d296cc2014-10-15 04:38:30 -060075# Allow use of stdint.h if available
76ifneq ($(USE_STDINT),)
77PLATFORM_CPPFLAGS += -DCONFIG_USE_STDINT
78endif
79
Wolfgang Denkc4e5f522008-05-03 22:25:00 +020080#########################################################################
81
Masahiro Yamada026f9cf2014-03-05 16:59:40 +090082RELFLAGS := $(PLATFORM_RELFLAGS)
Scott Wood83b7e2a2011-04-06 13:31:37 +000083
Masahiro Yamada026f9cf2014-03-05 16:59:40 +090084PLATFORM_CPPFLAGS += $(RELFLAGS)
85PLATFORM_CPPFLAGS += -pipe
Tom Rini4a30f1e2012-02-20 13:50:10 +000086
Nobuhiro Iwamatsu8aba9dc2011-01-06 10:23:54 +090087LDFLAGS += $(PLATFORM_LDFLAGS)
Haiying Wang6dc1eceb2011-02-22 16:38:05 -050088LDFLAGS_FINAL += -Bstatic
Masahiro Yamada026f9cf2014-03-05 16:59:40 +090089
90export PLATFORM_CPPFLAGS
91export RELFLAGS
92export LDFLAGS_FINAL
93export CONFIG_STANDALONE_LOAD_ADDR