Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0+ |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 2 | # |
Wolfgang Denk | eca3aeb | 2013-06-21 10:22:36 +0200 | [diff] [blame] | 3 | # (C) Copyright 2000-2013 |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 4 | # Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 5 | ######################################################################### |
| 6 | |
Masahiro Yamada | 026f9cf | 2014-03-05 16:59:40 +0900 | [diff] [blame] | 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...) |
| 13 | PLATFORM_RELFLAGS := |
| 14 | PLATFORM_CPPFLAGS := |
Masahiro Yamada | 026f9cf | 2014-03-05 16:59:40 +0900 | [diff] [blame] | 15 | LDFLAGS_FINAL := |
Daniel Schwierzeck | 1d3b97c | 2018-09-23 19:15:15 +0200 | [diff] [blame] | 16 | LDFLAGS_STANDALONE := |
Masahiro Yamada | 026f9cf | 2014-03-05 16:59:40 +0900 | [diff] [blame] | 17 | OBJCOPYFLAGS := |
Masahiro Yamada | 5b3ee38 | 2014-10-21 13:18:32 +0900 | [diff] [blame] | 18 | # clear VENDOR for tcsh |
| 19 | VENDOR := |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 20 | ######################################################################### |
Wolfgang Denk | c4e5f52 | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 21 | |
Masahiro Yamada | 5114879 | 2014-07-30 14:08:17 +0900 | [diff] [blame] | 22 | ARCH := $(CONFIG_SYS_ARCH:"%"=%) |
| 23 | CPU := $(CONFIG_SYS_CPU:"%"=%) |
Simon Glass | 1d6132e | 2024-09-29 19:49:50 -0600 | [diff] [blame] | 24 | ifdef CONFIG_XPL_BUILD |
Trevor Woerner | 18138ab | 2020-05-06 08:02:41 -0400 | [diff] [blame] | 25 | ifdef CONFIG_ARCH_TEGRA |
Masahiro Yamada | e02ee25 | 2015-02-24 22:26:20 +0900 | [diff] [blame] | 26 | CPU := arm720t |
| 27 | endif |
| 28 | endif |
Masahiro Yamada | 5114879 | 2014-07-30 14:08:17 +0900 | [diff] [blame] | 29 | BOARD := $(CONFIG_SYS_BOARD:"%"=%) |
| 30 | ifneq ($(CONFIG_SYS_VENDOR),) |
| 31 | VENDOR := $(CONFIG_SYS_VENDOR:"%"=%) |
| 32 | endif |
| 33 | ifneq ($(CONFIG_SYS_SOC),) |
| 34 | SOC := $(CONFIG_SYS_SOC:"%"=%) |
| 35 | endif |
| 36 | |
Peter Tyser | 03b7004 | 2010-04-12 22:28:02 -0500 | [diff] [blame] | 37 | # Some architecture config.mk files need to know what CPUDIR is set to, |
| 38 | # so calculate CPUDIR before including ARCH/SOC/CPU config.mk files. |
Peter Tyser | 8d1f268 | 2010-04-12 22:28:09 -0500 | [diff] [blame] | 39 | # Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains |
| 40 | # CPU-specific code. |
Masahiro Yamada | a8b0f9b | 2014-06-24 22:10:52 +0900 | [diff] [blame] | 41 | CPUDIR=arch/$(ARCH)/cpu$(if $(CPU),/$(CPU),) |
Peter Tyser | 03b7004 | 2010-04-12 22:28:02 -0500 | [diff] [blame] | 42 | |
Masahiro Yamada | 4379ac6 | 2014-03-11 11:05:19 +0900 | [diff] [blame] | 43 | sinclude $(srctree)/arch/$(ARCH)/config.mk # include architecture dependend rules |
| 44 | sinclude $(srctree)/$(CPUDIR)/config.mk # include CPU specific rules |
Peter Tyser | 03b7004 | 2010-04-12 22:28:02 -0500 | [diff] [blame] | 45 | |
Wolfgang Denk | c4e5f52 | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 46 | ifdef SOC |
Masahiro Yamada | 4379ac6 | 2014-03-11 11:05:19 +0900 | [diff] [blame] | 47 | sinclude $(srctree)/$(CPUDIR)/$(SOC)/config.mk # include SoC specific rules |
Wolfgang Denk | c4e5f52 | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 48 | endif |
Masahiro Yamada | 33a02da | 2014-03-03 19:03:17 +0900 | [diff] [blame] | 49 | ifneq ($(BOARD),) |
Wolfgang Denk | c4e5f52 | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 50 | ifdef VENDOR |
| 51 | BOARDDIR = $(VENDOR)/$(BOARD) |
Simon Glass | 86b9c3e | 2021-10-21 21:08:46 -0600 | [diff] [blame] | 52 | ENVDIR=${vendor}/env |
Wolfgang Denk | c4e5f52 | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 53 | else |
| 54 | BOARDDIR = $(BOARD) |
Simon Glass | 86b9c3e | 2021-10-21 21:08:46 -0600 | [diff] [blame] | 55 | ENVDIR=${board}/env |
Wolfgang Denk | c4e5f52 | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 56 | endif |
Masahiro Yamada | 33a02da | 2014-03-03 19:03:17 +0900 | [diff] [blame] | 57 | endif |
Wolfgang Denk | c4e5f52 | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 58 | ifdef BOARD |
Masahiro Yamada | 4379ac6 | 2014-03-11 11:05:19 +0900 | [diff] [blame] | 59 | sinclude $(srctree)/board/$(BOARDDIR)/config.mk # include board specific rules |
Wolfgang Denk | c4e5f52 | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 60 | endif |
| 61 | |
Simon Glass | b845052 | 2014-09-14 12:40:14 -0600 | [diff] [blame] | 62 | ifdef FTRACE |
| 63 | PLATFORM_CPPFLAGS += -finstrument-functions -DFTRACE |
| 64 | endif |
| 65 | |
Wolfgang Denk | c4e5f52 | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 66 | ######################################################################### |
| 67 | |
Masahiro Yamada | 026f9cf | 2014-03-05 16:59:40 +0900 | [diff] [blame] | 68 | RELFLAGS := $(PLATFORM_RELFLAGS) |
Scott Wood | 83b7e2a | 2011-04-06 13:31:37 +0000 | [diff] [blame] | 69 | |
Masahiro Yamada | 026f9cf | 2014-03-05 16:59:40 +0900 | [diff] [blame] | 70 | PLATFORM_CPPFLAGS += $(RELFLAGS) |
| 71 | PLATFORM_CPPFLAGS += -pipe |
Tom Rini | 4a30f1e | 2012-02-20 13:50:10 +0000 | [diff] [blame] | 72 | |
Haiying Wang | 6dc1eceb | 2011-02-22 16:38:05 -0500 | [diff] [blame] | 73 | LDFLAGS_FINAL += -Bstatic |
Masahiro Yamada | 026f9cf | 2014-03-05 16:59:40 +0900 | [diff] [blame] | 74 | |
| 75 | export PLATFORM_CPPFLAGS |
| 76 | export RELFLAGS |
| 77 | export LDFLAGS_FINAL |
Daniel Schwierzeck | 1d3b97c | 2018-09-23 19:15:15 +0200 | [diff] [blame] | 78 | export LDFLAGS_STANDALONE |
Masahiro Yamada | 026f9cf | 2014-03-05 16:59:40 +0900 | [diff] [blame] | 79 | export CONFIG_STANDALONE_LOAD_ADDR |