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