wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 1 | # |
Wolfgang Denk | eca3aeb | 2013-06-21 10:22:36 +0200 | [diff] [blame] | 2 | # (C) Copyright 2000-2013 |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 3 | # Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 4 | # |
Wolfgang Denk | eca3aeb | 2013-06-21 10:22:36 +0200 | [diff] [blame] | 5 | # SPDX-License-Identifier: GPL-2.0+ |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 6 | # |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 7 | ######################################################################### |
| 8 | |
Masahiro Yamada | 026f9cf | 2014-03-05 16:59:40 +0900 | [diff] [blame] | 9 | # 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...) |
| 15 | PLATFORM_RELFLAGS := |
| 16 | PLATFORM_CPPFLAGS := |
| 17 | PLATFORM_LDFLAGS := |
| 18 | LDFLAGS := |
| 19 | LDFLAGS_FINAL := |
| 20 | OBJCOPYFLAGS := |
Masahiro Yamada | 5b3ee38 | 2014-10-21 13:18:32 +0900 | [diff] [blame] | 21 | # clear VENDOR for tcsh |
| 22 | VENDOR := |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 23 | ######################################################################### |
Wolfgang Denk | c4e5f52 | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 24 | |
Masahiro Yamada | 5114879 | 2014-07-30 14:08:17 +0900 | [diff] [blame] | 25 | ARCH := $(CONFIG_SYS_ARCH:"%"=%) |
| 26 | CPU := $(CONFIG_SYS_CPU:"%"=%) |
Masahiro Yamada | e02ee25 | 2015-02-24 22:26:20 +0900 | [diff] [blame] | 27 | ifdef CONFIG_SPL_BUILD |
| 28 | ifdef CONFIG_TEGRA |
| 29 | CPU := arm720t |
| 30 | endif |
| 31 | endif |
Masahiro Yamada | 5114879 | 2014-07-30 14:08:17 +0900 | [diff] [blame] | 32 | BOARD := $(CONFIG_SYS_BOARD:"%"=%) |
| 33 | ifneq ($(CONFIG_SYS_VENDOR),) |
| 34 | VENDOR := $(CONFIG_SYS_VENDOR:"%"=%) |
| 35 | endif |
| 36 | ifneq ($(CONFIG_SYS_SOC),) |
| 37 | SOC := $(CONFIG_SYS_SOC:"%"=%) |
| 38 | endif |
Manoharan Vijaya Raghavan | f338b81 | 2016-10-06 22:44:38 +0530 | [diff] [blame] | 39 | ifeq ($(CONFIG_OF_COMBINE),) |
| 40 | ifneq ($(CONFIG_OF_SEPERATE),) |
| 41 | OBJCOPYFLAGS += -j .text -j .secure_text -j .rodata -j .hash -j .data -j .got -j .got.plt -j .u_boot_list |
| 42 | endif |
| 43 | else |
| 44 | OBJCOPYFLAGS += -j .text -j .secure_text -j .rodata -j .hash -j .data -j .got -j .got.plt -j .u_boot_list -j .dtb |
| 45 | endif |
| 46 | |
Masahiro Yamada | 5114879 | 2014-07-30 14:08:17 +0900 | [diff] [blame] | 47 | |
Peter Tyser | 03b7004 | 2010-04-12 22:28:02 -0500 | [diff] [blame] | 48 | # 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 Tyser | 8d1f268 | 2010-04-12 22:28:09 -0500 | [diff] [blame] | 50 | # Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains |
| 51 | # CPU-specific code. |
Masahiro Yamada | a8b0f9b | 2014-06-24 22:10:52 +0900 | [diff] [blame] | 52 | CPUDIR=arch/$(ARCH)/cpu$(if $(CPU),/$(CPU),) |
Peter Tyser | 03b7004 | 2010-04-12 22:28:02 -0500 | [diff] [blame] | 53 | |
Masahiro Yamada | 4379ac6 | 2014-03-11 11:05:19 +0900 | [diff] [blame] | 54 | sinclude $(srctree)/arch/$(ARCH)/config.mk # include architecture dependend rules |
| 55 | sinclude $(srctree)/$(CPUDIR)/config.mk # include CPU specific rules |
Peter Tyser | 03b7004 | 2010-04-12 22:28:02 -0500 | [diff] [blame] | 56 | |
Wolfgang Denk | c4e5f52 | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 57 | ifdef SOC |
Masahiro Yamada | 4379ac6 | 2014-03-11 11:05:19 +0900 | [diff] [blame] | 58 | sinclude $(srctree)/$(CPUDIR)/$(SOC)/config.mk # include SoC specific rules |
Wolfgang Denk | c4e5f52 | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 59 | endif |
Masahiro Yamada | 33a02da | 2014-03-03 19:03:17 +0900 | [diff] [blame] | 60 | ifneq ($(BOARD),) |
Wolfgang Denk | c4e5f52 | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 61 | ifdef VENDOR |
| 62 | BOARDDIR = $(VENDOR)/$(BOARD) |
| 63 | else |
| 64 | BOARDDIR = $(BOARD) |
| 65 | endif |
Masahiro Yamada | 33a02da | 2014-03-03 19:03:17 +0900 | [diff] [blame] | 66 | endif |
Wolfgang Denk | c4e5f52 | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 67 | ifdef BOARD |
Masahiro Yamada | 4379ac6 | 2014-03-11 11:05:19 +0900 | [diff] [blame] | 68 | sinclude $(srctree)/board/$(BOARDDIR)/config.mk # include board specific rules |
Wolfgang Denk | c4e5f52 | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 69 | endif |
| 70 | |
Simon Glass | b845052 | 2014-09-14 12:40:14 -0600 | [diff] [blame] | 71 | ifdef FTRACE |
| 72 | PLATFORM_CPPFLAGS += -finstrument-functions -DFTRACE |
| 73 | endif |
| 74 | |
Gabe Black | 0d296cc | 2014-10-15 04:38:30 -0600 | [diff] [blame] | 75 | # Allow use of stdint.h if available |
| 76 | ifneq ($(USE_STDINT),) |
| 77 | PLATFORM_CPPFLAGS += -DCONFIG_USE_STDINT |
| 78 | endif |
| 79 | |
Wolfgang Denk | c4e5f52 | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 80 | ######################################################################### |
| 81 | |
Masahiro Yamada | 026f9cf | 2014-03-05 16:59:40 +0900 | [diff] [blame] | 82 | RELFLAGS := $(PLATFORM_RELFLAGS) |
Scott Wood | 83b7e2a | 2011-04-06 13:31:37 +0000 | [diff] [blame] | 83 | |
Masahiro Yamada | 026f9cf | 2014-03-05 16:59:40 +0900 | [diff] [blame] | 84 | PLATFORM_CPPFLAGS += $(RELFLAGS) |
| 85 | PLATFORM_CPPFLAGS += -pipe |
Tom Rini | 4a30f1e | 2012-02-20 13:50:10 +0000 | [diff] [blame] | 86 | |
Nobuhiro Iwamatsu | 8aba9dc | 2011-01-06 10:23:54 +0900 | [diff] [blame] | 87 | LDFLAGS += $(PLATFORM_LDFLAGS) |
Haiying Wang | 6dc1eceb | 2011-02-22 16:38:05 -0500 | [diff] [blame] | 88 | LDFLAGS_FINAL += -Bstatic |
Masahiro Yamada | 026f9cf | 2014-03-05 16:59:40 +0900 | [diff] [blame] | 89 | |
| 90 | export PLATFORM_CPPFLAGS |
| 91 | export RELFLAGS |
| 92 | export LDFLAGS_FINAL |
| 93 | export CONFIG_STANDALONE_LOAD_ADDR |