]> git.ipfire.org Git - people/ms/u-boot.git/blame - spl/Makefile
replace CONFIG_PRELOADER with CONFIG_SPL_BUILD
[people/ms/u-boot.git] / spl / Makefile
CommitLineData
6a11cf48
DS
1#
2# (C) Copyright 2000-2011
3# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4#
5# (C) Copyright 2011
6# Daniel Schwierzeck, daniel.schwierzeck@googlemail.com.
7#
8# (C) Copyright 2011
9# Texas Instruments Incorporated - http://www.ti.com/
10# Aneesh V <aneesh@ti.com>
11#
12# This file is released under the terms of GPL v2 and any later version.
13# See the file COPYING in the root directory of the source tree for details.
14#
15# Based on top-level Makefile.
16#
17
18CONFIG_SPL_BUILD := y
19export CONFIG_SPL_BUILD
20
21include $(TOPDIR)/config.mk
22
23# We want the final binaries in this directory
24obj := $(OBJTREE)/spl/
25
26HAVE_VENDOR_COMMON_LIB := $(shell [ -f $(SRCTREE)/board/$(VENDOR)/common/Makefile ] \
27 && echo y || echo n)
28
29START := $(CPUDIR)/start.o
30
31LIBS-y += arch/$(ARCH)/lib/lib$(ARCH).o
32LIBS-y += $(CPUDIR)/lib$(CPU).o
33ifdef SOC
34LIBS-y += $(CPUDIR)/$(SOC)/lib$(SOC).o
35endif
36LIBS-y += board/$(BOARDDIR)/lib$(BOARD).o
37LIBS-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/lib$(VENDOR).o
38
39START := $(addprefix $(SPLTREE)/,$(START))
40LIBS := $(addprefix $(SPLTREE)/,$(sort $(LIBS-y)))
41
42__START := $(subst $(obj),,$(START))
43__LIBS := $(subst $(obj),,$(LIBS))
44
45# Linker Script
46ifdef CONFIG_SPL_LDSCRIPT
47# need to strip off double quotes
48LDSCRIPT := $(addprefix $(SRCTREE)/,$(subst ",,$(CONFIG_SPL_LDSCRIPT)))
49endif
50
51ifeq ($(wildcard $(LDSCRIPT)),)
52 LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-spl.lds
53endif
54ifeq ($(wildcard $(LDSCRIPT)),)
55 LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot-spl.lds
56endif
57ifeq ($(wildcard $(LDSCRIPT)),)
58$(error could not find linker script)
59endif
60
61# Special flags for CPP when processing the linker script.
62# Pass the version down so we can handle backwards compatibility
63# on the fly.
64LDPPFLAGS += \
65 -include $(TOPDIR)/include/u-boot/u-boot.lds.h \
66 -include $(OBJTREE)/include/config.h \
67 $(shell $(LD) --version | \
68 sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p')
69
70ALL-y += $(obj)u-boot-spl.bin
71
72all: $(ALL-y)
73
74$(obj)u-boot-spl.bin: $(obj)u-boot-spl
75 $(OBJCOPY) $(OBJCFLAGS) -O binary $< $@
76
77GEN_UBOOT = \
78 UNDEF_SYM=`$(OBJDUMP) -x $(LIBS) | \
79 sed -n -e 's/.*\($(SYM_PREFIX)__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
80 cd $(obj) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) $$UNDEF_SYM $(__START) \
81 --start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
82 -Map u-boot-spl.map -o u-boot-spl
83
84$(obj)u-boot-spl: depend $(START) $(LIBS) $(obj)u-boot-spl.lds
85 $(GEN_UBOOT)
86
87$(START): depend
88 $(MAKE) -C $(SRCTREE)/$(CPUDIR) $@
89
90$(LIBS): depend
91 $(MAKE) -C $(SRCTREE)$(dir $(subst $(SPLTREE),,$@))
92
93$(obj)u-boot-spl.lds: $(LDSCRIPT) depend
94 $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - < $< > $@
95
96depend: $(obj).depend
97.PHONY: depend
98
99# defines $(obj).depend target
100include $(SRCTREE)/rules.mk