1# SPDX-License-Identifier: GPL-2.0+ 2# 3# (C) Copyright 2000-2013 4# Wolfgang Denk, DENX Software Engineering, wd@denx.de. 5######################################################################### 6 7# 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 := 15PLATFORM_LDFLAGS := 16LDFLAGS := 17LDFLAGS_FINAL := 18LDFLAGS_STANDALONE := 19OBJCOPYFLAGS := 20# clear VENDOR for tcsh 21VENDOR := 22######################################################################### 23 24ARCH := $(CONFIG_SYS_ARCH:"%"=%) 25CPU := $(CONFIG_SYS_CPU:"%"=%) 26ifdef CONFIG_SPL_BUILD 27ifdef CONFIG_TEGRA 28CPU := arm720t 29endif 30endif 31BOARD := $(CONFIG_SYS_BOARD:"%"=%) 32ifneq ($(CONFIG_SYS_VENDOR),) 33VENDOR := $(CONFIG_SYS_VENDOR:"%"=%) 34endif 35ifneq ($(CONFIG_SYS_SOC),) 36SOC := $(CONFIG_SYS_SOC:"%"=%) 37endif 38 39# Some architecture config.mk files need to know what CPUDIR is set to, 40# so calculate CPUDIR before including ARCH/SOC/CPU config.mk files. 41# Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains 42# CPU-specific code. 43CPUDIR=arch/$(ARCH)/cpu$(if $(CPU),/$(CPU),) 44 45sinclude $(srctree)/arch/$(ARCH)/config.mk # include architecture dependend rules 46sinclude $(srctree)/$(CPUDIR)/config.mk # include CPU specific rules 47 48ifdef SOC 49sinclude $(srctree)/$(CPUDIR)/$(SOC)/config.mk # include SoC specific rules 50endif 51ifneq ($(BOARD),) 52ifdef VENDOR 53BOARDDIR = $(VENDOR)/$(BOARD) 54else 55BOARDDIR = $(BOARD) 56endif 57endif 58ifdef BOARD 59sinclude $(srctree)/board/$(BOARDDIR)/config.mk # include board specific rules 60endif 61 62ifdef FTRACE 63PLATFORM_CPPFLAGS += -finstrument-functions -DFTRACE 64endif 65 66######################################################################### 67 68RELFLAGS := $(PLATFORM_RELFLAGS) 69 70PLATFORM_CPPFLAGS += $(RELFLAGS) 71PLATFORM_CPPFLAGS += -pipe 72 73LDFLAGS += $(PLATFORM_LDFLAGS) 74LDFLAGS_FINAL += -Bstatic 75 76export PLATFORM_CPPFLAGS 77export RELFLAGS 78export LDFLAGS_FINAL 79export LDFLAGS_STANDALONE 80export CONFIG_STANDALONE_LOAD_ADDR 81