xref: /openbmc/u-boot/Makefile (revision 08e39a8434ff22d3851c1f9326b0e9afa5de0bee)
17ebf7443Swdenk#
2eca3aeb3SWolfgang Denk# (C) Copyright 2000-2013
37ebf7443Swdenk# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
47ebf7443Swdenk#
5eca3aeb3SWolfgang Denk# SPDX-License-Identifier:	GPL-2.0+
67ebf7443Swdenk#
77ebf7443Swdenk
83ae7b240STom RiniVERSION = 2013
940a60c6eSTom RiniPATCHLEVEL = 10
10211e4754SWolfgang DenkSUBLEVEL =
11183acb70STom RiniEXTRAVERSION =
128b9e4787SWolfgang Denkifneq "$(SUBLEVEL)" ""
13881a87ecSWolfgang DenkU_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
148b9e4787SWolfgang Denkelse
158b9e4787SWolfgang DenkU_BOOT_VERSION = $(VERSION).$(PATCHLEVEL)$(EXTRAVERSION)
168b9e4787SWolfgang Denkendif
17efb2172eSSimon GlassTIMESTAMP_FILE = $(obj)include/generated/timestamp_autogenerated.h
18efb2172eSSimon GlassVERSION_FILE = $(obj)include/generated/version_autogenerated.h
19881a87ecSWolfgang Denk
207ebf7443SwdenkHOSTARCH := $(shell uname -m | \
21fea25720SGraeme Russ	sed -e s/i.86/x86/ \
227ebf7443Swdenk	    -e s/sun4u/sparc64/ \
237ebf7443Swdenk	    -e s/arm.*/arm/ \
247ebf7443Swdenk	    -e s/sa110/arm/ \
25d0179083SKumar Gala	    -e s/ppc64/powerpc/ \
26d0179083SKumar Gala	    -e s/ppc/powerpc/ \
278d1f6355SNobuhiro Iwamatsu	    -e s/macppc/powerpc/\
288d1f6355SNobuhiro Iwamatsu	    -e s/sh.*/sh/)
297ebf7443Swdenk
30f9d77ed3SWolfgang DenkHOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
317ebf7443Swdenk	    sed -e 's/\(cygwin\).*/cygwin/')
327ebf7443Swdenk
33120ae609SBenoît Thébaudeauexport	HOSTARCH HOSTOS
347ebf7443Swdenk
357ebf7443Swdenk# Deal with colliding definitions from tcsh etc.
367ebf7443SwdenkVENDOR=
377ebf7443Swdenk
387ebf7443Swdenk#########################################################################
39ae6d1056SWolfgang Denk# Allow for silent builds
40ae6d1056SWolfgang Denkifeq (,$(findstring s,$(MAKEFLAGS)))
41ae6d1056SWolfgang DenkXECHO = echo
42ae6d1056SWolfgang Denkelse
43ae6d1056SWolfgang DenkXECHO = :
44ae6d1056SWolfgang Denkendif
45ae6d1056SWolfgang Denk
46ae6d1056SWolfgang Denk#########################################################################
47f9328639SMarian Balakowicz#
481bce2aebSRobert P. J. Day# U-boot build supports generating object files in a separate external
49f9328639SMarian Balakowicz# directory. Two use cases are supported:
50f9328639SMarian Balakowicz#
51f9328639SMarian Balakowicz# 1) Add O= to the make command line
52f9328639SMarian Balakowicz# 'make O=/tmp/build all'
53f9328639SMarian Balakowicz#
541bce2aebSRobert P. J. Day# 2) Set environment variable BUILD_DIR to point to the desired location
55f9328639SMarian Balakowicz# 'export BUILD_DIR=/tmp/build'
56f9328639SMarian Balakowicz# 'make'
57f9328639SMarian Balakowicz#
58f9328639SMarian Balakowicz# The second approach can also be used with a MAKEALL script
59f9328639SMarian Balakowicz# 'export BUILD_DIR=/tmp/build'
60f9328639SMarian Balakowicz# './MAKEALL'
61f9328639SMarian Balakowicz#
621bce2aebSRobert P. J. Day# Command line 'O=' setting overrides BUILD_DIR environment variable.
63f9328639SMarian Balakowicz#
64f9328639SMarian Balakowicz# When none of the above methods is used the local build is performed and
65f9328639SMarian Balakowicz# the object files are placed in the source directory.
66f9328639SMarian Balakowicz#
677ebf7443Swdenk
68f9328639SMarian Balakowiczifdef O
69f9328639SMarian Balakowiczifeq ("$(origin O)", "command line")
70f9328639SMarian BalakowiczBUILD_DIR := $(O)
71f9328639SMarian Balakowiczendif
72f9328639SMarian Balakowiczendif
737ebf7443Swdenk
744ab64933SKim Phillips# Call a source code checker (by default, "sparse") as part of the
754ab64933SKim Phillips# C compilation.
764ab64933SKim Phillips#
774ab64933SKim Phillips# Use 'make C=1' to enable checking of re-compiled files.
784ab64933SKim Phillips#
794ab64933SKim Phillips# See the linux kernel file "Documentation/sparse.txt" for more details,
804ab64933SKim Phillips# including where to get the "sparse" utility.
814ab64933SKim Phillips
824ab64933SKim Phillipsifdef C
834ab64933SKim Phillipsifeq ("$(origin C)", "command line")
844ab64933SKim PhillipsCHECKSRC := $(C)
854ab64933SKim Phillipsendif
864ab64933SKim Phillipsendif
874ab64933SKim Phillipsifndef CHECKSRC
884ab64933SKim Phillips  CHECKSRC = 0
894ab64933SKim Phillipsendif
904ab64933SKim Phillipsexport CHECKSRC
914ab64933SKim Phillips
92f9328639SMarian Balakowiczifneq ($(BUILD_DIR),)
93f9328639SMarian Balakowiczsaved-output := $(BUILD_DIR)
944f0645ebSMarian Balakowicz
954f0645ebSMarian Balakowicz# Attempt to create a output directory.
964f0645ebSMarian Balakowicz$(shell [ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR})
974f0645ebSMarian Balakowicz
984f0645ebSMarian Balakowicz# Verify if it was successful.
99f9328639SMarian BalakowiczBUILD_DIR := $(shell cd $(BUILD_DIR) && /bin/pwd)
100f9328639SMarian Balakowicz$(if $(BUILD_DIR),,$(error output directory "$(saved-output)" does not exist))
101f9328639SMarian Balakowiczendif # ifneq ($(BUILD_DIR),)
102f9328639SMarian Balakowicz
103f9328639SMarian BalakowiczOBJTREE		:= $(if $(BUILD_DIR),$(BUILD_DIR),$(CURDIR))
104c8f9c302SDaniel SchwierzeckSPLTREE		:= $(OBJTREE)/spl
1053aa29de0SYing ZhangTPLTREE		:= $(OBJTREE)/tpl
106f9328639SMarian BalakowiczSRCTREE		:= $(CURDIR)
107f9328639SMarian BalakowiczTOPDIR		:= $(SRCTREE)
108f9328639SMarian BalakowiczLNDIR		:= $(OBJTREE)
1093aa29de0SYing Zhangexport	TOPDIR SRCTREE OBJTREE SPLTREE TPLTREE
110f9328639SMarian Balakowicz
111f9328639SMarian BalakowiczMKCONFIG	:= $(SRCTREE)/mkconfig
112f9328639SMarian Balakowiczexport MKCONFIG
113f9328639SMarian Balakowicz
114f9328639SMarian Balakowiczifneq ($(OBJTREE),$(SRCTREE))
115f9328639SMarian BalakowiczREMOTE_BUILD	:= 1
116f9328639SMarian Balakowiczexport REMOTE_BUILD
117f9328639SMarian Balakowiczendif
118f9328639SMarian Balakowicz
119f9328639SMarian Balakowicz# $(obj) and (src) are defined in config.mk but here in main Makefile
120f9328639SMarian Balakowicz# we also need them before config.mk is included which is the case for
121f9328639SMarian Balakowicz# some targets like unconfig, clean, clobber, distclean, etc.
122f9328639SMarian Balakowiczifneq ($(OBJTREE),$(SRCTREE))
123f9328639SMarian Balakowiczobj := $(OBJTREE)/
124f9328639SMarian Balakowiczsrc := $(SRCTREE)/
125f9328639SMarian Balakowiczelse
126f9328639SMarian Balakowiczobj :=
127f9328639SMarian Balakowiczsrc :=
128f9328639SMarian Balakowiczendif
129f9328639SMarian Balakowiczexport obj src
130f9328639SMarian Balakowicz
1315013c09fSWolfgang Denk# Make sure CDPATH settings don't interfere
1325013c09fSWolfgang Denkunexport CDPATH
1335013c09fSWolfgang Denk
134f9328639SMarian Balakowicz#########################################################################
135f9328639SMarian Balakowicz
1366d1ce387SMike Frysinger# The "tools" are needed early, so put this first
1376d1ce387SMike Frysinger# Don't include stuff already done in $(LIBS)
138349e83f0SChe-liang Chiou# The "examples" conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC
139349e83f0SChe-liang Chiou# is "yes"), so compile examples after U-Boot is compiled.
140349e83f0SChe-liang ChiouSUBDIR_TOOLS = tools
141349e83f0SChe-liang ChiouSUBDIR_EXAMPLES = examples/standalone examples/api
142349e83f0SChe-liang ChiouSUBDIRS = $(SUBDIR_TOOLS)
1436d1ce387SMike Frysinger
144249b53a6SLoïc Minier.PHONY : $(SUBDIRS) $(VERSION_FILE) $(TIMESTAMP_FILE)
1456d1ce387SMike Frysinger
146ae6d1056SWolfgang Denkifeq ($(obj)include/config.mk,$(wildcard $(obj)include/config.mk))
147f9328639SMarian Balakowicz
1482632c008SMike Frysinger# Include autoconf.mk before config.mk so that the config options are available
1492632c008SMike Frysinger# to all top level build files.  We need the dummy all: target to prevent the
1502632c008SMike Frysinger# dependency target in autoconf.mk.dep from being the default.
1512632c008SMike Frysingerall:
1522632c008SMike Frysingersinclude $(obj)include/autoconf.mk.dep
1532632c008SMike Frysingersinclude $(obj)include/autoconf.mk
1542632c008SMike Frysinger
155b5728756SSimon Glassifndef CONFIG_SANDBOX
156b5728756SSimon GlassSUBDIRS += $(SUBDIR_EXAMPLES)
157b5728756SSimon Glassendif
158b5728756SSimon Glass
1597ebf7443Swdenk# load ARCH, BOARD, and CPU configuration
160ae6d1056SWolfgang Denkinclude $(obj)include/config.mk
1611d9f4105Swdenkexport	ARCH CPU BOARD VENDOR SOC
162f9328639SMarian Balakowicz
1631ea6bcd8SMike Frysinger# set default to nothing for native builds
164a5284efdSWolfgang Denkifeq ($(HOSTARCH),$(ARCH))
1651ea6bcd8SMike FrysingerCROSS_COMPILE ?=
1667ebf7443Swdenkendif
1677ebf7443Swdenk
16892b197f0SWolfgang Denk# load other configuration
16992b197f0SWolfgang Denkinclude $(TOPDIR)/config.mk
17092b197f0SWolfgang Denk
171fada9e20SSimon Glass# Targets which don't build the source code
172fada9e20SSimon GlassNON_BUILD_TARGETS = backup clean clobber distclean mkproper tidy unconfig
173fada9e20SSimon Glass
174fada9e20SSimon Glass# Only do the generic board check when actually building, not configuring
175fada9e20SSimon Glassifeq ($(filter $(NON_BUILD_TARGETS),$(MAKECMDGOALS)),)
176fada9e20SSimon Glassifeq ($(findstring _config,$(MAKECMDGOALS)),)
177fada9e20SSimon Glass$(CHECK_GENERIC_BOARD)
178fada9e20SSimon Glassendif
179fada9e20SSimon Glassendif
180fada9e20SSimon Glass
181d51dfff7SIlya Yanok# If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use
182d51dfff7SIlya Yanok# that (or fail if absent).  Otherwise, search for a linker script in a
183d51dfff7SIlya Yanok# standard location.
184d51dfff7SIlya Yanok
185ee60197eSSimon GlassLDSCRIPT_MAKEFILE_DIR = $(dir $(LDSCRIPT))
186ee60197eSSimon Glass
187d51dfff7SIlya Yanokifndef LDSCRIPT
188d51dfff7SIlya Yanok	#LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug
189d51dfff7SIlya Yanok	ifdef CONFIG_SYS_LDSCRIPT
190d51dfff7SIlya Yanok		# need to strip off double quotes
191d51dfff7SIlya Yanok		LDSCRIPT := $(subst ",,$(CONFIG_SYS_LDSCRIPT))
192d51dfff7SIlya Yanok	endif
193d51dfff7SIlya Yanokendif
194d51dfff7SIlya Yanok
195ee60197eSSimon Glass# If there is no specified link script, we look in a number of places for it
196d51dfff7SIlya Yanokifndef LDSCRIPT
197d51dfff7SIlya Yanok	ifeq ($(CONFIG_NAND_U_BOOT),y)
198d51dfff7SIlya Yanok		LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds
199d51dfff7SIlya Yanok		ifeq ($(wildcard $(LDSCRIPT)),)
200d51dfff7SIlya Yanok			LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds
201d51dfff7SIlya Yanok		endif
202d51dfff7SIlya Yanok	endif
203d51dfff7SIlya Yanok	ifeq ($(wildcard $(LDSCRIPT)),)
204d51dfff7SIlya Yanok		LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
205d51dfff7SIlya Yanok	endif
206d51dfff7SIlya Yanok	ifeq ($(wildcard $(LDSCRIPT)),)
207d51dfff7SIlya Yanok		LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot.lds
208d51dfff7SIlya Yanok	endif
209d51dfff7SIlya Yanok	ifeq ($(wildcard $(LDSCRIPT)),)
210ee60197eSSimon Glass		LDSCRIPT := $(TOPDIR)/arch/$(ARCH)/cpu/u-boot.lds
211ee60197eSSimon Glass		# We don't expect a Makefile here
212ee60197eSSimon Glass		LDSCRIPT_MAKEFILE_DIR =
213ee60197eSSimon Glass	endif
214ee60197eSSimon Glass	ifeq ($(wildcard $(LDSCRIPT)),)
215d51dfff7SIlya Yanok$(error could not find linker script)
216d51dfff7SIlya Yanok	endif
217d51dfff7SIlya Yanokendif
218d51dfff7SIlya Yanok
2197ebf7443Swdenk#########################################################################
2207ebf7443Swdenk# U-Boot objects....order is important (i.e. start must be first)
2217ebf7443Swdenk
22203b7004dSPeter TyserOBJS  = $(CPUDIR)/start.o
2237ebf7443Swdenkifeq ($(CPU),ppc4xx)
22403b7004dSPeter TyserOBJS += $(CPUDIR)/resetvec.o
2257ebf7443Swdenkendif
22642d1f039Swdenkifeq ($(CPU),mpc85xx)
22703b7004dSPeter TyserOBJS += $(CPUDIR)/resetvec.o
22842d1f039Swdenkendif
2297ebf7443Swdenk
230a32e626fSSimon GlassOBJS := $(addprefix $(obj),$(OBJS))
231f9328639SMarian Balakowicz
2328b5a0264SDaniel SchwierzeckHAVE_VENDOR_COMMON_LIB = $(if $(wildcard board/$(VENDOR)/common/Makefile),y,n)
2338b5a0264SDaniel Schwierzeck
234f52d7b35SDaniel SchwierzeckLIBS-y += lib/libgeneric.o
235164922bdSMasahiro YamadaLIBS-$(CONFIG_RSA) += lib/rsa/librsa.o
236164922bdSMasahiro YamadaLIBS-$(CONFIG_LZMA) += lib/lzma/liblzma.o
237164922bdSMasahiro YamadaLIBS-$(CONFIG_LZO) += lib/lzo/liblzo.o
238164922bdSMasahiro YamadaLIBS-$(CONFIG_ZLIB) += lib/zlib/libz.o
2398b5a0264SDaniel SchwierzeckLIBS-$(CONFIG_TIZEN) += lib/tizen/libtizen.o
2408b5a0264SDaniel SchwierzeckLIBS-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/lib$(VENDOR).o
241f52d7b35SDaniel SchwierzeckLIBS-y += $(CPUDIR)/lib$(CPU).o
2421d9f4105Swdenkifdef SOC
243f52d7b35SDaniel SchwierzeckLIBS-y += $(CPUDIR)/$(SOC)/lib$(SOC).o
2441d9f4105Swdenkendif
245323bfa8fSStefan Roeseifeq ($(CPU),ixp)
24661e12988SMarek VasutLIBS-y += drivers/net/npe/libnpe.o
247323bfa8fSStefan Roeseendif
2488b5a0264SDaniel SchwierzeckLIBS-$(CONFIG_OF_EMBED) += dts/libdts.o
249f52d7b35SDaniel SchwierzeckLIBS-y += arch/$(ARCH)/lib/lib$(ARCH).o
250045fa1e1SStephen WarrenLIBS-y += fs/libfs.o \
251e82004bcSMasahiro Yamada	fs/fat/libfat.o
252f52d7b35SDaniel SchwierzeckLIBS-y += net/libnet.o
253f52d7b35SDaniel SchwierzeckLIBS-y += disk/libdisk.o
2549c3f0bc5SMasahiro YamadaLIBS-y += drivers/libdrivers.o
255f52d7b35SDaniel SchwierzeckLIBS-y += drivers/dma/libdma.o
256f52d7b35SDaniel SchwierzeckLIBS-y += drivers/gpio/libgpio.o
257f52d7b35SDaniel SchwierzeckLIBS-y += drivers/i2c/libi2c.o
258f52d7b35SDaniel SchwierzeckLIBS-y += drivers/input/libinput.o
259f52d7b35SDaniel SchwierzeckLIBS-y += drivers/mmc/libmmc.o
260f52d7b35SDaniel SchwierzeckLIBS-y += drivers/mtd/libmtd.o
261f52d7b35SDaniel SchwierzeckLIBS-y += drivers/mtd/nand/libnand.o
262f52d7b35SDaniel SchwierzeckLIBS-y += drivers/mtd/onenand/libonenand.o
263f52d7b35SDaniel SchwierzeckLIBS-y += drivers/mtd/ubi/libubi.o
264f52d7b35SDaniel SchwierzeckLIBS-y += drivers/mtd/spi/libspi_flash.o
265f52d7b35SDaniel SchwierzeckLIBS-y += drivers/net/libnet.o
266f52d7b35SDaniel SchwierzeckLIBS-y += drivers/net/phy/libphy.o
267f52d7b35SDaniel SchwierzeckLIBS-y += drivers/pci/libpci.o
268e0a0cbf2SŁukasz MajewskiLIBS-y += drivers/power/libpower.o \
269b95aacd3SŁukasz Majewski	drivers/power/fuel_gauge/libfuel_gauge.o \
27004750447SPiotr Wilczek	drivers/power/mfd/libmfd.o \
271eba42391SŁukasz Majewski	drivers/power/pmic/libpmic.o \
272eba42391SŁukasz Majewski	drivers/power/battery/libbattery.o
273f52d7b35SDaniel SchwierzeckLIBS-y += drivers/spi/libspi.o
2747737d5c6SDave Liuifeq ($(CPU),mpc83xx)
275f52d7b35SDaniel SchwierzeckLIBS-y += drivers/qe/libqe.o
276f52d7b35SDaniel SchwierzeckLIBS-y += arch/powerpc/cpu/mpc8xxx/ddr/libddr.o
277f52d7b35SDaniel SchwierzeckLIBS-y += arch/powerpc/cpu/mpc8xxx/lib8xxx.o
2787737d5c6SDave Liuendif
279da9d4610SAndy Flemingifeq ($(CPU),mpc85xx)
280f52d7b35SDaniel SchwierzeckLIBS-y += drivers/qe/libqe.o
281f52d7b35SDaniel SchwierzeckLIBS-y += drivers/net/fm/libfm.o
282f52d7b35SDaniel SchwierzeckLIBS-y += arch/powerpc/cpu/mpc8xxx/ddr/libddr.o
283f52d7b35SDaniel SchwierzeckLIBS-y += arch/powerpc/cpu/mpc8xxx/lib8xxx.o
28458e5e9afSKumar Galaendif
28558e5e9afSKumar Galaifeq ($(CPU),mpc86xx)
286f52d7b35SDaniel SchwierzeckLIBS-y += arch/powerpc/cpu/mpc8xxx/ddr/libddr.o
287f52d7b35SDaniel SchwierzeckLIBS-y += arch/powerpc/cpu/mpc8xxx/lib8xxx.o
288da9d4610SAndy Flemingendif
289f52d7b35SDaniel SchwierzeckLIBS-y += drivers/serial/libserial.o
290f52d7b35SDaniel SchwierzeckLIBS-y += drivers/usb/eth/libusb_eth.o
291f52d7b35SDaniel SchwierzeckLIBS-y += drivers/usb/gadget/libusb_gadget.o
292f52d7b35SDaniel SchwierzeckLIBS-y += drivers/usb/host/libusb_host.o
293f52d7b35SDaniel SchwierzeckLIBS-y += drivers/usb/musb/libusb_musb.o
294eb81955bSIlya YanokLIBS-y += drivers/usb/musb-new/libusb_musb-new.o
295f52d7b35SDaniel SchwierzeckLIBS-y += drivers/usb/phy/libusb_phy.o
296f52d7b35SDaniel SchwierzeckLIBS-y += drivers/usb/ulpi/libusb_ulpi.o
297f52d7b35SDaniel SchwierzeckLIBS-y += common/libcommon.o
298f52d7b35SDaniel SchwierzeckLIBS-y += lib/libfdt/libfdt.o
299f52d7b35SDaniel SchwierzeckLIBS-y += api/libapi.o
300f52d7b35SDaniel SchwierzeckLIBS-y += post/libpost.o
301f52d7b35SDaniel SchwierzeckLIBS-y += test/libtest.o
302f9328639SMarian Balakowicz
30324e8bee5SAlison Wangifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35 mxs vf610))
304ea00e59bSStefano BabicLIBS-y += arch/$(ARCH)/imx-common/libimx-common.o
30518936ee2SJason Liuendif
30618936ee2SJason Liu
30737d82bebSMasahiro YamadaLIBS-$(CONFIG_ARM) += arch/arm/cpu/libcpu.o
308852bd07cSMinkyu Kang
309*08e39a84SMasahiro YamadaLIBS-y += board/$(BOARDDIR)/lib$(BOARD).o
310*08e39a84SMasahiro Yamada
311f52d7b35SDaniel SchwierzeckLIBS := $(addprefix $(obj),$(sort $(LIBS-y)))
312249b53a6SLoïc Minier.PHONY : $(LIBS)
313a8c7c708Swdenk
3144f7cb08eSwdenk# Add GCC lib
31552b1bf2cSWolfgang Denkifdef USE_PRIVATE_LIBGCC
31652b1bf2cSWolfgang Denkifeq ("$(USE_PRIVATE_LIBGCC)", "yes")
317635d1b3eSMatthias WeisserPLATFORM_LIBGCC = $(OBJTREE)/arch/$(ARCH)/lib/libgcc.o
31852b1bf2cSWolfgang Denkelse
31952b1bf2cSWolfgang DenkPLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc
32052b1bf2cSWolfgang Denkendif
32152b1bf2cSWolfgang Denkelse
322cca4e4aeSWolfgang DenkPLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
32352b1bf2cSWolfgang Denkendif
32452b1bf2cSWolfgang DenkPLATFORM_LIBS += $(PLATFORM_LIBGCC)
32552b1bf2cSWolfgang Denkexport PLATFORM_LIBS
3263d3befa7Swdenk
3276ac9f479SMike Frysinger# Special flags for CPP when processing the linker script.
3286ac9f479SMike Frysinger# Pass the version down so we can handle backwards compatibility
3296ac9f479SMike Frysinger# on the fly.
3306ac9f479SMike FrysingerLDPPFLAGS += \
3316ac9f479SMike Frysinger	-include $(TOPDIR)/include/u-boot/u-boot.lds.h \
3327e6403a6SSimon Glass	-DCPUDIR=$(CPUDIR) \
3336ac9f479SMike Frysinger	$(shell $(LD) --version | \
3346ac9f479SMike Frysinger	  sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p')
3356ac9f479SMike Frysinger
336f9328639SMarian Balakowicz__OBJS := $(subst $(obj),,$(OBJS))
337*08e39a84SMasahiro Yamada__LIBS := $(subst $(obj),,$(LIBS))
338f9328639SMarian Balakowicz
3397ebf7443Swdenk#########################################################################
340bdccc4feSwdenk#########################################################################
3417ebf7443Swdenk
342f3a14d37SMike Frysingerifneq ($(CONFIG_BOARD_SIZE_LIMIT),)
343f3a14d37SMike FrysingerBOARD_SIZE_CHECK = \
344f3a14d37SMike Frysinger	@actual=`wc -c $@ | awk '{print $$1}'`; \
345d060e6f4SJoe Hershberger	limit=`printf "%d" $(CONFIG_BOARD_SIZE_LIMIT)`; \
346f3a14d37SMike Frysinger	if test $$actual -gt $$limit; then \
347d060e6f4SJoe Hershberger		echo "$@ exceeds file size limit:" >&2 ; \
348d060e6f4SJoe Hershberger		echo "  limit:  $$limit bytes" >&2 ; \
349d060e6f4SJoe Hershberger		echo "  actual: $$actual bytes" >&2 ; \
350d060e6f4SJoe Hershberger		echo "  excess: $$((actual - limit)) bytes" >&2; \
351f3a14d37SMike Frysinger		exit 1; \
352f3a14d37SMike Frysinger	fi
353f3a14d37SMike Frysingerelse
354f3a14d37SMike FrysingerBOARD_SIZE_CHECK =
355f3a14d37SMike Frysingerendif
356f3a14d37SMike Frysinger
3573e88337bSMike Frysinger# Always append ALL so that arch config.mk's can add custom ones
3584e0fbb98SDaniel SchwierzeckALL-y += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map
359e935a374SHaiying Wang
3604e0fbb98SDaniel SchwierzeckALL-$(CONFIG_NAND_U_BOOT) += $(obj)u-boot-nand.bin
3614e0fbb98SDaniel SchwierzeckALL-$(CONFIG_ONENAND_U_BOOT) += $(obj)u-boot-onenand.bin
362262737f0SShaohui XieALL-$(CONFIG_RAMBOOT_PBL) += $(obj)u-boot.pbl
3635df2ee27SDaniel SchwierzeckALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin
3644c267374SHenrik NordströmALL-$(CONFIG_SPL_FRAMEWORK) += $(obj)u-boot.img
3653aa29de0SYing ZhangALL-$(CONFIG_TPL) += $(obj)tpl/u-boot-tpl.bin
3662c0f79e4SSimon GlassALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot-dtb.bin
367b343bbb5SVadim Bendeburyifneq ($(CONFIG_SPL_TARGET),)
368b343bbb5SVadim BendeburyALL-$(CONFIG_SPL) += $(obj)$(subst ",,$(CONFIG_SPL_TARGET))
369b343bbb5SVadim Bendeburyendif
3707ebf7443Swdenk
37112b7b70cSAllen Martin# enable combined SPL/u-boot/dtb rules for tegra
3726d6c0baeSTom Warrenifneq ($(CONFIG_TEGRA),)
37312b7b70cSAllen Martinifeq ($(CONFIG_OF_SEPARATE),y)
37412b7b70cSAllen MartinALL-y += $(obj)u-boot-dtb-tegra.bin
37512b7b70cSAllen Martinelse
37612b7b70cSAllen MartinALL-y += $(obj)u-boot-nodtb-tegra.bin
37712b7b70cSAllen Martinendif
37812b7b70cSAllen Martinendif
37912b7b70cSAllen Martin
38071f84ef0SMasahiro Yamadabuild := -f $(TOPDIR)/scripts/Makefile.build -C
38171f84ef0SMasahiro Yamada
382349e83f0SChe-liang Chiouall:		$(ALL-y) $(SUBDIR_EXAMPLES)
3837ebf7443Swdenk
384501ebdf2SStephen Warren$(obj)u-boot.dtb:	checkdtc $(obj)u-boot
385bcfe8fdfSMasahiro Yamada		$(MAKE) $(build) dts binary
3862c0f79e4SSimon Glass		mv $(obj)dts/dt.dtb $@
3872c0f79e4SSimon Glass
3882c0f79e4SSimon Glass$(obj)u-boot-dtb.bin:	$(obj)u-boot.bin $(obj)u-boot.dtb
3892c0f79e4SSimon Glass		cat $^ >$@
3902c0f79e4SSimon Glass
391f9328639SMarian Balakowicz$(obj)u-boot.hex:	$(obj)u-boot
3926310eb9dSwdenk		$(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
3936310eb9dSwdenk
394f9328639SMarian Balakowicz$(obj)u-boot.srec:	$(obj)u-boot
3950817d688SRicardo Ribalda Delgado		$(OBJCOPY) -O srec $< $@
3967ebf7443Swdenk
397f9328639SMarian Balakowicz$(obj)u-boot.bin:	$(obj)u-boot
3987ebf7443Swdenk		$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
399f3a14d37SMike Frysinger		$(BOARD_SIZE_CHECK)
4007ebf7443Swdenk
40194a91e24SMike Frysinger$(obj)u-boot.ldr:	$(obj)u-boot
40276d82187SMike Frysinger		$(CREATE_LDR_ENV)
40368e56324SMike Frysinger		$(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS)
404f3a14d37SMike Frysinger		$(BOARD_SIZE_CHECK)
40594a91e24SMike Frysinger
40694a91e24SMike Frysinger$(obj)u-boot.ldr.hex:	$(obj)u-boot.ldr
40794a91e24SMike Frysinger		$(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@ -I binary
40894a91e24SMike Frysinger
40994a91e24SMike Frysinger$(obj)u-boot.ldr.srec:	$(obj)u-boot.ldr
41094a91e24SMike Frysinger		$(OBJCOPY) ${OBJCFLAGS} -O srec $< $@ -I binary
41194a91e24SMike Frysinger
412b40bda6bSStefan Roese#
413b40bda6bSStefan Roese# U-Boot entry point, needed for booting of full-blown U-Boot
414b40bda6bSStefan Roese# from the SPL U-Boot version.
415b40bda6bSStefan Roese#
416b40bda6bSStefan Roeseifndef CONFIG_SYS_UBOOT_START
417b40bda6bSStefan RoeseCONFIG_SYS_UBOOT_START := 0
418b40bda6bSStefan Roeseendif
419b40bda6bSStefan Roese
420f9328639SMarian Balakowicz$(obj)u-boot.img:	$(obj)u-boot.bin
421a2a0a717SWolfgang Denk		$(obj)tools/mkimage -A $(ARCH) -T firmware -C none \
422b40bda6bSStefan Roese		-O u-boot -a $(CONFIG_SYS_TEXT_BASE) \
423b40bda6bSStefan Roese		-e $(CONFIG_SYS_UBOOT_START) \
424881a87ecSWolfgang Denk		-n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
425bdccc4feSwdenk			sed -e 's/"[	 ]*$$/ for $(BOARD) board"/') \
426bdccc4feSwdenk		-d $< $@
427bdccc4feSwdenk
428291b3dcdSOtavio Salvador$(obj)u-boot.imx: $(obj)u-boot.bin depend
42971f84ef0SMasahiro Yamada		$(MAKE) $(build) $(SRCTREE)/arch/arm/imx-common $(OBJTREE)/u-boot.imx
4308edcde5eSStefano Babic
431aa0c7a86SPrafulla Wadaskar$(obj)u-boot.kwb:       $(obj)u-boot.bin
43231d80c77SPrafulla Wadaskar		$(obj)tools/mkimage -n $(CONFIG_SYS_KWD_CONFIG) -T kwbimage \
4332ea88b06SEric Cooper		-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) -d $< $@
434aa0c7a86SPrafulla Wadaskar
4355d898a00SShaohui Xie$(obj)u-boot.pbl:	$(obj)u-boot.bin
4365d898a00SShaohui Xie		$(obj)tools/mkimage -n $(CONFIG_PBLRCW_CONFIG) \
4375d898a00SShaohui Xie		-R $(CONFIG_PBLPBI_CONFIG) -T pblimage \
4385d898a00SShaohui Xie		-d $< $@
4395d898a00SShaohui Xie
440566a494fSHeiko Schocher$(obj)u-boot.sha1:	$(obj)u-boot.bin
44101159530SHeiko Schocher		$(obj)tools/ubsha1 $(obj)u-boot.bin
442566a494fSHeiko Schocher
443f9328639SMarian Balakowicz$(obj)u-boot.dis:	$(obj)u-boot
4447ebf7443Swdenk		$(OBJDUMP) -d $< > $@
4457ebf7443Swdenk
4463aa29de0SYing Zhang# $@ is output, $(1) and $(2) are inputs, $(3) is padded intermediate,
4473aa29de0SYing Zhang# $(4) is pad-to
4483aa29de0SYing ZhangSPL_PAD_APPEND = \
4493aa29de0SYing Zhang		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(4) -I binary -O binary \
4503aa29de0SYing Zhang		$(1) $(obj)$(3); \
451b6df9b01SYork Sun		cat $(obj)$(3) $(2) > $@; \
4523aa29de0SYing Zhang		rm $(obj)$(3)
45374752baaSScott Wood
4543aa29de0SYing Zhangifdef CONFIG_TPL
4553aa29de0SYing ZhangSPL_PAYLOAD := $(obj)tpl/u-boot-with-tpl.bin
4563aa29de0SYing Zhangelse
4573aa29de0SYing ZhangSPL_PAYLOAD := $(obj)u-boot.bin
4583aa29de0SYing Zhangendif
45974752baaSScott Wood
4603aa29de0SYing Zhang$(obj)u-boot-with-spl.bin: $(obj)spl/u-boot-spl.bin $(SPL_PAYLOAD)
4613aa29de0SYing Zhang		$(call SPL_PAD_APPEND,$<,$(SPL_PAYLOAD),spl/u-boot-spl-pad.bin,$(CONFIG_SPL_PAD_TO))
4623aa29de0SYing Zhang
4633aa29de0SYing Zhang$(obj)tpl/u-boot-with-tpl.bin: $(obj)tpl/u-boot-tpl.bin $(obj)u-boot.bin
464b6df9b01SYork Sun		$(call SPL_PAD_APPEND,$<,$(obj)u-boot.bin,tpl/u-boot-tpl-pad.bin,$(CONFIG_TPL_PAD_TO))
4657816f2cfSHeiko Schocher
466ba597609SBenoît Thébaudeau$(obj)u-boot-with-spl.imx: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
46771f84ef0SMasahiro Yamada		$(MAKE) $(build) $(SRCTREE)/arch/arm/imx-common \
468ba597609SBenoît Thébaudeau			$(OBJTREE)/u-boot-with-spl.imx
469ba597609SBenoît Thébaudeau
4707d5a5c79SBenoît Thébaudeau$(obj)u-boot-with-nand-spl.imx: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
47171f84ef0SMasahiro Yamada		$(MAKE) $(build) $(SRCTREE)/arch/arm/imx-common \
4727d5a5c79SBenoît Thébaudeau			$(OBJTREE)/u-boot-with-nand-spl.imx
4737d5a5c79SBenoît Thébaudeau
4745364add4SScott Wood$(obj)u-boot.ubl:       $(obj)u-boot-with-spl.bin
475277f00f5SJosé Miguel Gonçalves		$(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \
4765364add4SScott Wood		-e $(CONFIG_SYS_TEXT_BASE) -d $< $(obj)u-boot.ubl
477277f00f5SJosé Miguel Gonçalves
4783f7f2414STom Rini$(obj)u-boot.ais:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.img
4796d660e77SSughosh Ganu		$(obj)tools/mkimage -s -n $(if $(CONFIG_AIS_CONFIG_FILE),$(CONFIG_AIS_CONFIG_FILE),"/dev/null") \
4806d660e77SSughosh Ganu			-T aisimage \
481d36d8859SChristian Riesch			-e $(CONFIG_SPL_TEXT_BASE) \
482d36d8859SChristian Riesch			-d $(obj)spl/u-boot-spl.bin \
483d36d8859SChristian Riesch			$(obj)spl/u-boot-spl.ais
484d36d8859SChristian Riesch		$(OBJCOPY) ${OBJCFLAGS} -I binary \
485d36d8859SChristian Riesch			--pad-to=$(CONFIG_SPL_MAX_SIZE) -O binary \
486d36d8859SChristian Riesch			$(obj)spl/u-boot-spl.ais $(obj)spl/u-boot-spl-pad.ais
4873f7f2414STom Rini		cat $(obj)spl/u-boot-spl-pad.ais $(obj)u-boot.img > \
488d36d8859SChristian Riesch			$(obj)u-boot.ais
489d36d8859SChristian Riesch
490a5453555SOtavio Salvador
49130b9b932SMarek Vasut$(obj)u-boot.sb:       $(obj)u-boot.bin $(obj)spl/u-boot-spl.bin
492edabc1bcSMasahiro Yamada		$(MAKE) $(build) $(SRCTREE)/$(CPUDIR)/$(SOC)/ $(OBJTREE)/u-boot.sb
49330b9b932SMarek Vasut
49494aebe6cSStefan Roese# On x600 (SPEAr600) U-Boot is appended to U-Boot SPL.
49594aebe6cSStefan Roese# Both images are created using mkimage (crc etc), so that the ROM
49694aebe6cSStefan Roese# bootloader can check its integrity. Padding needs to be done to the
49794aebe6cSStefan Roese# SPL image (with mkimage header) and not the binary. Otherwise the resulting image
49894aebe6cSStefan Roese# which is loaded/copied by the ROM bootloader to SRAM doesn't fit.
49994aebe6cSStefan Roese# The resulting image containing both U-Boot images is called u-boot.spr
50094aebe6cSStefan Roese$(obj)u-boot.spr:	$(obj)u-boot.img $(obj)spl/u-boot-spl.bin
50194aebe6cSStefan Roese		$(obj)tools/mkimage -A $(ARCH) -T firmware -C none \
50294aebe6cSStefan Roese		-a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n XLOADER \
50394aebe6cSStefan Roese		-d $(obj)spl/u-boot-spl.bin $(obj)spl/u-boot-spl.img
50494aebe6cSStefan Roese		tr "\000" "\377" < /dev/zero | dd ibs=1 count=$(CONFIG_SPL_PAD_TO) \
50594aebe6cSStefan Roese			of=$(obj)spl/u-boot-spl-pad.img 2>/dev/null
50694aebe6cSStefan Roese		dd if=$(obj)spl/u-boot-spl.img of=$(obj)spl/u-boot-spl-pad.img \
50794aebe6cSStefan Roese			conv=notrunc 2>/dev/null
50894aebe6cSStefan Roese		cat $(obj)spl/u-boot-spl-pad.img $(obj)u-boot.img > $@
50994aebe6cSStefan Roese
5106d6c0baeSTom Warrenifneq ($(CONFIG_TEGRA),)
5119972db5cSStephen Warren$(obj)u-boot-nodtb-tegra.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
512e4ec9346SStephen Warren		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SYS_TEXT_BASE) -O binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin
5139972db5cSStephen Warren		cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > $@
514e4ec9346SStephen Warren		rm $(obj)spl/u-boot-spl-pad.bin
5159972db5cSStephen Warren
5169972db5cSStephen Warrenifeq ($(CONFIG_OF_SEPARATE),y)
5179972db5cSStephen Warren$(obj)u-boot-dtb-tegra.bin: $(obj)u-boot-nodtb-tegra.bin $(obj)u-boot.dtb
5189972db5cSStephen Warren		cat $(obj)u-boot-nodtb-tegra.bin $(obj)u-boot.dtb > $@
5199972db5cSStephen Warrenendif
520984df4ecSAllen Martinendif
521984df4ecSAllen Martin
522fb3d2b8aSStefan Roese$(obj)u-boot-img.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.img
523fb3d2b8aSStefan Roese		cat $(obj)spl/u-boot-spl.bin $(obj)u-boot.img > $@
524fb3d2b8aSStefan Roese
525ecddccd0SStefan Roese# PPC4xx needs the SPL at the end of the image, since the reset vector
526ecddccd0SStefan Roese# is located at 0xfffffffc. So we can't use the "u-boot-img.bin" target
527ecddccd0SStefan Roese# and need to introduce a new build target with the full blown U-Boot
528ecddccd0SStefan Roese# at the start padded up to the start of the SPL image. And then concat
529ecddccd0SStefan Roese# the SPL image to the end.
530ecddccd0SStefan Roese$(obj)u-boot-img-spl-at-end.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.img
531ecddccd0SStefan Roese		tr "\000" "\377" < /dev/zero | dd ibs=1 count=$(CONFIG_UBOOT_PAD_TO) \
532ecddccd0SStefan Roese			of=$(obj)u-boot-pad.img 2>/dev/null
533ecddccd0SStefan Roese		dd if=$(obj)u-boot.img of=$(obj)u-boot-pad.img \
534ecddccd0SStefan Roese			conv=notrunc 2>/dev/null
535ecddccd0SStefan Roese		cat $(obj)u-boot-pad.img $(obj)spl/u-boot-spl.bin > $@
536ecddccd0SStefan Roese
53786eb49b3SSimon Glassifeq ($(CONFIG_SANDBOX),y)
53886eb49b3SSimon GlassGEN_UBOOT = \
53986eb49b3SSimon Glass		cd $(LNDIR) && $(CC) $(SYMS) -T $(obj)u-boot.lds \
54086eb49b3SSimon Glass			-Wl,--start-group $(__LIBS) -Wl,--end-group \
54186eb49b3SSimon Glass			$(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot.map -o u-boot
54286eb49b3SSimon Glasselse
543ecb1dc89SMike FrysingerGEN_UBOOT = \
54497b24d3dSMarek Vasut		cd $(LNDIR) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \
545ef123c52SAlbert ARIBAUD			$(__OBJS) \
546f9328639SMarian Balakowicz			--start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
547b2184c31Swdenk			-Map u-boot.map -o u-boot
54886eb49b3SSimon Glassendif
54986eb49b3SSimon Glass
55016a354f9SWolfgang Denk$(obj)u-boot:	depend \
551*08e39a84SMasahiro Yamada		$(SUBDIR_TOOLS) $(OBJS) $(LIBS) $(LDSCRIPT) $(obj)u-boot.lds
552ecb1dc89SMike Frysinger		$(GEN_UBOOT)
553ecb1dc89SMike Frysingerifeq ($(CONFIG_KALLSYMS),y)
5548a156fb6SMike Frysinger		smap=`$(call SYSTEM_MAP,$(obj)u-boot) | \
5551aada9cdSWolfgang Denk			awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 "\\\\000"}'` ; \
5561aada9cdSWolfgang Denk		$(CC) $(CFLAGS) -DSYSTEM_MAP="\"$${smap}\"" \
5571aada9cdSWolfgang Denk			-c common/system_map.c -o $(obj)common/system_map.o
558ecb1dc89SMike Frysinger		$(GEN_UBOOT) $(obj)common/system_map.o
559ecb1dc89SMike Frysingerendif
5607ebf7443Swdenk
5613bddafaaSMasahiro Yamada$(OBJS):
5623bddafaaSMasahiro Yamada	@:
563f9328639SMarian Balakowicz
564349e83f0SChe-liang Chiou$(LIBS):	depend $(SUBDIR_TOOLS)
5653bddafaaSMasahiro Yamada		$(MAKE) $(build) $(dir $(subst $(obj),,$@))
5663bddafaaSMasahiro Yamada		mv $(dir $@)built-in.o $@
567a8c7c708Swdenk
568d0d6144eSPeter Tyser$(SUBDIRS):	depend
569b028f715Swdenk		$(MAKE) -C $@ all
5707ebf7443Swdenk
571349e83f0SChe-liang Chiou$(SUBDIR_EXAMPLES): $(obj)u-boot
572349e83f0SChe-liang Chiou
573d0d6144eSPeter Tyser$(LDSCRIPT):	depend
574f65c9812SMike Frysinger		$(MAKE) -C $(dir $@) $(notdir $@)
575f65c9812SMike Frysinger
576ef123c52SAlbert ARIBAUD$(obj)u-boot.lds: $(LDSCRIPT)
57797b24d3dSMarek Vasut		$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$< >$@
5781aada9cdSWolfgang Denk
579e935a374SHaiying Wangnand_spl:	$(TIMESTAMP_FILE) $(VERSION_FILE) depend
5808318fbf8SMarian Balakowicz		$(MAKE) -C nand_spl/board/$(BOARDDIR) all
581887e2ec9SStefan Roese
582e935a374SHaiying Wang$(obj)u-boot-nand.bin:	nand_spl $(obj)u-boot.bin
5838318fbf8SMarian Balakowicz		cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin
584887e2ec9SStefan Roese
585bd25fdbaSAneesh V$(obj)spl/u-boot-spl.bin:	$(SUBDIR_TOOLS) depend
5865df2ee27SDaniel Schwierzeck		$(MAKE) -C spl all
5875df2ee27SDaniel Schwierzeck
5883aa29de0SYing Zhang$(obj)tpl/u-boot-tpl.bin:	$(SUBDIR_TOOLS) depend
5893aa29de0SYing Zhang		$(MAKE) -C spl all CONFIG_TPL_BUILD=y
5903aa29de0SYing Zhang
591f9328639SMarian Balakowiczupdater:
5920358df42SMike Frysinger		$(MAKE) -C tools/updater all
5938f713fdfSdzu
5942a998793SDaniel Hobi# Explicitly make _depend in subdirs containing multiple targets to prevent
5952a998793SDaniel Hobi# parallel sub-makes creating .depend files simultaneously.
59616a354f9SWolfgang Denkdepend dep:	$(TIMESTAMP_FILE) $(VERSION_FILE) \
59739bc12ddSJoel Fernandes		$(obj)include/spl-autoconf.mk \
5983aa29de0SYing Zhang		$(obj)include/tpl-autoconf.mk \
59916a354f9SWolfgang Denk		$(obj)include/autoconf.mk \
600a4814a69SStefano Babic		$(obj)include/generated/generic-asm-offsets.h \
601a4814a69SStefano Babic		$(obj)include/generated/asm-offsets.h
6027ebf7443Swdenk
603e5e4e705SLi YangTAG_SUBDIRS = $(SUBDIRS)
604e5e4e705SLi YangTAG_SUBDIRS += $(dir $(__LIBS))
605a340c325SJean-Christophe PLAGNIOL-VILLARDTAG_SUBDIRS += include
606a340c325SJean-Christophe PLAGNIOL-VILLARD
607857d9ea6SHorst KronstorferFIND := find
608857d9ea6SHorst KronstorferFINDFLAGS := -L
609857d9ea6SHorst Kronstorfer
6101064d980STom Rinicheckstack:
6111064d980STom Rini		$(CROSS_COMPILE)objdump -d $(obj)u-boot \
6121064d980STom Rini			`$(FIND) $(obj) -name u-boot-spl -print` | \
6131064d980STom Rini			perl $(src)tools/checkstack.pl $(ARCH)
6141064d980STom Rini
615f9328639SMarian Balakowicztags ctags:
616857d9ea6SHorst Kronstorfer		ctags -w -o $(obj)ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
617e5e4e705SLi Yang						-name '*.[chS]' -print`
6187ebf7443Swdenk
6197ebf7443Swdenketags:
620857d9ea6SHorst Kronstorfer		etags -a -o $(obj)etags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
621e5e4e705SLi Yang						-name '*.[chS]' -print`
622ffda586fSLi Yangcscope:
623857d9ea6SHorst Kronstorfer		$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) -name '*.[chS]' -print > \
624857d9ea6SHorst Kronstorfer						cscope.files
625ffda586fSLi Yang		cscope -b -q -k
6267ebf7443Swdenk
627ecb1dc89SMike FrysingerSYSTEM_MAP = \
628ecb1dc89SMike Frysinger		$(NM) $1 | \
6297ebf7443Swdenk		grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
630ecb1dc89SMike Frysinger		LC_ALL=C sort
631ecb1dc89SMike Frysinger$(obj)System.map:	$(obj)u-boot
632ecb1dc89SMike Frysinger		@$(call SYSTEM_MAP,$<) > $(obj)System.map
6337ebf7443Swdenk
63406a119a0STom Rinicheckthumb:
63506a119a0STom Rini	@if test $(call cc-version) -lt 0404; then \
63606a119a0STom Rini		echo -n '*** Your GCC does not produce working '; \
63706a119a0STom Rini		echo 'binaries in THUMB mode.'; \
63806a119a0STom Rini		echo '*** Your board is configured for THUMB mode.'; \
63906a119a0STom Rini		false; \
64006a119a0STom Rini	fi
6416ec63f41SScott Wood
6426ec63f41SScott Wood# GCC 3.x is reported to have problems generating the type of relocation
6436ec63f41SScott Wood# that U-Boot wants.
6446ec63f41SScott Wood# See http://lists.denx.de/pipermail/u-boot/2012-September/135156.html
6456ec63f41SScott Woodcheckgcc4:
6466ec63f41SScott Wood	@if test $(call cc-version) -lt 0400; then \
6476ec63f41SScott Wood		echo -n '*** Your GCC is too old, please upgrade to GCC 4.x or newer'; \
6486ec63f41SScott Wood		false; \
6496ec63f41SScott Wood	fi
6506ec63f41SScott Wood
651501ebdf2SStephen Warrencheckdtc:
652501ebdf2SStephen Warren	@if test $(call dtc-version) -lt 0104; then \
653501ebdf2SStephen Warren		echo '*** Your dtc is too old, please upgrade to dtc 1.4 or newer'; \
654501ebdf2SStephen Warren		false; \
655501ebdf2SStephen Warren	fi
656501ebdf2SStephen Warren
6572f155f6cSGrant Likely#
6582f155f6cSGrant Likely# Auto-generate the autoconf.mk file (which is included by all makefiles)
6592f155f6cSGrant Likely#
6602f155f6cSGrant Likely# This target actually generates 2 files; autoconf.mk and autoconf.mk.dep.
6612f155f6cSGrant Likely# the dep file is only include in this top level makefile to determine when
6622f155f6cSGrant Likely# to regenerate the autoconf.mk file.
6631510b82dSWolfgang Denk$(obj)include/autoconf.mk.dep: $(obj)include/config.h include/common.h
6641510b82dSWolfgang Denk	@$(XECHO) Generating $@ ; \
66516fe7775SMike Frysinger	set -e ; \
666ae6d1056SWolfgang Denk	: Generate the dependancies ; \
6674c34b2a0SMike Frysinger	$(CC) -x c -DDO_DEPS_ONLY -M $(CFLAGS) $(CPPFLAGS) \
6681510b82dSWolfgang Denk		-MQ $(obj)include/autoconf.mk include/common.h > $@
6691510b82dSWolfgang Denk
6701510b82dSWolfgang Denk$(obj)include/autoconf.mk: $(obj)include/config.h
6711510b82dSWolfgang Denk	@$(XECHO) Generating $@ ; \
6721510b82dSWolfgang Denk	set -e ; \
673ae6d1056SWolfgang Denk	: Extract the config macros ; \
6741510b82dSWolfgang Denk	$(CPP) $(CFLAGS) -DDO_DEPS_ONLY -dM include/common.h | \
6754a0f7538SWolfgang Denk		sed -n -f tools/scripts/define2mk.sed > $@.tmp && \
6764a0f7538SWolfgang Denk	mv $@.tmp $@
6772f155f6cSGrant Likely
67839bc12ddSJoel Fernandes# Auto-generate the spl-autoconf.mk file (which is included by all makefiles for SPL)
6793aa29de0SYing Zhang$(obj)include/tpl-autoconf.mk: $(obj)include/config.h
6803aa29de0SYing Zhang	@$(XECHO) Generating $@ ; \
6813aa29de0SYing Zhang	set -e ; \
6823aa29de0SYing Zhang	: Extract the config macros ; \
6833aa29de0SYing Zhang	$(CPP) $(CFLAGS) -DCONFIG_TPL_BUILD  -DCONFIG_SPL_BUILD\
6843aa29de0SYing Zhang			-DDO_DEPS_ONLY -dM include/common.h | \
6853aa29de0SYing Zhang	sed -n -f tools/scripts/define2mk.sed > $@.tmp && \
6863aa29de0SYing Zhang	mv $@.tmp $@
6873aa29de0SYing Zhang
68839bc12ddSJoel Fernandes$(obj)include/spl-autoconf.mk: $(obj)include/config.h
68939bc12ddSJoel Fernandes	@$(XECHO) Generating $@ ; \
69039bc12ddSJoel Fernandes	set -e ; \
69139bc12ddSJoel Fernandes	: Extract the config macros ; \
69239bc12ddSJoel Fernandes	$(CPP) $(CFLAGS) -DCONFIG_SPL_BUILD -DDO_DEPS_ONLY -dM include/common.h | \
69339bc12ddSJoel Fernandes	sed -n -f tools/scripts/define2mk.sed > $@.tmp && \
69439bc12ddSJoel Fernandes	mv $@.tmp $@
69539bc12ddSJoel Fernandes
69616a354f9SWolfgang Denk$(obj)include/generated/generic-asm-offsets.h:	$(obj)include/autoconf.mk.dep \
69739bc12ddSJoel Fernandes	$(obj)include/spl-autoconf.mk \
6983aa29de0SYing Zhang	$(obj)include/tpl-autoconf.mk \
69916a354f9SWolfgang Denk	$(obj)lib/asm-offsets.s
70016a354f9SWolfgang Denk	@$(XECHO) Generating $@
70116a354f9SWolfgang Denk	tools/scripts/make-asm-offsets $(obj)lib/asm-offsets.s $@
70216a354f9SWolfgang Denk
70316a354f9SWolfgang Denk$(obj)lib/asm-offsets.s:	$(obj)include/autoconf.mk.dep \
70439bc12ddSJoel Fernandes	$(obj)include/spl-autoconf.mk \
7053aa29de0SYing Zhang	$(obj)include/tpl-autoconf.mk \
70616a354f9SWolfgang Denk	$(src)lib/asm-offsets.c
70716a354f9SWolfgang Denk	@mkdir -p $(obj)lib
70816a354f9SWolfgang Denk	$(CC) -DDO_DEPS_ONLY \
70916a354f9SWolfgang Denk		$(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
71016a354f9SWolfgang Denk		-o $@ $(src)lib/asm-offsets.c -c -S
71116a354f9SWolfgang Denk
712a4814a69SStefano Babic$(obj)include/generated/asm-offsets.h:	$(obj)include/autoconf.mk.dep \
71339bc12ddSJoel Fernandes	$(obj)include/spl-autoconf.mk \
7143aa29de0SYing Zhang	$(obj)include/tpl-autoconf.mk \
715a4814a69SStefano Babic	$(obj)$(CPUDIR)/$(SOC)/asm-offsets.s
716b12734eeSWolfgang Denk	@$(XECHO) Generating $@
717a4814a69SStefano Babic	tools/scripts/make-asm-offsets $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s $@
718a4814a69SStefano Babic
71939bc12ddSJoel Fernandes$(obj)$(CPUDIR)/$(SOC)/asm-offsets.s:	$(obj)include/autoconf.mk.dep \
7203aa29de0SYing Zhang	$(obj)include/spl-autoconf.mk \
7213aa29de0SYing Zhang	$(obj)include/tpl-autoconf.mk
722a4814a69SStefano Babic	@mkdir -p $(obj)$(CPUDIR)/$(SOC)
723a4814a69SStefano Babic	if [ -f $(src)$(CPUDIR)/$(SOC)/asm-offsets.c ];then \
724a4814a69SStefano Babic		$(CC) -DDO_DEPS_ONLY \
725a4814a69SStefano Babic		$(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
726a4814a69SStefano Babic			-o $@ $(src)$(CPUDIR)/$(SOC)/asm-offsets.c -c -S; \
727a4814a69SStefano Babic	else \
728a4814a69SStefano Babic		touch $@; \
729a4814a69SStefano Babic	fi
730a4814a69SStefano Babic
7317ebf7443Swdenk#########################################################################
732ae6d1056SWolfgang Denkelse	# !config.mk
733f9328639SMarian Balakowiczall $(obj)u-boot.hex $(obj)u-boot.srec $(obj)u-boot.bin \
734f9328639SMarian Balakowicz$(obj)u-boot.img $(obj)u-boot.dis $(obj)u-boot \
735249b53a6SLoïc Minier$(filter-out tools,$(SUBDIRS)) \
7360358df42SMike Frysingerupdater depend dep tags ctags etags cscope $(obj)System.map:
7377ebf7443Swdenk	@echo "System not configured - see README" >&2
7387ebf7443Swdenk	@ exit 1
739c7c0d542SMike Frysinger
740249b53a6SLoïc Miniertools: $(VERSION_FILE) $(TIMESTAMP_FILE)
7410358df42SMike Frysinger	$(MAKE) -C $@ all
742ae6d1056SWolfgang Denkendif	# config.mk
7437ebf7443Swdenk
744c37980c3SAlbert ARIBAUD# ARM relocations should all be R_ARM_RELATIVE.
745c37980c3SAlbert ARIBAUDcheckarmreloc: $(obj)u-boot
746c37980c3SAlbert ARIBAUD	@if test "R_ARM_RELATIVE" != \
747c1273d71SAndreas Bießmann		"`$(CROSS_COMPILE)readelf -r $< | cut -d ' ' -f 4 | grep R_ARM | sort -u`"; \
748c37980c3SAlbert ARIBAUD		then echo "$< contains relocations other than \
749c37980c3SAlbert ARIBAUD		R_ARM_RELATIVE"; false; fi
750c37980c3SAlbert ARIBAUD
75128abd48fSIlya Yanok$(VERSION_FILE):
75214ce91b1SMike Frysinger		@mkdir -p $(dir $(VERSION_FILE))
75328abd48fSIlya Yanok		@( localvers='$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ; \
75428abd48fSIlya Yanok		   printf '#define PLAIN_VERSION "%s%s"\n' \
75528abd48fSIlya Yanok			"$(U_BOOT_VERSION)" "$${localvers}" ; \
75628abd48fSIlya Yanok		   printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' \
75728abd48fSIlya Yanok			"$(U_BOOT_VERSION)" "$${localvers}" ; \
75828abd48fSIlya Yanok		) > $@.tmp
75928abd48fSIlya Yanok		@( printf '#define CC_VERSION_STRING "%s"\n' \
76028abd48fSIlya Yanok		 '$(shell $(CC) --version | head -n 1)' )>>  $@.tmp
76128abd48fSIlya Yanok		@( printf '#define LD_VERSION_STRING "%s"\n' \
76228abd48fSIlya Yanok		 '$(shell $(LD) -v | head -n 1)' )>>  $@.tmp
76328abd48fSIlya Yanok		@cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
76428abd48fSIlya Yanok
765249b53a6SLoïc Minier$(TIMESTAMP_FILE):
766249b53a6SLoïc Minier		@mkdir -p $(dir $(TIMESTAMP_FILE))
767a76406fbSLoïc Minier		@LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > $@.tmp
768a76406fbSLoïc Minier		@LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> $@.tmp
769a76406fbSLoïc Minier		@cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
770249b53a6SLoïc Minier
7710358df42SMike Frysingereasylogo env gdb:
7720358df42SMike Frysinger	$(MAKE) -C tools/$@ all MTD_VERSION=${MTD_VERSION}
7730358df42SMike Frysingergdbtools: gdb
7740358df42SMike Frysinger
77530ff8918SMarek Vasutxmldocs pdfdocs psdocs htmldocs mandocs: tools/kernel-doc/docproc
77630ff8918SMarek Vasut	$(MAKE) U_BOOT_VERSION=$(U_BOOT_VERSION) -C doc/DocBook/ $@
77730ff8918SMarek Vasut
778249b53a6SLoïc Miniertools-all: easylogo env gdb $(VERSION_FILE) $(TIMESTAMP_FILE)
7790358df42SMike Frysinger	$(MAKE) -C tools HOST_TOOLS_ALL=y
7800358df42SMike Frysinger
7814e53a258SWolfgang Denk.PHONY : CHANGELOG
7824e53a258SWolfgang DenkCHANGELOG:
783b985b5d6SBen Warren	git log --no-merges U-Boot-1_1_5.. | \
784b985b5d6SBen Warren	unexpand -a | sed -e 's/\s\s*$$//' > $@
7854e53a258SWolfgang Denk
7860a823aa2SHarald Welteinclude/license.h: tools/bin2header COPYING
7870a823aa2SHarald Welte	cat COPYING | gzip -9 -c | ./tools/bin2header license_gzip > include/license.h
7887ebf7443Swdenk#########################################################################
7897ebf7443Swdenk
7907ebf7443Swdenkunconfig:
791887e2ec9SStefan Roese	@rm -f $(obj)include/config.h $(obj)include/config.mk \
7922f155f6cSGrant Likely		$(obj)board/*/config.tmp $(obj)board/*/*/config.tmp \
79339bc12ddSJoel Fernandes		$(obj)include/autoconf.mk $(obj)include/autoconf.mk.dep \
7943aa29de0SYing Zhang		$(obj)include/spl-autoconf.mk \
7953aa29de0SYing Zhang		$(obj)include/tpl-autoconf.mk
7967ebf7443Swdenk
797a6862bc1SWolfgang Denk%_config::	unconfig
798a6862bc1SWolfgang Denk	@$(MKCONFIG) -A $(@:_config=)
799a6862bc1SWolfgang Denk
800d6a5e6d5SLoïc Miniersinclude $(obj).boards.depend
801d6a5e6d5SLoïc Minier$(obj).boards.depend:	boards.cfg
80250c2a91bSMasahiro Yamada	@awk '(NF && $$1 !~ /^#/) { print $$7 ": " $$7 "_config; $$(MAKE)" }' $< > $@
8039f4a4206SMike Frysinger
8048c994630SWolfgang Denk#
8058c994630SWolfgang Denk# Functions to generate common board directory names
8068c994630SWolfgang Denk#
8078c994630SWolfgang Denklcname	= $(shell echo $(1) | sed -e 's/\(.*\)_config/\L\1/')
8088c994630SWolfgang Denkucname	= $(shell echo $(1) | sed -e 's/\(.*\)_config/\U\1/')
8098c994630SWolfgang Denk
810699f0512SWolfgang Denk#########################################################################
8113e38691eSwdenk#########################################################################
8127ebf7443Swdenk
8137ebf7443Swdenkclean:
8141bc15386SPeter Tyser	@rm -f $(obj)examples/standalone/82559_eeprom			  \
815d640ac58SWolfgang Denk	       $(obj)examples/standalone/atmel_df_pow2			  \
8161bc15386SPeter Tyser	       $(obj)examples/standalone/eepro100_eeprom		  \
8171bc15386SPeter Tyser	       $(obj)examples/standalone/hello_world			  \
8181bc15386SPeter Tyser	       $(obj)examples/standalone/interrupt			  \
8191bc15386SPeter Tyser	       $(obj)examples/standalone/mem_to_mem_idma2intr		  \
8201bc15386SPeter Tyser	       $(obj)examples/standalone/sched				  \
821201a017cSMike Frysinger	       $(obj)examples/standalone/smc911{11,x}_eeprom		  \
8221bc15386SPeter Tyser	       $(obj)examples/standalone/test_burst			  \
8231bc15386SPeter Tyser	       $(obj)examples/standalone/timer
824d4abc757SPeter Tyser	@rm -f $(obj)examples/api/demo{,.bin}
825f9301e1cSWolfgang Denk	@rm -f $(obj)tools/bmp_logo	   $(obj)tools/easylogo/easylogo  \
826f9301e1cSWolfgang Denk	       $(obj)tools/env/{fw_printenv,fw_setenv}			  \
827f9301e1cSWolfgang Denk	       $(obj)tools/envcrc					  \
828f9301e1cSWolfgang Denk	       $(obj)tools/gdb/{astest,gdbcont,gdbsend}			  \
829f9301e1cSWolfgang Denk	       $(obj)tools/gen_eth_addr    $(obj)tools/img2srec		  \
8307717fe10SHorst Kronstorfer	       $(obj)tools/mk{env,}image   $(obj)tools/mpc86x_clk	  \
831ad403e71SChander Kashyap	       $(obj)tools/mk{$(BOARD),}spl				  \
8328aa09026SMarek Vasut	       $(obj)tools/mxsboot					  \
83330ff8918SMarek Vasut	       $(obj)tools/ncb		   $(obj)tools/ubsha1		  \
8346c887b2aSSimon Glass	       $(obj)tools/kernel-doc/docproc				  \
8356c887b2aSSimon Glass	       $(obj)tools/proftool
836f9301e1cSWolfgang Denk	@rm -f $(obj)board/cray/L1/{bootscript.c,bootscript.image}	  \
83774c7a95fSWolfgang Denk	       $(obj)board/matrix_vision/*/bootscript.img		  \
838566e5cf4SWolfgang Denk	       $(obj)board/voiceblue/eeprom 				  \
8391aada9cdSWolfgang Denk	       $(obj)u-boot.lds						  \
840fb5166ceSMike Frysinger	       $(obj)arch/blackfin/cpu/bootrom-asm-offsets.[chs]	  \
841fb5166ceSMike Frysinger	       $(obj)arch/blackfin/cpu/init.{lds,elf}
842dc7746d8SWolfgang Denk	@rm -f $(obj)include/bmp_logo.h
843c270730fSChe-Liang Chiou	@rm -f $(obj)include/bmp_logo_data.h
84416a354f9SWolfgang Denk	@rm -f $(obj)lib/asm-offsets.s
845a4814a69SStefano Babic	@rm -f $(obj)include/generated/asm-offsets.h
846a4814a69SStefano Babic	@rm -f $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s
847d4abc757SPeter Tyser	@rm -f $(TIMESTAMP_FILE) $(VERSION_FILE)
848b3141fdbSAndreas Bießmann	@$(MAKE) -s -C doc/DocBook/ cleandocs
849ae6d1056SWolfgang Denk	@find $(OBJTREE) -type f \
8504a30f1e8STom Rini		\( -name 'core' -o -name '*.bak' -o -name '*~' -o -name '*.su' \
85171a988aaSTroy Kisky		-o -name '*.o'	-o -name '*.a' -o -name '*.exe' \
85271a988aaSTroy Kisky		-o -name '*.cfgtmp' \) -print \
8537ebf7443Swdenk		| xargs rm -f
8547ebf7443Swdenk
855734329f9SAndy Fleming# Removes everything not needed for testing u-boot
856734329f9SAndy Flemingtidy:	clean
857734329f9SAndy Fleming	@find $(OBJTREE) -type f \( -name '*.depend*' \) -print | xargs rm -f
858734329f9SAndy Fleming
859734329f9SAndy Flemingclobber:	tidy
860734329f9SAndy Fleming	@find $(OBJTREE) -type f \( -name '*.srec' \
861734329f9SAndy Fleming		-o -name '*.bin' -o -name u-boot.img \) \
862734329f9SAndy Fleming		-print0 | xargs -0 rm -f
863ffda586fSLi Yang	@rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS \
8645013c09fSWolfgang Denk		$(obj)cscope.* $(obj)*.*~
8654e0fbb98SDaniel Schwierzeck	@rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL-y)
866aa0c7a86SPrafulla Wadaskar	@rm -f $(obj)u-boot.kwb
8675d898a00SShaohui Xie	@rm -f $(obj)u-boot.pbl
868c5fb70c9SStefano Babic	@rm -f $(obj)u-boot.imx
869ba597609SBenoît Thébaudeau	@rm -f $(obj)u-boot-with-spl.imx
8707d5a5c79SBenoît Thébaudeau	@rm -f $(obj)u-boot-with-nand-spl.imx
8717816f2cfSHeiko Schocher	@rm -f $(obj)u-boot.ubl
872d36d8859SChristian Riesch	@rm -f $(obj)u-boot.ais
873bbb0b128SSimon Glass	@rm -f $(obj)u-boot.dtb
87430b9b932SMarek Vasut	@rm -f $(obj)u-boot.sb
875714dc001SMarek Vasut	@rm -f $(obj)u-boot.bd
87694aebe6cSStefan Roese	@rm -f $(obj)u-boot.spr
87797b24d3dSMarek Vasut	@rm -f $(obj)nand_spl/{u-boot.{lds,lst},System.map}
87897b24d3dSMarek Vasut	@rm -f $(obj)nand_spl/{u-boot-nand_spl.lds,u-boot-spl,u-boot-spl.map}
87997b24d3dSMarek Vasut	@rm -f $(obj)spl/{u-boot-spl,u-boot-spl.bin,u-boot-spl.map}
880ef123c52SAlbert ARIBAUD	@rm -f $(obj)spl/u-boot-spl.lds
8813aa29de0SYing Zhang	@rm -f $(obj)tpl/{u-boot-tpl,u-boot-tpl.bin,u-boot-tpl.map}
8823aa29de0SYing Zhang	@rm -f $(obj)tpl/u-boot-spl.lds
88394bcfe52SNishanth Menon	@rm -f $(obj)MLO MLO.byteswap
884a3cbc396SStefano Babic	@rm -f $(obj)SPL
8858b425b3fSDaniel Schwierzeck	@rm -f $(obj)tools/xway-swap-bytes
886a47a12beSStefan Roese	@rm -f $(obj)arch/powerpc/cpu/mpc824x/bedbug_603e.c
8872d14e36aSYork Sun	@rm -f $(obj)arch/powerpc/cpu/mpc83xx/ddr-gen?.c
888a9d8bc98SLoïc Minier	@rm -fr $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
88916a354f9SWolfgang Denk	@rm -fr $(obj)include/generated
890a958b663SJean-Christophe PLAGNIOL-VILLARD	@[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name "*" -type l -print | xargs rm -f
891bbb0b128SSimon Glass	@rm -f $(obj)dts/*.tmp
8926d660e77SSughosh Ganu	@rm -f $(obj)spl/u-boot-spl{,-pad}.ais
8937ebf7443Swdenk
8947ebf7443Swdenkmrproper \
8957ebf7443Swdenkdistclean:	clobber unconfig
896afd077bdSMike Frysingerifneq ($(OBJTREE),$(SRCTREE))
897ae6d1056SWolfgang Denk	rm -rf $(obj)*
898f9328639SMarian Balakowiczendif
8997ebf7443Swdenk
9007ebf7443Swdenkbackup:
9017ebf7443Swdenk	F=`basename $(TOPDIR)` ; cd .. ; \
902d6b93714SIlya Yanok	gtar --force-local -zcvf `LC_ALL=C date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F
9037ebf7443Swdenk
9047ebf7443Swdenk#########################################################################
905