wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 1 | # |
Wolfgang Denk | 1234ce7 | 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 | 1234ce7 | 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 | 958fe8f | 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 := |
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:"%"=%) |
| 25 | BOARD := $(CONFIG_SYS_BOARD:"%"=%) |
| 26 | ifneq ($(CONFIG_SYS_VENDOR),) |
| 27 | VENDOR := $(CONFIG_SYS_VENDOR:"%"=%) |
| 28 | endif |
| 29 | ifneq ($(CONFIG_SYS_SOC),) |
| 30 | SOC := $(CONFIG_SYS_SOC:"%"=%) |
| 31 | endif |
| 32 | |
Peter Tyser | d53e8fd | 2010-04-12 22:28:02 -0500 | [diff] [blame] | 33 | # Some architecture config.mk files need to know what CPUDIR is set to, |
| 34 | # so calculate CPUDIR before including ARCH/SOC/CPU config.mk files. |
Peter Tyser | 29514c7 | 2010-04-12 22:28:09 -0500 | [diff] [blame] | 35 | # Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains |
| 36 | # CPU-specific code. |
Masahiro Yamada | c5b2a00 | 2014-06-24 22:10:52 +0900 | [diff] [blame] | 37 | CPUDIR=arch/$(ARCH)/cpu$(if $(CPU),/$(CPU),) |
Peter Tyser | d53e8fd | 2010-04-12 22:28:02 -0500 | [diff] [blame] | 38 | |
Masahiro Yamada | e794494 | 2014-03-11 11:05:19 +0900 | [diff] [blame] | 39 | sinclude $(srctree)/arch/$(ARCH)/config.mk # include architecture dependend rules |
| 40 | sinclude $(srctree)/$(CPUDIR)/config.mk # include CPU specific rules |
Peter Tyser | d53e8fd | 2010-04-12 22:28:02 -0500 | [diff] [blame] | 41 | |
Wolfgang Denk | 979b4bd | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 42 | ifdef SOC |
Masahiro Yamada | e794494 | 2014-03-11 11:05:19 +0900 | [diff] [blame] | 43 | sinclude $(srctree)/$(CPUDIR)/$(SOC)/config.mk # include SoC specific rules |
Wolfgang Denk | 979b4bd | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 44 | endif |
Masahiro Yamada | b93b213 | 2014-03-03 19:03:17 +0900 | [diff] [blame] | 45 | ifneq ($(BOARD),) |
Wolfgang Denk | 979b4bd | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 46 | ifdef VENDOR |
| 47 | BOARDDIR = $(VENDOR)/$(BOARD) |
| 48 | else |
| 49 | BOARDDIR = $(BOARD) |
| 50 | endif |
Masahiro Yamada | b93b213 | 2014-03-03 19:03:17 +0900 | [diff] [blame] | 51 | endif |
Wolfgang Denk | 979b4bd | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 52 | ifdef BOARD |
Masahiro Yamada | e794494 | 2014-03-11 11:05:19 +0900 | [diff] [blame] | 53 | sinclude $(srctree)/board/$(BOARDDIR)/config.mk # include board specific rules |
Wolfgang Denk | 979b4bd | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 54 | endif |
| 55 | |
| 56 | ######################################################################### |
| 57 | |
Masahiro Yamada | 958fe8f | 2014-03-05 16:59:40 +0900 | [diff] [blame] | 58 | RELFLAGS := $(PLATFORM_RELFLAGS) |
Scott Wood | 34c6dd2 | 2011-04-06 13:31:37 +0000 | [diff] [blame] | 59 | |
Masahiro Yamada | c9c83ba | 2014-02-24 11:12:12 +0900 | [diff] [blame] | 60 | OBJCOPYFLAGS += --gap-fill=0xff |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 61 | |
Masahiro Yamada | 958fe8f | 2014-03-05 16:59:40 +0900 | [diff] [blame] | 62 | PLATFORM_CPPFLAGS += $(RELFLAGS) |
| 63 | PLATFORM_CPPFLAGS += -pipe |
Tom Rini | b7f3413 | 2012-02-20 13:50:10 +0000 | [diff] [blame] | 64 | |
Nobuhiro Iwamatsu | b859b8c | 2011-01-06 10:23:54 +0900 | [diff] [blame] | 65 | LDFLAGS += $(PLATFORM_LDFLAGS) |
Haiying Wang | 3935873 | 2011-02-22 16:38:05 -0500 | [diff] [blame] | 66 | LDFLAGS_FINAL += -Bstatic |
Masahiro Yamada | 958fe8f | 2014-03-05 16:59:40 +0900 | [diff] [blame] | 67 | |
| 68 | export PLATFORM_CPPFLAGS |
| 69 | export RELFLAGS |
| 70 | export LDFLAGS_FINAL |
| 71 | export CONFIG_STANDALONE_LOAD_ADDR |