kbuild: use Linux Kernel build scripts
[platform/kernel/u-boot.git] / config.mk
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 # clean the slate ...
10 PLATFORM_RELFLAGS =
11 PLATFORM_CPPFLAGS =
12 PLATFORM_LDFLAGS =
13
14 #########################################################################
15
16 # Load generated board configuration
17 ifeq ($(CONFIG_TPL_BUILD),y)
18 # Include TPL autoconf
19 sinclude include/tpl-autoconf.mk
20 else
21 ifeq ($(CONFIG_SPL_BUILD),y)
22 # Include SPL autoconf
23 sinclude include/spl-autoconf.mk
24 else
25 # Include normal autoconf
26 sinclude include/autoconf.mk
27 endif
28 endif
29 sinclude $(OBJTREE)/include/config.mk
30
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.
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
39
40 sinclude $(TOPDIR)/arch/$(ARCH)/config.mk       # include architecture dependend rules
41 sinclude $(TOPDIR)/$(CPUDIR)/config.mk          # include  CPU  specific rules
42
43 ifdef   SOC
44 sinclude $(TOPDIR)/$(CPUDIR)/$(SOC)/config.mk   # include  SoC  specific rules
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
57 RELFLAGS= $(PLATFORM_RELFLAGS)
58
59 OBJCFLAGS += --gap-fill=0xff
60
61 CPPFLAGS = $(RELFLAGS)
62 CPPFLAGS += -pipe $(PLATFORM_CPPFLAGS)
63
64 BCURDIR = $(subst $(SRCTREE)/,,$(CURDIR:$(obj)%=%))
65
66 LDFLAGS += $(PLATFORM_LDFLAGS)
67 LDFLAGS_FINAL += -Bstatic