summaryrefslogtreecommitdiff
path: root/config.mk (plain)
blob: d13f4338e847d4b1044fdc0f9d68881e50a45693
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
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...)
15PLATFORM_RELFLAGS :=
16PLATFORM_CPPFLAGS :=
17PLATFORM_LDFLAGS :=
18LDFLAGS :=
19LDFLAGS_FINAL :=
20OBJCOPYFLAGS :=
21# clear VENDOR for tcsh
22VENDOR :=
23#########################################################################
24
25ARCH := $(CONFIG_SYS_ARCH:"%"=%)
26CPU := $(CONFIG_SYS_CPU:"%"=%)
27BOARD := $(CONFIG_SYS_BOARD:"%"=%)
28ifneq ($(CONFIG_SYS_VENDOR),)
29VENDOR := $(CONFIG_SYS_VENDOR:"%"=%)
30endif
31ifneq ($(CONFIG_SYS_SOC),)
32SOC := $(CONFIG_SYS_SOC:"%"=%)
33endif
34
35# Some architecture config.mk files need to know what CPUDIR is set to,
36# so calculate CPUDIR before including ARCH/SOC/CPU config.mk files.
37# Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains
38# CPU-specific code.
39CPUDIR=arch/$(ARCH)/cpu$(if $(CPU),/$(CPU),)
40
41sinclude $(srctree)/arch/$(ARCH)/config.mk # include architecture dependend rules
42sinclude $(srctree)/$(CPUDIR)/config.mk # include CPU specific rules
43
44ifdef SOC
45sinclude $(srctree)/$(CPUDIR)/$(SOC)/config.mk # include SoC specific rules
46endif
47ifneq ($(BOARD),)
48ifeq ($(CONFIG_SUPPORT_CUSOTMER_BOARD), y) #SUPPORT_CUSOTMER_BOARD
49BOARDDIR = customer/board/$(BOARD)
50else #SUPPORT_CUSOTMER_BOARD
51ifdef VENDOR
52BOARDDIR = board/$(VENDOR)/$(BOARD)
53else
54BOARDDIR = board/$(BOARD)
55endif
56endif #SUPPORT_CUSOTMER_BOARD
57endif
58ifdef BOARD
59sinclude $(srctree)/$(BOARDDIR)/config.mk # include board specific rules
60endif
61
62ifdef FTRACE
63PLATFORM_CPPFLAGS += -finstrument-functions -DFTRACE
64endif
65
66# Allow use of stdint.h if available
67ifneq ($(USE_STDINT),)
68PLATFORM_CPPFLAGS += -DCONFIG_USE_STDINT
69endif
70
71#########################################################################
72
73RELFLAGS := $(PLATFORM_RELFLAGS)
74
75OBJCOPYFLAGS += --gap-fill=0xff
76
77PLATFORM_CPPFLAGS += $(RELFLAGS)
78PLATFORM_CPPFLAGS += -pipe
79
80LDFLAGS += $(PLATFORM_LDFLAGS)
81LDFLAGS_FINAL += -Bstatic
82
83FIRMWARE_CPPFLAGS += -I$(buildsrc)/include
84FIRMWARE_CPPFLAGS += -I$(buildsrc)/arch/$(ARCH)/include
85FIRMWARE_CPPFLAGS += -I$(buildtree)/include2 -I$(buildtree)/include
86FIRMWARE_CPPFLAGS += -include $(buildtree)/include/config.h
87FIRMWARE_CPPFLAGS += -include $(buildtree)/include/generated/autoconf.h
88FIRMWARE_CPPFLAGS += -include $(buildtree)/include/generated/version_autogenerated.h
89FIRMWARE_CPPFLAGS += -fno-builtin -ffreestanding -nostdinc \
90 -isystem $(gccincdir) -pipe $(PLATFORM_CPPFLAGS)
91FIRMWARE_CPPFLAGS += -I$(buildsrc)/board/$(BOARDDIR)/firmware
92
93export FIRMWARE_CPPFLAGS
94export PLATFORM_CPPFLAGS
95export RELFLAGS
96export LDFLAGS_FINAL
97export CONFIG_STANDALONE_LOAD_ADDR
98