Tom Rini | 10e4779 | 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 | 1234ce7 | 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 | 958fe8f | 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 := |
Tom Rini | 5d4ecf2 | 2020-03-27 11:46:27 -0400 | [diff] [blame] | 15 | KBUILD_LDFLAGS := |
Masahiro Yamada | 958fe8f | 2014-03-05 16:59:40 +0900 | [diff] [blame] | 16 | LDFLAGS_FINAL := |
Daniel Schwierzeck | 9dc13da | 2018-09-23 19:15:15 +0200 | [diff] [blame] | 17 | LDFLAGS_STANDALONE := |
Masahiro Yamada | 958fe8f | 2014-03-05 16:59:40 +0900 | [diff] [blame] | 18 | OBJCOPYFLAGS := |
Masahiro Yamada | dc1baa2 | 2014-10-21 13:18:32 +0900 | [diff] [blame] | 19 | # clear VENDOR for tcsh |
| 20 | VENDOR := |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 21 | ######################################################################### |
Wolfgang Denk | 979b4bd | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 22 | |
Masahiro Yamada | 60bb734 | 2014-07-30 14:08:17 +0900 | [diff] [blame] | 23 | ARCH := $(CONFIG_SYS_ARCH:"%"=%) |
| 24 | CPU := $(CONFIG_SYS_CPU:"%"=%) |
Masahiro Yamada | 72fb32b | 2015-02-24 22:26:20 +0900 | [diff] [blame] | 25 | ifdef CONFIG_SPL_BUILD |
Trevor Woerner | 513f640 | 2020-05-06 08:02:41 -0400 | [diff] [blame] | 26 | ifdef CONFIG_ARCH_TEGRA |
Masahiro Yamada | 72fb32b | 2015-02-24 22:26:20 +0900 | [diff] [blame] | 27 | CPU := arm720t |
| 28 | endif |
| 29 | endif |
Masahiro Yamada | 60bb734 | 2014-07-30 14:08:17 +0900 | [diff] [blame] | 30 | BOARD := $(CONFIG_SYS_BOARD:"%"=%) |
| 31 | ifneq ($(CONFIG_SYS_VENDOR),) |
| 32 | VENDOR := $(CONFIG_SYS_VENDOR:"%"=%) |
| 33 | endif |
| 34 | ifneq ($(CONFIG_SYS_SOC),) |
| 35 | SOC := $(CONFIG_SYS_SOC:"%"=%) |
| 36 | endif |
| 37 | |
Peter Tyser | d53e8fd | 2010-04-12 22:28:02 -0500 | [diff] [blame] | 38 | # 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 Tyser | 29514c7 | 2010-04-12 22:28:09 -0500 | [diff] [blame] | 40 | # Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains |
| 41 | # CPU-specific code. |
Masahiro Yamada | c5b2a00 | 2014-06-24 22:10:52 +0900 | [diff] [blame] | 42 | CPUDIR=arch/$(ARCH)/cpu$(if $(CPU),/$(CPU),) |
Peter Tyser | d53e8fd | 2010-04-12 22:28:02 -0500 | [diff] [blame] | 43 | |
Masahiro Yamada | e794494 | 2014-03-11 11:05:19 +0900 | [diff] [blame] | 44 | sinclude $(srctree)/arch/$(ARCH)/config.mk # include architecture dependend rules |
| 45 | sinclude $(srctree)/$(CPUDIR)/config.mk # include CPU specific rules |
Peter Tyser | d53e8fd | 2010-04-12 22:28:02 -0500 | [diff] [blame] | 46 | |
Wolfgang Denk | 979b4bd | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 47 | ifdef SOC |
Masahiro Yamada | e794494 | 2014-03-11 11:05:19 +0900 | [diff] [blame] | 48 | sinclude $(srctree)/$(CPUDIR)/$(SOC)/config.mk # include SoC specific rules |
Wolfgang Denk | 979b4bd | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 49 | endif |
Masahiro Yamada | b93b213 | 2014-03-03 19:03:17 +0900 | [diff] [blame] | 50 | ifneq ($(BOARD),) |
Wolfgang Denk | 979b4bd | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 51 | ifdef VENDOR |
| 52 | BOARDDIR = $(VENDOR)/$(BOARD) |
Simon Glass | 7327fe7 | 2021-10-21 21:08:46 -0600 | [diff] [blame] | 53 | ENVDIR=${vendor}/env |
Wolfgang Denk | 979b4bd | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 54 | else |
| 55 | BOARDDIR = $(BOARD) |
Simon Glass | 7327fe7 | 2021-10-21 21:08:46 -0600 | [diff] [blame] | 56 | ENVDIR=${board}/env |
Wolfgang Denk | 979b4bd | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 57 | endif |
Masahiro Yamada | b93b213 | 2014-03-03 19:03:17 +0900 | [diff] [blame] | 58 | endif |
Wolfgang Denk | 979b4bd | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 59 | ifdef BOARD |
Masahiro Yamada | e794494 | 2014-03-11 11:05:19 +0900 | [diff] [blame] | 60 | sinclude $(srctree)/board/$(BOARDDIR)/config.mk # include board specific rules |
Wolfgang Denk | 979b4bd | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 61 | endif |
| 62 | |
Simon Glass | 385375d | 2014-09-14 12:40:14 -0600 | [diff] [blame] | 63 | ifdef FTRACE |
| 64 | PLATFORM_CPPFLAGS += -finstrument-functions -DFTRACE |
| 65 | endif |
| 66 | |
Wolfgang Denk | 979b4bd | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 67 | ######################################################################### |
| 68 | |
Masahiro Yamada | 958fe8f | 2014-03-05 16:59:40 +0900 | [diff] [blame] | 69 | RELFLAGS := $(PLATFORM_RELFLAGS) |
Scott Wood | 34c6dd2 | 2011-04-06 13:31:37 +0000 | [diff] [blame] | 70 | |
Masahiro Yamada | 958fe8f | 2014-03-05 16:59:40 +0900 | [diff] [blame] | 71 | PLATFORM_CPPFLAGS += $(RELFLAGS) |
| 72 | PLATFORM_CPPFLAGS += -pipe |
Tom Rini | b7f3413 | 2012-02-20 13:50:10 +0000 | [diff] [blame] | 73 | |
Haiying Wang | 3935873 | 2011-02-22 16:38:05 -0500 | [diff] [blame] | 74 | LDFLAGS_FINAL += -Bstatic |
Masahiro Yamada | 958fe8f | 2014-03-05 16:59:40 +0900 | [diff] [blame] | 75 | |
| 76 | export PLATFORM_CPPFLAGS |
| 77 | export RELFLAGS |
| 78 | export LDFLAGS_FINAL |
Daniel Schwierzeck | 9dc13da | 2018-09-23 19:15:15 +0200 | [diff] [blame] | 79 | export LDFLAGS_STANDALONE |
Masahiro Yamada | 958fe8f | 2014-03-05 16:59:40 +0900 | [diff] [blame] | 80 | export CONFIG_STANDALONE_LOAD_ADDR |