blob: 64c2951ac1eb1e6942d5bb5b3100cb871d4ef34a [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:"%"=%)
27BOARD := $(CONFIG_SYS_BOARD:"%"=%)
28ifneq ($(CONFIG_SYS_VENDOR),)
29VENDOR := $(CONFIG_SYS_VENDOR:"%"=%)
30endif
31ifneq ($(CONFIG_SYS_SOC),)
32SOC := $(CONFIG_SYS_SOC:"%"=%)
33endif
34
Peter Tyser03b70042010-04-12 22:28:02 -050035# Some architecture config.mk files need to know what CPUDIR is set to,
36# so calculate CPUDIR before including ARCH/SOC/CPU config.mk files.
Peter Tyser8d1f2682010-04-12 22:28:09 -050037# Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains
38# CPU-specific code.
Masahiro Yamadaa8b0f9b2014-06-24 22:10:52 +090039CPUDIR=arch/$(ARCH)/cpu$(if $(CPU),/$(CPU),)
Peter Tyser03b70042010-04-12 22:28:02 -050040
Masahiro Yamada4379ac62014-03-11 11:05:19 +090041sinclude $(srctree)/arch/$(ARCH)/config.mk # include architecture dependend rules
42sinclude $(srctree)/$(CPUDIR)/config.mk # include CPU specific rules
Peter Tyser03b70042010-04-12 22:28:02 -050043
Wolfgang Denkc4e5f522008-05-03 22:25:00 +020044ifdef SOC
Masahiro Yamada4379ac62014-03-11 11:05:19 +090045sinclude $(srctree)/$(CPUDIR)/$(SOC)/config.mk # include SoC specific rules
Wolfgang Denkc4e5f522008-05-03 22:25:00 +020046endif
Masahiro Yamada33a02da2014-03-03 19:03:17 +090047ifneq ($(BOARD),)
Wolfgang Denkc4e5f522008-05-03 22:25:00 +020048ifdef VENDOR
49BOARDDIR = $(VENDOR)/$(BOARD)
50else
51BOARDDIR = $(BOARD)
52endif
Masahiro Yamada33a02da2014-03-03 19:03:17 +090053endif
Wolfgang Denkc4e5f522008-05-03 22:25:00 +020054ifdef BOARD
Masahiro Yamada4379ac62014-03-11 11:05:19 +090055sinclude $(srctree)/board/$(BOARDDIR)/config.mk # include board specific rules
Wolfgang Denkc4e5f522008-05-03 22:25:00 +020056endif
57
Simon Glassb8450522014-09-14 12:40:14 -060058ifdef FTRACE
59PLATFORM_CPPFLAGS += -finstrument-functions -DFTRACE
60endif
61
Gabe Black0d296cc2014-10-15 04:38:30 -060062# Allow use of stdint.h if available
63ifneq ($(USE_STDINT),)
64PLATFORM_CPPFLAGS += -DCONFIG_USE_STDINT
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 Yamada95ddcd62014-02-24 11:12:12 +090071OBJCOPYFLAGS += --gap-fill=0xff
wdenke2211742002-11-02 23:30:20 +000072
Masahiro Yamada026f9cf2014-03-05 16:59:40 +090073PLATFORM_CPPFLAGS += $(RELFLAGS)
74PLATFORM_CPPFLAGS += -pipe
Tom Rini4a30f1e2012-02-20 13:50:10 +000075
Nobuhiro Iwamatsu8aba9dc2011-01-06 10:23:54 +090076LDFLAGS += $(PLATFORM_LDFLAGS)
Haiying Wang6dc1eceb2011-02-22 16:38:05 -050077LDFLAGS_FINAL += -Bstatic
Masahiro Yamada026f9cf2014-03-05 16:59:40 +090078
79export PLATFORM_CPPFLAGS
80export RELFLAGS
81export LDFLAGS_FINAL
82export CONFIG_STANDALONE_LOAD_ADDR