blob: 0fa316743ce99476a8bedb77fded14f28c3821f5 [file] [log] [blame]
wdenke2211742002-11-02 23:30:20 +00001#
Wolfgang Denk1234ce72013-06-21 10:22:36 +02002# (C) Copyright 2000-2013
wdenke2211742002-11-02 23:30:20 +00003# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4#
Wolfgang Denk1234ce72013-06-21 10:22:36 +02005# SPDX-License-Identifier: GPL-2.0+
wdenke2211742002-11-02 23:30:20 +00006#
wdenke2211742002-11-02 23:30:20 +00007#########################################################################
8
wdenkdbae5042003-06-21 00:17:24 +00009# clean the slate ...
10PLATFORM_RELFLAGS =
11PLATFORM_CPPFLAGS =
12PLATFORM_LDFLAGS =
13
wdenke2211742002-11-02 23:30:20 +000014#########################################################################
Wolfgang Denk979b4bd2008-05-03 22:25:00 +020015
16# Load generated board configuration
Ying Zhang2d2e3b62013-08-16 15:16:15 +080017ifeq ($(CONFIG_TPL_BUILD),y)
18# Include TPL autoconf
Masahiro Yamada59f15f22014-02-04 17:24:24 +090019sinclude include/tpl-autoconf.mk
Ying Zhang2d2e3b62013-08-16 15:16:15 +080020else
Joel Fernandes2c8c3c22013-08-19 16:14:14 +080021ifeq ($(CONFIG_SPL_BUILD),y)
22# Include SPL autoconf
Masahiro Yamada59f15f22014-02-04 17:24:24 +090023sinclude include/spl-autoconf.mk
Joel Fernandes2c8c3c22013-08-19 16:14:14 +080024else
25# Include normal autoconf
Masahiro Yamada59f15f22014-02-04 17:24:24 +090026sinclude include/autoconf.mk
Joel Fernandes2c8c3c22013-08-19 16:14:14 +080027endif
Ying Zhang2d2e3b62013-08-16 15:16:15 +080028endif
Joakim Tjernlund31162e12011-01-17 23:39:26 +010029sinclude $(OBJTREE)/include/config.mk
Wolfgang Denk979b4bd2008-05-03 22:25:00 +020030
Peter Tyserd53e8fd2010-04-12 22:28:02 -050031# 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 Tyser29514c72010-04-12 22:28:09 -050033# Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains
34# CPU-specific code.
35CPUDIR=arch/$(ARCH)/cpu/$(CPU)
36ifneq ($(SRCTREE)/$(CPUDIR),$(wildcard $(SRCTREE)/$(CPUDIR)))
37CPUDIR=arch/$(ARCH)/cpu
38endif
Peter Tyserd53e8fd2010-04-12 22:28:02 -050039
Peter Tysercede5d82010-04-12 22:28:04 -050040sinclude $(TOPDIR)/arch/$(ARCH)/config.mk # include architecture dependend rules
Peter Tyserd53e8fd2010-04-12 22:28:02 -050041sinclude $(TOPDIR)/$(CPUDIR)/config.mk # include CPU specific rules
42
Wolfgang Denk979b4bd2008-05-03 22:25:00 +020043ifdef SOC
Peter Tyserd53e8fd2010-04-12 22:28:02 -050044sinclude $(TOPDIR)/$(CPUDIR)/$(SOC)/config.mk # include SoC specific rules
Wolfgang Denk979b4bd2008-05-03 22:25:00 +020045endif
46ifdef VENDOR
47BOARDDIR = $(VENDOR)/$(BOARD)
48else
49BOARDDIR = $(BOARD)
50endif
51ifdef BOARD
52sinclude $(TOPDIR)/board/$(BOARDDIR)/config.mk # include board specific rules
53endif
54
55#########################################################################
56
wdenke2211742002-11-02 23:30:20 +000057RELFLAGS= $(PLATFORM_RELFLAGS)
Scott Wood34c6dd22011-04-06 13:31:37 +000058
wdenkb00ec162003-06-19 23:40:20 +000059OBJCFLAGS += --gap-fill=0xff
wdenke2211742002-11-02 23:30:20 +000060
Masahiro Yamada700dd892014-02-04 17:24:19 +090061CPPFLAGS = $(KBUILD_CPPFLAGS) $(RELFLAGS)
Masahiro Yamada03024452014-02-04 17:24:20 +090062CPPFLAGS += $(UBOOTINCLUDE)
63CPPFLAGS += $(NOSTDINC_FLAGS) -pipe $(PLATFORM_CPPFLAGS)
wdenke2211742002-11-02 23:30:20 +000064
Masahiro Yamada700dd892014-02-04 17:24:19 +090065CFLAGS := $(KBUILD_CFLAGS) $(CPPFLAGS)
Tom Rinib7f34132012-02-20 13:50:10 +000066
Simon Glass831aa542013-06-11 11:14:41 -070067BCURDIR = $(subst $(SRCTREE)/,,$(CURDIR:$(obj)%=%))
68
Masahiro Yamada700dd892014-02-04 17:24:19 +090069AFLAGS := $(KBUILD_AFLAGS) $(CPPFLAGS)
wdenke2211742002-11-02 23:30:20 +000070
Nobuhiro Iwamatsub859b8c2011-01-06 10:23:54 +090071LDFLAGS += $(PLATFORM_LDFLAGS)
Haiying Wang39358732011-02-22 16:38:05 -050072LDFLAGS_FINAL += -Bstatic
Nobuhiro Iwamatsub859b8c2011-01-06 10:23:54 +090073
wdenke2211742002-11-02 23:30:20 +000074#########################################################################
75
Masahiro Yamada41ec9ba2014-02-04 17:24:21 +090076export PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS