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 | |
wdenk | dbae504 | 2003-06-21 00:17:24 +0000 | [diff] [blame] | 9 | # clean the slate ... |
| 10 | PLATFORM_RELFLAGS = |
| 11 | PLATFORM_CPPFLAGS = |
| 12 | PLATFORM_LDFLAGS = |
| 13 | |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 14 | ######################################################################### |
Wolfgang Denk | 979b4bd | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 15 | |
| 16 | # Load generated board configuration |
Ying Zhang | 2d2e3b6 | 2013-08-16 15:16:15 +0800 | [diff] [blame] | 17 | ifeq ($(CONFIG_TPL_BUILD),y) |
| 18 | # Include TPL autoconf |
Masahiro Yamada | 59f15f2 | 2014-02-04 17:24:24 +0900 | [diff] [blame^] | 19 | sinclude include/tpl-autoconf.mk |
Ying Zhang | 2d2e3b6 | 2013-08-16 15:16:15 +0800 | [diff] [blame] | 20 | else |
Joel Fernandes | 2c8c3c2 | 2013-08-19 16:14:14 +0800 | [diff] [blame] | 21 | ifeq ($(CONFIG_SPL_BUILD),y) |
| 22 | # Include SPL autoconf |
Masahiro Yamada | 59f15f2 | 2014-02-04 17:24:24 +0900 | [diff] [blame^] | 23 | sinclude include/spl-autoconf.mk |
Joel Fernandes | 2c8c3c2 | 2013-08-19 16:14:14 +0800 | [diff] [blame] | 24 | else |
| 25 | # Include normal autoconf |
Masahiro Yamada | 59f15f2 | 2014-02-04 17:24:24 +0900 | [diff] [blame^] | 26 | sinclude include/autoconf.mk |
Joel Fernandes | 2c8c3c2 | 2013-08-19 16:14:14 +0800 | [diff] [blame] | 27 | endif |
Ying Zhang | 2d2e3b6 | 2013-08-16 15:16:15 +0800 | [diff] [blame] | 28 | endif |
Joakim Tjernlund | 31162e1 | 2011-01-17 23:39:26 +0100 | [diff] [blame] | 29 | sinclude $(OBJTREE)/include/config.mk |
Wolfgang Denk | 979b4bd | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 30 | |
Peter Tyser | d53e8fd | 2010-04-12 22:28:02 -0500 | [diff] [blame] | 31 | # Some architecture config.mk files need to know what CPUDIR is set to, |
| 32 | # so calculate CPUDIR before including ARCH/SOC/CPU config.mk files. |
Peter Tyser | 29514c7 | 2010-04-12 22:28:09 -0500 | [diff] [blame] | 33 | # Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains |
| 34 | # CPU-specific code. |
| 35 | CPUDIR=arch/$(ARCH)/cpu/$(CPU) |
| 36 | ifneq ($(SRCTREE)/$(CPUDIR),$(wildcard $(SRCTREE)/$(CPUDIR))) |
| 37 | CPUDIR=arch/$(ARCH)/cpu |
| 38 | endif |
Peter Tyser | d53e8fd | 2010-04-12 22:28:02 -0500 | [diff] [blame] | 39 | |
Peter Tyser | cede5d8 | 2010-04-12 22:28:04 -0500 | [diff] [blame] | 40 | sinclude $(TOPDIR)/arch/$(ARCH)/config.mk # include architecture dependend rules |
Peter Tyser | d53e8fd | 2010-04-12 22:28:02 -0500 | [diff] [blame] | 41 | sinclude $(TOPDIR)/$(CPUDIR)/config.mk # include CPU specific rules |
| 42 | |
Wolfgang Denk | 979b4bd | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 43 | ifdef SOC |
Peter Tyser | d53e8fd | 2010-04-12 22:28:02 -0500 | [diff] [blame] | 44 | sinclude $(TOPDIR)/$(CPUDIR)/$(SOC)/config.mk # include SoC specific rules |
Wolfgang Denk | 979b4bd | 2008-05-03 22:25:00 +0200 | [diff] [blame] | 45 | endif |
| 46 | ifdef VENDOR |
| 47 | BOARDDIR = $(VENDOR)/$(BOARD) |
| 48 | else |
| 49 | BOARDDIR = $(BOARD) |
| 50 | endif |
| 51 | ifdef BOARD |
| 52 | sinclude $(TOPDIR)/board/$(BOARDDIR)/config.mk # include board specific rules |
| 53 | endif |
| 54 | |
| 55 | ######################################################################### |
| 56 | |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 57 | RELFLAGS= $(PLATFORM_RELFLAGS) |
Scott Wood | 34c6dd2 | 2011-04-06 13:31:37 +0000 | [diff] [blame] | 58 | |
wdenk | b00ec16 | 2003-06-19 23:40:20 +0000 | [diff] [blame] | 59 | OBJCFLAGS += --gap-fill=0xff |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 60 | |
Masahiro Yamada | 700dd89 | 2014-02-04 17:24:19 +0900 | [diff] [blame] | 61 | CPPFLAGS = $(KBUILD_CPPFLAGS) $(RELFLAGS) |
Masahiro Yamada | 0302445 | 2014-02-04 17:24:20 +0900 | [diff] [blame] | 62 | CPPFLAGS += $(UBOOTINCLUDE) |
| 63 | CPPFLAGS += $(NOSTDINC_FLAGS) -pipe $(PLATFORM_CPPFLAGS) |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 64 | |
Masahiro Yamada | 700dd89 | 2014-02-04 17:24:19 +0900 | [diff] [blame] | 65 | CFLAGS := $(KBUILD_CFLAGS) $(CPPFLAGS) |
Tom Rini | b7f3413 | 2012-02-20 13:50:10 +0000 | [diff] [blame] | 66 | |
Simon Glass | 831aa54 | 2013-06-11 11:14:41 -0700 | [diff] [blame] | 67 | BCURDIR = $(subst $(SRCTREE)/,,$(CURDIR:$(obj)%=%)) |
| 68 | |
Masahiro Yamada | 700dd89 | 2014-02-04 17:24:19 +0900 | [diff] [blame] | 69 | AFLAGS := $(KBUILD_AFLAGS) $(CPPFLAGS) |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 70 | |
Nobuhiro Iwamatsu | b859b8c | 2011-01-06 10:23:54 +0900 | [diff] [blame] | 71 | LDFLAGS += $(PLATFORM_LDFLAGS) |
Haiying Wang | 3935873 | 2011-02-22 16:38:05 -0500 | [diff] [blame] | 72 | LDFLAGS_FINAL += -Bstatic |
Nobuhiro Iwamatsu | b859b8c | 2011-01-06 10:23:54 +0900 | [diff] [blame] | 73 | |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 74 | ######################################################################### |
| 75 | |
Masahiro Yamada | 41ec9ba | 2014-02-04 17:24:21 +0900 | [diff] [blame] | 76 | export PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS |