xref: /rk3399_rockchip-uboot/config.mk (revision fea1ca8e3418bac4b55f4cc8b66a6ae0d41e91e4)
1#
2# (C) Copyright 2000-2013
3# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4#
5# SPDX-License-Identifier:	GPL-2.0+
6#
7#########################################################################
8
9ifeq ($(CURDIR),$(SRCTREE))
10dir :=
11else
12dir := $(subst $(SRCTREE)/,,$(CURDIR))
13endif
14
15ifneq ($(OBJTREE),$(SRCTREE))
16# Create object files for SPL in a separate directory
17ifeq ($(CONFIG_SPL_BUILD),y)
18ifeq ($(CONFIG_TPL_BUILD),y)
19obj := $(if $(dir),$(TPLTREE)/$(dir)/,$(TPLTREE)/)
20else
21obj := $(if $(dir),$(SPLTREE)/$(dir)/,$(SPLTREE)/)
22endif
23else
24obj := $(if $(dir),$(OBJTREE)/$(dir)/,$(OBJTREE)/)
25endif
26src := $(if $(dir),$(SRCTREE)/$(dir)/,$(SRCTREE)/)
27
28$(shell mkdir -p $(obj))
29else
30# Create object files for SPL in a separate directory
31ifeq ($(CONFIG_SPL_BUILD),y)
32ifeq ($(CONFIG_TPL_BUILD),y)
33obj := $(if $(dir),$(TPLTREE)/$(dir)/,$(TPLTREE)/)
34else
35obj := $(if $(dir),$(SPLTREE)/$(dir)/,$(SPLTREE)/)
36
37endif
38$(shell mkdir -p $(obj))
39else
40obj :=
41endif
42src :=
43endif
44
45# clean the slate ...
46PLATFORM_RELFLAGS =
47PLATFORM_CPPFLAGS =
48PLATFORM_LDFLAGS =
49
50#########################################################################
51
52# Load generated board configuration
53ifeq ($(CONFIG_TPL_BUILD),y)
54# Include TPL autoconf
55sinclude $(OBJTREE)/include/tpl-autoconf.mk
56else
57ifeq ($(CONFIG_SPL_BUILD),y)
58# Include SPL autoconf
59sinclude $(OBJTREE)/include/spl-autoconf.mk
60else
61# Include normal autoconf
62sinclude $(OBJTREE)/include/autoconf.mk
63endif
64endif
65sinclude $(OBJTREE)/include/config.mk
66
67# Some architecture config.mk files need to know what CPUDIR is set to,
68# so calculate CPUDIR before including ARCH/SOC/CPU config.mk files.
69# Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains
70# CPU-specific code.
71CPUDIR=arch/$(ARCH)/cpu/$(CPU)
72ifneq ($(SRCTREE)/$(CPUDIR),$(wildcard $(SRCTREE)/$(CPUDIR)))
73CPUDIR=arch/$(ARCH)/cpu
74endif
75
76sinclude $(TOPDIR)/arch/$(ARCH)/config.mk	# include architecture dependend rules
77sinclude $(TOPDIR)/$(CPUDIR)/config.mk		# include  CPU	specific rules
78
79ifdef	SOC
80sinclude $(TOPDIR)/$(CPUDIR)/$(SOC)/config.mk	# include  SoC	specific rules
81endif
82ifdef	VENDOR
83BOARDDIR = $(VENDOR)/$(BOARD)
84else
85BOARDDIR = $(BOARD)
86endif
87ifdef	BOARD
88sinclude $(TOPDIR)/board/$(BOARDDIR)/config.mk	# include board specific rules
89endif
90
91#########################################################################
92
93RELFLAGS= $(PLATFORM_RELFLAGS)
94
95OBJCFLAGS += --gap-fill=0xff
96
97CPPFLAGS = $(KBUILD_CPPFLAGS) $(RELFLAGS)
98
99# Enable garbage collection of un-used sections for SPL
100ifeq ($(CONFIG_SPL_BUILD),y)
101CPPFLAGS += -ffunction-sections -fdata-sections
102LDFLAGS_FINAL += --gc-sections
103endif
104
105ifneq ($(CONFIG_SYS_TEXT_BASE),)
106CPPFLAGS += -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE)
107endif
108
109ifeq ($(CONFIG_SPL_BUILD),y)
110CPPFLAGS += -DCONFIG_SPL_BUILD
111ifeq ($(CONFIG_TPL_BUILD),y)
112CPPFLAGS += -DCONFIG_TPL_BUILD
113endif
114endif
115
116# Does this architecture support generic board init?
117ifeq ($(__HAVE_ARCH_GENERIC_BOARD),)
118ifneq ($(CONFIG_SYS_GENERIC_BOARD),)
119CHECK_GENERIC_BOARD = $(error Your architecture does not support generic board. \
120Please undefined CONFIG_SYS_GENERIC_BOARD in your board config file)
121endif
122endif
123
124CPPFLAGS += $(UBOOTINCLUDE)
125CPPFLAGS += $(NOSTDINC_FLAGS) -pipe $(PLATFORM_CPPFLAGS)
126
127CFLAGS := $(KBUILD_CFLAGS) $(CPPFLAGS)
128
129BCURDIR = $(subst $(SRCTREE)/,,$(CURDIR:$(obj)%=%))
130
131ifeq ($(findstring examples/,$(BCURDIR)),)
132ifeq ($(CONFIG_SPL_BUILD),)
133ifdef FTRACE
134CFLAGS += -finstrument-functions -DFTRACE
135endif
136endif
137endif
138
139AFLAGS := $(KBUILD_AFLAGS) $(CPPFLAGS)
140
141LDFLAGS += $(PLATFORM_LDFLAGS)
142LDFLAGS_FINAL += -Bstatic
143
144LDFLAGS_u-boot += -T $(obj)u-boot.lds $(LDFLAGS_FINAL)
145ifneq ($(CONFIG_SYS_TEXT_BASE),)
146LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE)
147endif
148
149LDFLAGS_$(SPL_BIN) += -T $(obj)u-boot-spl.lds $(LDFLAGS_FINAL)
150ifneq ($(CONFIG_SPL_TEXT_BASE),)
151LDFLAGS_$(SPL_BIN) += -Ttext $(CONFIG_SPL_TEXT_BASE)
152endif
153
154#########################################################################
155
156export	CONFIG_SYS_TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS
157