xref: /openbmc/u-boot/Makefile (revision 3aa29de0)
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 =
1140a60c6eSTom RiniEXTRAVERSION = -rc1
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#
48f9328639SMarian Balakowicz# U-boot build supports producing a object files to the 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#
54f9328639SMarian Balakowicz# 2) Set environement 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#
62f9328639SMarian Balakowicz# Command line 'O=' setting overrides BUILD_DIR environent 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
105*3aa29de0SYing ZhangTPLTREE		:= $(OBJTREE)/tpl
106f9328639SMarian BalakowiczSRCTREE		:= $(CURDIR)
107f9328639SMarian BalakowiczTOPDIR		:= $(SRCTREE)
108f9328639SMarian BalakowiczLNDIR		:= $(OBJTREE)
109*3aa29de0SYing 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
23519c402afSSimon GlassLIBS-y += lib/rsa/librsa.o
236f52d7b35SDaniel SchwierzeckLIBS-y += lib/lzma/liblzma.o
237f52d7b35SDaniel SchwierzeckLIBS-y += lib/lzo/liblzo.o
238f52d7b35SDaniel SchwierzeckLIBS-y += 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 \
251045fa1e1SStephen Warren	fs/cbfs/libcbfs.o \
25284cd9327SGabe Black	fs/cramfs/libcramfs.o \
253a1596438SUma Shankar	fs/ext4/libext4fs.o \
254a1596438SUma Shankar	fs/fat/libfat.o \
255a1596438SUma Shankar	fs/fdos/libfdos.o \
256a1596438SUma Shankar	fs/jffs2/libjffs2.o \
257a1596438SUma Shankar	fs/reiserfs/libreiserfs.o \
25892ccc96bSSimon Glass	fs/sandbox/libsandboxfs.o \
259a1596438SUma Shankar	fs/ubifs/libubifs.o \
260a1596438SUma Shankar	fs/yaffs2/libyaffs2.o \
261a1596438SUma Shankar	fs/zfs/libzfs.o
262f52d7b35SDaniel SchwierzeckLIBS-y += net/libnet.o
263f52d7b35SDaniel SchwierzeckLIBS-y += disk/libdisk.o
264f52d7b35SDaniel SchwierzeckLIBS-y += drivers/bios_emulator/libatibiosemu.o
265f52d7b35SDaniel SchwierzeckLIBS-y += drivers/block/libblock.o
2660044c42eSStefan RoeseLIBS-$(CONFIG_BOOTCOUNT_LIMIT) += drivers/bootcount/libbootcount.o
267acbb1eb7SAkshay SaraswatLIBS-y += drivers/crypto/libcrypto.o
268f52d7b35SDaniel SchwierzeckLIBS-y += drivers/dma/libdma.o
269f52d7b35SDaniel SchwierzeckLIBS-y += drivers/fpga/libfpga.o
270f52d7b35SDaniel SchwierzeckLIBS-y += drivers/gpio/libgpio.o
271f52d7b35SDaniel SchwierzeckLIBS-y += drivers/hwmon/libhwmon.o
272f52d7b35SDaniel SchwierzeckLIBS-y += drivers/i2c/libi2c.o
273f52d7b35SDaniel SchwierzeckLIBS-y += drivers/input/libinput.o
274f52d7b35SDaniel SchwierzeckLIBS-y += drivers/misc/libmisc.o
275f52d7b35SDaniel SchwierzeckLIBS-y += drivers/mmc/libmmc.o
276f52d7b35SDaniel SchwierzeckLIBS-y += drivers/mtd/libmtd.o
277f52d7b35SDaniel SchwierzeckLIBS-y += drivers/mtd/nand/libnand.o
278f52d7b35SDaniel SchwierzeckLIBS-y += drivers/mtd/onenand/libonenand.o
279f52d7b35SDaniel SchwierzeckLIBS-y += drivers/mtd/ubi/libubi.o
280f52d7b35SDaniel SchwierzeckLIBS-y += drivers/mtd/spi/libspi_flash.o
281f52d7b35SDaniel SchwierzeckLIBS-y += drivers/net/libnet.o
282f52d7b35SDaniel SchwierzeckLIBS-y += drivers/net/phy/libphy.o
283f52d7b35SDaniel SchwierzeckLIBS-y += drivers/pci/libpci.o
284f52d7b35SDaniel SchwierzeckLIBS-y += drivers/pcmcia/libpcmcia.o
285e0a0cbf2SŁukasz MajewskiLIBS-y += drivers/power/libpower.o \
286b95aacd3SŁukasz Majewski	drivers/power/fuel_gauge/libfuel_gauge.o \
287eba42391SŁukasz Majewski	drivers/power/pmic/libpmic.o \
288eba42391SŁukasz Majewski	drivers/power/battery/libbattery.o
289f52d7b35SDaniel SchwierzeckLIBS-y += drivers/spi/libspi.o
290f22b11c1SLukasz MajewskiLIBS-y += drivers/dfu/libdfu.o
2917737d5c6SDave Liuifeq ($(CPU),mpc83xx)
292f52d7b35SDaniel SchwierzeckLIBS-y += drivers/qe/libqe.o
293f52d7b35SDaniel SchwierzeckLIBS-y += arch/powerpc/cpu/mpc8xxx/ddr/libddr.o
294f52d7b35SDaniel SchwierzeckLIBS-y += arch/powerpc/cpu/mpc8xxx/lib8xxx.o
2957737d5c6SDave Liuendif
296da9d4610SAndy Flemingifeq ($(CPU),mpc85xx)
297f52d7b35SDaniel SchwierzeckLIBS-y += drivers/qe/libqe.o
298f52d7b35SDaniel SchwierzeckLIBS-y += drivers/net/fm/libfm.o
299f52d7b35SDaniel SchwierzeckLIBS-y += arch/powerpc/cpu/mpc8xxx/ddr/libddr.o
300f52d7b35SDaniel SchwierzeckLIBS-y += arch/powerpc/cpu/mpc8xxx/lib8xxx.o
30158e5e9afSKumar Galaendif
30258e5e9afSKumar Galaifeq ($(CPU),mpc86xx)
303f52d7b35SDaniel SchwierzeckLIBS-y += arch/powerpc/cpu/mpc8xxx/ddr/libddr.o
304f52d7b35SDaniel SchwierzeckLIBS-y += arch/powerpc/cpu/mpc8xxx/lib8xxx.o
305da9d4610SAndy Flemingendif
306f52d7b35SDaniel SchwierzeckLIBS-y += drivers/rtc/librtc.o
307f52d7b35SDaniel SchwierzeckLIBS-y += drivers/serial/libserial.o
308511ed5fdSRajeshwari ShindeLIBS-y += drivers/sound/libsound.o
309f6267998SRong ChangLIBS-y += drivers/tpm/libtpm.o
310f52d7b35SDaniel SchwierzeckLIBS-y += drivers/twserial/libtws.o
311f52d7b35SDaniel SchwierzeckLIBS-y += drivers/usb/eth/libusb_eth.o
312f52d7b35SDaniel SchwierzeckLIBS-y += drivers/usb/gadget/libusb_gadget.o
313f52d7b35SDaniel SchwierzeckLIBS-y += drivers/usb/host/libusb_host.o
314f52d7b35SDaniel SchwierzeckLIBS-y += drivers/usb/musb/libusb_musb.o
315eb81955bSIlya YanokLIBS-y += drivers/usb/musb-new/libusb_musb-new.o
316f52d7b35SDaniel SchwierzeckLIBS-y += drivers/usb/phy/libusb_phy.o
317f52d7b35SDaniel SchwierzeckLIBS-y += drivers/usb/ulpi/libusb_ulpi.o
318f52d7b35SDaniel SchwierzeckLIBS-y += drivers/video/libvideo.o
319f52d7b35SDaniel SchwierzeckLIBS-y += drivers/watchdog/libwatchdog.o
320f52d7b35SDaniel SchwierzeckLIBS-y += common/libcommon.o
321f52d7b35SDaniel SchwierzeckLIBS-y += lib/libfdt/libfdt.o
322f52d7b35SDaniel SchwierzeckLIBS-y += api/libapi.o
323f52d7b35SDaniel SchwierzeckLIBS-y += post/libpost.o
324f52d7b35SDaniel SchwierzeckLIBS-y += test/libtest.o
325f9328639SMarian Balakowicz
326806d2792SLokesh Vutlaifneq ($(CONFIG_OMAP_COMMON),)
327f52d7b35SDaniel SchwierzeckLIBS-y += $(CPUDIR)/omap-common/libomap-common.o
328f0f4b5ffSChandan Nathendif
32918936ee2SJason Liu
33024e8bee5SAlison Wangifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35 mxs vf610))
331ea00e59bSStefano BabicLIBS-y += arch/$(ARCH)/imx-common/libimx-common.o
33218936ee2SJason Liuendif
33318936ee2SJason Liu
334852bd07cSMinkyu Kangifeq ($(SOC),s5pc1xx)
335f52d7b35SDaniel SchwierzeckLIBS-y += $(CPUDIR)/s5p-common/libs5p-common.o
336852bd07cSMinkyu Kangendif
337393cb361SChander Kashyapifeq ($(SOC),exynos)
338f52d7b35SDaniel SchwierzeckLIBS-y += $(CPUDIR)/s5p-common/libs5p-common.o
339852bd07cSMinkyu Kangendif
3406d6c0baeSTom Warrenifneq ($(CONFIG_TEGRA),)
341d9e73a87SAllen MartinLIBS-y += arch/$(ARCH)/cpu/$(SOC)-common/lib$(SOC)-common.o
3423064f322STom WarrenLIBS-y += arch/$(ARCH)/cpu/tegra-common/libcputegra-common.o
3433064f322STom WarrenLIBS-y += $(CPUDIR)/tegra-common/libtegra-common.o
344d9e73a87SAllen Martinendif
345852bd07cSMinkyu Kang
346f52d7b35SDaniel SchwierzeckLIBS := $(addprefix $(obj),$(sort $(LIBS-y)))
347249b53a6SLoïc Minier.PHONY : $(LIBS)
348a8c7c708Swdenk
3496d8962e8SSebastien CarlierLIBBOARD = board/$(BOARDDIR)/lib$(BOARD).o
350de109d90SWolfgang DenkLIBBOARD := $(addprefix $(obj),$(LIBBOARD))
351de109d90SWolfgang Denk
3524f7cb08eSwdenk# Add GCC lib
35352b1bf2cSWolfgang Denkifdef USE_PRIVATE_LIBGCC
35452b1bf2cSWolfgang Denkifeq ("$(USE_PRIVATE_LIBGCC)", "yes")
355635d1b3eSMatthias WeisserPLATFORM_LIBGCC = $(OBJTREE)/arch/$(ARCH)/lib/libgcc.o
35652b1bf2cSWolfgang Denkelse
35752b1bf2cSWolfgang DenkPLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc
35852b1bf2cSWolfgang Denkendif
35952b1bf2cSWolfgang Denkelse
360cca4e4aeSWolfgang DenkPLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
36152b1bf2cSWolfgang Denkendif
36252b1bf2cSWolfgang DenkPLATFORM_LIBS += $(PLATFORM_LIBGCC)
36352b1bf2cSWolfgang Denkexport PLATFORM_LIBS
3643d3befa7Swdenk
3656ac9f479SMike Frysinger# Special flags for CPP when processing the linker script.
3666ac9f479SMike Frysinger# Pass the version down so we can handle backwards compatibility
3676ac9f479SMike Frysinger# on the fly.
3686ac9f479SMike FrysingerLDPPFLAGS += \
3696ac9f479SMike Frysinger	-include $(TOPDIR)/include/u-boot/u-boot.lds.h \
3707e6403a6SSimon Glass	-DCPUDIR=$(CPUDIR) \
3716ac9f479SMike Frysinger	$(shell $(LD) --version | \
3726ac9f479SMike Frysinger	  sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p')
3736ac9f479SMike Frysinger
374f9328639SMarian Balakowicz__OBJS := $(subst $(obj),,$(OBJS))
375de109d90SWolfgang Denk__LIBS := $(subst $(obj),,$(LIBS)) $(subst $(obj),,$(LIBBOARD))
376f9328639SMarian Balakowicz
3777ebf7443Swdenk#########################################################################
378bdccc4feSwdenk#########################################################################
3797ebf7443Swdenk
380f3a14d37SMike Frysingerifneq ($(CONFIG_BOARD_SIZE_LIMIT),)
381f3a14d37SMike FrysingerBOARD_SIZE_CHECK = \
382f3a14d37SMike Frysinger	@actual=`wc -c $@ | awk '{print $$1}'`; \
383d060e6f4SJoe Hershberger	limit=`printf "%d" $(CONFIG_BOARD_SIZE_LIMIT)`; \
384f3a14d37SMike Frysinger	if test $$actual -gt $$limit; then \
385d060e6f4SJoe Hershberger		echo "$@ exceeds file size limit:" >&2 ; \
386d060e6f4SJoe Hershberger		echo "  limit:  $$limit bytes" >&2 ; \
387d060e6f4SJoe Hershberger		echo "  actual: $$actual bytes" >&2 ; \
388d060e6f4SJoe Hershberger		echo "  excess: $$((actual - limit)) bytes" >&2; \
389f3a14d37SMike Frysinger		exit 1; \
390f3a14d37SMike Frysinger	fi
391f3a14d37SMike Frysingerelse
392f3a14d37SMike FrysingerBOARD_SIZE_CHECK =
393f3a14d37SMike Frysingerendif
394f3a14d37SMike Frysinger
3953e88337bSMike Frysinger# Always append ALL so that arch config.mk's can add custom ones
3964e0fbb98SDaniel SchwierzeckALL-y += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map
397e935a374SHaiying Wang
3984e0fbb98SDaniel SchwierzeckALL-$(CONFIG_NAND_U_BOOT) += $(obj)u-boot-nand.bin
3994e0fbb98SDaniel SchwierzeckALL-$(CONFIG_ONENAND_U_BOOT) += $(obj)u-boot-onenand.bin
4005df2ee27SDaniel SchwierzeckALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin
401*3aa29de0SYing ZhangALL-$(CONFIG_TPL) += $(obj)tpl/u-boot-tpl.bin
4022c0f79e4SSimon GlassALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot-dtb.bin
403b343bbb5SVadim Bendeburyifneq ($(CONFIG_SPL_TARGET),)
404b343bbb5SVadim BendeburyALL-$(CONFIG_SPL) += $(obj)$(subst ",,$(CONFIG_SPL_TARGET))
405b343bbb5SVadim Bendeburyendif
4067ebf7443Swdenk
40712b7b70cSAllen Martin# enable combined SPL/u-boot/dtb rules for tegra
4086d6c0baeSTom Warrenifneq ($(CONFIG_TEGRA),)
40912b7b70cSAllen Martinifeq ($(CONFIG_OF_SEPARATE),y)
41012b7b70cSAllen MartinALL-y += $(obj)u-boot-dtb-tegra.bin
41112b7b70cSAllen Martinelse
41212b7b70cSAllen MartinALL-y += $(obj)u-boot-nodtb-tegra.bin
41312b7b70cSAllen Martinendif
41412b7b70cSAllen Martinendif
41512b7b70cSAllen Martin
416349e83f0SChe-liang Chiouall:		$(ALL-y) $(SUBDIR_EXAMPLES)
4177ebf7443Swdenk
418501ebdf2SStephen Warren$(obj)u-boot.dtb:	checkdtc $(obj)u-boot
4192c0f79e4SSimon Glass		$(MAKE) -C dts binary
4202c0f79e4SSimon Glass		mv $(obj)dts/dt.dtb $@
4212c0f79e4SSimon Glass
4222c0f79e4SSimon Glass$(obj)u-boot-dtb.bin:	$(obj)u-boot.bin $(obj)u-boot.dtb
4232c0f79e4SSimon Glass		cat $^ >$@
4242c0f79e4SSimon Glass
425f9328639SMarian Balakowicz$(obj)u-boot.hex:	$(obj)u-boot
4266310eb9dSwdenk		$(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
4276310eb9dSwdenk
428f9328639SMarian Balakowicz$(obj)u-boot.srec:	$(obj)u-boot
4290817d688SRicardo Ribalda Delgado		$(OBJCOPY) -O srec $< $@
4307ebf7443Swdenk
431f9328639SMarian Balakowicz$(obj)u-boot.bin:	$(obj)u-boot
4327ebf7443Swdenk		$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
433f3a14d37SMike Frysinger		$(BOARD_SIZE_CHECK)
4347ebf7443Swdenk
43594a91e24SMike Frysinger$(obj)u-boot.ldr:	$(obj)u-boot
43676d82187SMike Frysinger		$(CREATE_LDR_ENV)
43768e56324SMike Frysinger		$(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS)
438f3a14d37SMike Frysinger		$(BOARD_SIZE_CHECK)
43994a91e24SMike Frysinger
44094a91e24SMike Frysinger$(obj)u-boot.ldr.hex:	$(obj)u-boot.ldr
44194a91e24SMike Frysinger		$(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@ -I binary
44294a91e24SMike Frysinger
44394a91e24SMike Frysinger$(obj)u-boot.ldr.srec:	$(obj)u-boot.ldr
44494a91e24SMike Frysinger		$(OBJCOPY) ${OBJCFLAGS} -O srec $< $@ -I binary
44594a91e24SMike Frysinger
446b40bda6bSStefan Roese#
447b40bda6bSStefan Roese# U-Boot entry point, needed for booting of full-blown U-Boot
448b40bda6bSStefan Roese# from the SPL U-Boot version.
449b40bda6bSStefan Roese#
450b40bda6bSStefan Roeseifndef CONFIG_SYS_UBOOT_START
451b40bda6bSStefan RoeseCONFIG_SYS_UBOOT_START := 0
452b40bda6bSStefan Roeseendif
453b40bda6bSStefan Roese
454f9328639SMarian Balakowicz$(obj)u-boot.img:	$(obj)u-boot.bin
455a2a0a717SWolfgang Denk		$(obj)tools/mkimage -A $(ARCH) -T firmware -C none \
456b40bda6bSStefan Roese		-O u-boot -a $(CONFIG_SYS_TEXT_BASE) \
457b40bda6bSStefan Roese		-e $(CONFIG_SYS_UBOOT_START) \
458881a87ecSWolfgang Denk		-n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
459bdccc4feSwdenk			sed -e 's/"[	 ]*$$/ for $(BOARD) board"/') \
460bdccc4feSwdenk		-d $< $@
461bdccc4feSwdenk
462291b3dcdSOtavio Salvador$(obj)u-boot.imx: $(obj)u-boot.bin depend
463291b3dcdSOtavio Salvador		$(MAKE) -C $(SRCTREE)/arch/arm/imx-common $(OBJTREE)/u-boot.imx
4648edcde5eSStefano Babic
465aa0c7a86SPrafulla Wadaskar$(obj)u-boot.kwb:       $(obj)u-boot.bin
46631d80c77SPrafulla Wadaskar		$(obj)tools/mkimage -n $(CONFIG_SYS_KWD_CONFIG) -T kwbimage \
4672ea88b06SEric Cooper		-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) -d $< $@
468aa0c7a86SPrafulla Wadaskar
4695d898a00SShaohui Xie$(obj)u-boot.pbl:	$(obj)u-boot.bin
4705d898a00SShaohui Xie		$(obj)tools/mkimage -n $(CONFIG_PBLRCW_CONFIG) \
4715d898a00SShaohui Xie		-R $(CONFIG_PBLPBI_CONFIG) -T pblimage \
4725d898a00SShaohui Xie		-d $< $@
4735d898a00SShaohui Xie
474566a494fSHeiko Schocher$(obj)u-boot.sha1:	$(obj)u-boot.bin
47501159530SHeiko Schocher		$(obj)tools/ubsha1 $(obj)u-boot.bin
476566a494fSHeiko Schocher
477f9328639SMarian Balakowicz$(obj)u-boot.dis:	$(obj)u-boot
4787ebf7443Swdenk		$(OBJDUMP) -d $< > $@
4797ebf7443Swdenk
480*3aa29de0SYing Zhang# $@ is output, $(1) and $(2) are inputs, $(3) is padded intermediate,
481*3aa29de0SYing Zhang# $(4) is pad-to
482*3aa29de0SYing ZhangSPL_PAD_APPEND = \
483*3aa29de0SYing Zhang		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(4) -I binary -O binary \
484*3aa29de0SYing Zhang		$(1) $(obj)$(3); \
485*3aa29de0SYing Zhang		cat $(obj)$(3) $(obj)$(2) > $@; \
486*3aa29de0SYing Zhang		rm $(obj)$(3)
48774752baaSScott Wood
488*3aa29de0SYing Zhangifdef CONFIG_TPL
489*3aa29de0SYing ZhangSPL_PAYLOAD := $(obj)tpl/u-boot-with-tpl.bin
490*3aa29de0SYing Zhangelse
491*3aa29de0SYing ZhangSPL_PAYLOAD := $(obj)u-boot.bin
492*3aa29de0SYing Zhangendif
49374752baaSScott Wood
494*3aa29de0SYing Zhang$(obj)u-boot-with-spl.bin: $(obj)spl/u-boot-spl.bin $(SPL_PAYLOAD)
495*3aa29de0SYing Zhang		$(call SPL_PAD_APPEND,$<,$(SPL_PAYLOAD),spl/u-boot-spl-pad.bin,$(CONFIG_SPL_PAD_TO))
496*3aa29de0SYing Zhang
497*3aa29de0SYing Zhang$(obj)tpl/u-boot-with-tpl.bin: $(obj)tpl/u-boot-tpl.bin $(obj)u-boot.bin
498*3aa29de0SYing Zhang		$(call SPL_PAD_APPEND,$<,u-boot.bin,tpl/u-boot-tpl-pad.bin,$(CONFIG_TPL_PAD_TO))
4997816f2cfSHeiko Schocher
500ba597609SBenoît Thébaudeau$(obj)u-boot-with-spl.imx: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
501ba597609SBenoît Thébaudeau		$(MAKE) -C $(SRCTREE)/arch/arm/imx-common \
502ba597609SBenoît Thébaudeau			$(OBJTREE)/u-boot-with-spl.imx
503ba597609SBenoît Thébaudeau
5047d5a5c79SBenoît Thébaudeau$(obj)u-boot-with-nand-spl.imx: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
5057d5a5c79SBenoît Thébaudeau		$(MAKE) -C $(SRCTREE)/arch/arm/imx-common \
5067d5a5c79SBenoît Thébaudeau			$(OBJTREE)/u-boot-with-nand-spl.imx
5077d5a5c79SBenoît Thébaudeau
5085364add4SScott Wood$(obj)u-boot.ubl:       $(obj)u-boot-with-spl.bin
509277f00f5SJosé Miguel Gonçalves		$(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \
5105364add4SScott Wood		-e $(CONFIG_SYS_TEXT_BASE) -d $< $(obj)u-boot.ubl
511277f00f5SJosé Miguel Gonçalves
5123f7f2414STom Rini$(obj)u-boot.ais:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.img
5136d660e77SSughosh Ganu		$(obj)tools/mkimage -s -n $(if $(CONFIG_AIS_CONFIG_FILE),$(CONFIG_AIS_CONFIG_FILE),"/dev/null") \
5146d660e77SSughosh Ganu			-T aisimage \
515d36d8859SChristian Riesch			-e $(CONFIG_SPL_TEXT_BASE) \
516d36d8859SChristian Riesch			-d $(obj)spl/u-boot-spl.bin \
517d36d8859SChristian Riesch			$(obj)spl/u-boot-spl.ais
518d36d8859SChristian Riesch		$(OBJCOPY) ${OBJCFLAGS} -I binary \
519d36d8859SChristian Riesch			--pad-to=$(CONFIG_SPL_MAX_SIZE) -O binary \
520d36d8859SChristian Riesch			$(obj)spl/u-boot-spl.ais $(obj)spl/u-boot-spl-pad.ais
5213f7f2414STom Rini		cat $(obj)spl/u-boot-spl-pad.ais $(obj)u-boot.img > \
522d36d8859SChristian Riesch			$(obj)u-boot.ais
523d36d8859SChristian Riesch
524a5453555SOtavio Salvador
52530b9b932SMarek Vasut$(obj)u-boot.sb:       $(obj)u-boot.bin $(obj)spl/u-boot-spl.bin
526714dc001SMarek Vasut		$(MAKE) -C $(SRCTREE)/$(CPUDIR)/$(SOC)/ $(OBJTREE)/u-boot.sb
52730b9b932SMarek Vasut
52894aebe6cSStefan Roese# On x600 (SPEAr600) U-Boot is appended to U-Boot SPL.
52994aebe6cSStefan Roese# Both images are created using mkimage (crc etc), so that the ROM
53094aebe6cSStefan Roese# bootloader can check its integrity. Padding needs to be done to the
53194aebe6cSStefan Roese# SPL image (with mkimage header) and not the binary. Otherwise the resulting image
53294aebe6cSStefan Roese# which is loaded/copied by the ROM bootloader to SRAM doesn't fit.
53394aebe6cSStefan Roese# The resulting image containing both U-Boot images is called u-boot.spr
53494aebe6cSStefan Roese$(obj)u-boot.spr:	$(obj)u-boot.img $(obj)spl/u-boot-spl.bin
53594aebe6cSStefan Roese		$(obj)tools/mkimage -A $(ARCH) -T firmware -C none \
53694aebe6cSStefan Roese		-a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n XLOADER \
53794aebe6cSStefan Roese		-d $(obj)spl/u-boot-spl.bin $(obj)spl/u-boot-spl.img
53894aebe6cSStefan Roese		tr "\000" "\377" < /dev/zero | dd ibs=1 count=$(CONFIG_SPL_PAD_TO) \
53994aebe6cSStefan Roese			of=$(obj)spl/u-boot-spl-pad.img 2>/dev/null
54094aebe6cSStefan Roese		dd if=$(obj)spl/u-boot-spl.img of=$(obj)spl/u-boot-spl-pad.img \
54194aebe6cSStefan Roese			conv=notrunc 2>/dev/null
54294aebe6cSStefan Roese		cat $(obj)spl/u-boot-spl-pad.img $(obj)u-boot.img > $@
54394aebe6cSStefan Roese
5446d6c0baeSTom Warrenifneq ($(CONFIG_TEGRA),)
5459972db5cSStephen Warren$(obj)u-boot-nodtb-tegra.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
546e4ec9346SStephen Warren		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SYS_TEXT_BASE) -O binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin
5479972db5cSStephen Warren		cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > $@
548e4ec9346SStephen Warren		rm $(obj)spl/u-boot-spl-pad.bin
5499972db5cSStephen Warren
5509972db5cSStephen Warrenifeq ($(CONFIG_OF_SEPARATE),y)
5519972db5cSStephen Warren$(obj)u-boot-dtb-tegra.bin: $(obj)u-boot-nodtb-tegra.bin $(obj)u-boot.dtb
5529972db5cSStephen Warren		cat $(obj)u-boot-nodtb-tegra.bin $(obj)u-boot.dtb > $@
5539972db5cSStephen Warrenendif
554984df4ecSAllen Martinendif
555984df4ecSAllen Martin
556fb3d2b8aSStefan Roese$(obj)u-boot-img.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.img
557fb3d2b8aSStefan Roese		cat $(obj)spl/u-boot-spl.bin $(obj)u-boot.img > $@
558fb3d2b8aSStefan Roese
559ecddccd0SStefan Roese# PPC4xx needs the SPL at the end of the image, since the reset vector
560ecddccd0SStefan Roese# is located at 0xfffffffc. So we can't use the "u-boot-img.bin" target
561ecddccd0SStefan Roese# and need to introduce a new build target with the full blown U-Boot
562ecddccd0SStefan Roese# at the start padded up to the start of the SPL image. And then concat
563ecddccd0SStefan Roese# the SPL image to the end.
564ecddccd0SStefan Roese$(obj)u-boot-img-spl-at-end.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.img
565ecddccd0SStefan Roese		tr "\000" "\377" < /dev/zero | dd ibs=1 count=$(CONFIG_UBOOT_PAD_TO) \
566ecddccd0SStefan Roese			of=$(obj)u-boot-pad.img 2>/dev/null
567ecddccd0SStefan Roese		dd if=$(obj)u-boot.img of=$(obj)u-boot-pad.img \
568ecddccd0SStefan Roese			conv=notrunc 2>/dev/null
569ecddccd0SStefan Roese		cat $(obj)u-boot-pad.img $(obj)spl/u-boot-spl.bin > $@
570ecddccd0SStefan Roese
57186eb49b3SSimon Glassifeq ($(CONFIG_SANDBOX),y)
57286eb49b3SSimon GlassGEN_UBOOT = \
57386eb49b3SSimon Glass		cd $(LNDIR) && $(CC) $(SYMS) -T $(obj)u-boot.lds \
57486eb49b3SSimon Glass			-Wl,--start-group $(__LIBS) -Wl,--end-group \
57586eb49b3SSimon Glass			$(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot.map -o u-boot
57686eb49b3SSimon Glasselse
577ecb1dc89SMike FrysingerGEN_UBOOT = \
57897b24d3dSMarek Vasut		cd $(LNDIR) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \
579ef123c52SAlbert ARIBAUD			$(__OBJS) \
580f9328639SMarian Balakowicz			--start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
581b2184c31Swdenk			-Map u-boot.map -o u-boot
58286eb49b3SSimon Glassendif
58386eb49b3SSimon Glass
58416a354f9SWolfgang Denk$(obj)u-boot:	depend \
585349e83f0SChe-liang Chiou		$(SUBDIR_TOOLS) $(OBJS) $(LIBBOARD) $(LIBS) $(LDSCRIPT) $(obj)u-boot.lds
586ecb1dc89SMike Frysinger		$(GEN_UBOOT)
587ecb1dc89SMike Frysingerifeq ($(CONFIG_KALLSYMS),y)
5888a156fb6SMike Frysinger		smap=`$(call SYSTEM_MAP,$(obj)u-boot) | \
5891aada9cdSWolfgang Denk			awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 "\\\\000"}'` ; \
5901aada9cdSWolfgang Denk		$(CC) $(CFLAGS) -DSYSTEM_MAP="\"$${smap}\"" \
5911aada9cdSWolfgang Denk			-c common/system_map.c -o $(obj)common/system_map.o
592ecb1dc89SMike Frysinger		$(GEN_UBOOT) $(obj)common/system_map.o
593ecb1dc89SMike Frysingerendif
5947ebf7443Swdenk
595d0d6144eSPeter Tyser$(OBJS):	depend
59603b7004dSPeter Tyser		$(MAKE) -C $(CPUDIR) $(if $(REMOTE_BUILD),$@,$(notdir $@))
597f9328639SMarian Balakowicz
598349e83f0SChe-liang Chiou$(LIBS):	depend $(SUBDIR_TOOLS)
599f9328639SMarian Balakowicz		$(MAKE) -C $(dir $(subst $(obj),,$@))
600a8c7c708Swdenk
601d0d6144eSPeter Tyser$(LIBBOARD):	depend $(LIBS)
602de109d90SWolfgang Denk		$(MAKE) -C $(dir $(subst $(obj),,$@))
603de109d90SWolfgang Denk
604d0d6144eSPeter Tyser$(SUBDIRS):	depend
605b028f715Swdenk		$(MAKE) -C $@ all
6067ebf7443Swdenk
607349e83f0SChe-liang Chiou$(SUBDIR_EXAMPLES): $(obj)u-boot
608349e83f0SChe-liang Chiou
609d0d6144eSPeter Tyser$(LDSCRIPT):	depend
610f65c9812SMike Frysinger		$(MAKE) -C $(dir $@) $(notdir $@)
611f65c9812SMike Frysinger
612ef123c52SAlbert ARIBAUD$(obj)u-boot.lds: $(LDSCRIPT)
61397b24d3dSMarek Vasut		$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$< >$@
6141aada9cdSWolfgang Denk
615e935a374SHaiying Wangnand_spl:	$(TIMESTAMP_FILE) $(VERSION_FILE) depend
6168318fbf8SMarian Balakowicz		$(MAKE) -C nand_spl/board/$(BOARDDIR) all
617887e2ec9SStefan Roese
618e935a374SHaiying Wang$(obj)u-boot-nand.bin:	nand_spl $(obj)u-boot.bin
6198318fbf8SMarian Balakowicz		cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin
620887e2ec9SStefan Roese
621bd25fdbaSAneesh V$(obj)spl/u-boot-spl.bin:	$(SUBDIR_TOOLS) depend
6225df2ee27SDaniel Schwierzeck		$(MAKE) -C spl all
6235df2ee27SDaniel Schwierzeck
624*3aa29de0SYing Zhang$(obj)tpl/u-boot-tpl.bin:	$(SUBDIR_TOOLS) depend
625*3aa29de0SYing Zhang		$(MAKE) -C spl all CONFIG_TPL_BUILD=y
626*3aa29de0SYing Zhang
627f9328639SMarian Balakowiczupdater:
6280358df42SMike Frysinger		$(MAKE) -C tools/updater all
6298f713fdfSdzu
6302a998793SDaniel Hobi# Explicitly make _depend in subdirs containing multiple targets to prevent
6312a998793SDaniel Hobi# parallel sub-makes creating .depend files simultaneously.
63216a354f9SWolfgang Denkdepend dep:	$(TIMESTAMP_FILE) $(VERSION_FILE) \
63339bc12ddSJoel Fernandes		$(obj)include/spl-autoconf.mk \
634*3aa29de0SYing Zhang		$(obj)include/tpl-autoconf.mk \
63516a354f9SWolfgang Denk		$(obj)include/autoconf.mk \
636a4814a69SStefano Babic		$(obj)include/generated/generic-asm-offsets.h \
637a4814a69SStefano Babic		$(obj)include/generated/asm-offsets.h
638ee60197eSSimon Glass		for dir in $(SUBDIRS) $(CPUDIR) $(LDSCRIPT_MAKEFILE_DIR) ; do \
6392a998793SDaniel Hobi			$(MAKE) -C $$dir _depend ; done
6407ebf7443Swdenk
641e5e4e705SLi YangTAG_SUBDIRS = $(SUBDIRS)
642e5e4e705SLi YangTAG_SUBDIRS += $(dir $(__LIBS))
643a340c325SJean-Christophe PLAGNIOL-VILLARDTAG_SUBDIRS += include
644a340c325SJean-Christophe PLAGNIOL-VILLARD
645857d9ea6SHorst KronstorferFIND := find
646857d9ea6SHorst KronstorferFINDFLAGS := -L
647857d9ea6SHorst Kronstorfer
6481064d980STom Rinicheckstack:
6491064d980STom Rini		$(CROSS_COMPILE)objdump -d $(obj)u-boot \
6501064d980STom Rini			`$(FIND) $(obj) -name u-boot-spl -print` | \
6511064d980STom Rini			perl $(src)tools/checkstack.pl $(ARCH)
6521064d980STom Rini
653f9328639SMarian Balakowicztags ctags:
654857d9ea6SHorst Kronstorfer		ctags -w -o $(obj)ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
655e5e4e705SLi Yang						-name '*.[chS]' -print`
6567ebf7443Swdenk
6577ebf7443Swdenketags:
658857d9ea6SHorst Kronstorfer		etags -a -o $(obj)etags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
659e5e4e705SLi Yang						-name '*.[chS]' -print`
660ffda586fSLi Yangcscope:
661857d9ea6SHorst Kronstorfer		$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) -name '*.[chS]' -print > \
662857d9ea6SHorst Kronstorfer						cscope.files
663ffda586fSLi Yang		cscope -b -q -k
6647ebf7443Swdenk
665ecb1dc89SMike FrysingerSYSTEM_MAP = \
666ecb1dc89SMike Frysinger		$(NM) $1 | \
6677ebf7443Swdenk		grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
668ecb1dc89SMike Frysinger		LC_ALL=C sort
669ecb1dc89SMike Frysinger$(obj)System.map:	$(obj)u-boot
670ecb1dc89SMike Frysinger		@$(call SYSTEM_MAP,$<) > $(obj)System.map
6717ebf7443Swdenk
67206a119a0STom Rinicheckthumb:
67306a119a0STom Rini	@if test $(call cc-version) -lt 0404; then \
67406a119a0STom Rini		echo -n '*** Your GCC does not produce working '; \
67506a119a0STom Rini		echo 'binaries in THUMB mode.'; \
67606a119a0STom Rini		echo '*** Your board is configured for THUMB mode.'; \
67706a119a0STom Rini		false; \
67806a119a0STom Rini	fi
6796ec63f41SScott Wood
6806ec63f41SScott Wood# GCC 3.x is reported to have problems generating the type of relocation
6816ec63f41SScott Wood# that U-Boot wants.
6826ec63f41SScott Wood# See http://lists.denx.de/pipermail/u-boot/2012-September/135156.html
6836ec63f41SScott Woodcheckgcc4:
6846ec63f41SScott Wood	@if test $(call cc-version) -lt 0400; then \
6856ec63f41SScott Wood		echo -n '*** Your GCC is too old, please upgrade to GCC 4.x or newer'; \
6866ec63f41SScott Wood		false; \
6876ec63f41SScott Wood	fi
6886ec63f41SScott Wood
689501ebdf2SStephen Warrencheckdtc:
690501ebdf2SStephen Warren	@if test $(call dtc-version) -lt 0104; then \
691501ebdf2SStephen Warren		echo '*** Your dtc is too old, please upgrade to dtc 1.4 or newer'; \
692501ebdf2SStephen Warren		false; \
693501ebdf2SStephen Warren	fi
694501ebdf2SStephen Warren
6952f155f6cSGrant Likely#
6962f155f6cSGrant Likely# Auto-generate the autoconf.mk file (which is included by all makefiles)
6972f155f6cSGrant Likely#
6982f155f6cSGrant Likely# This target actually generates 2 files; autoconf.mk and autoconf.mk.dep.
6992f155f6cSGrant Likely# the dep file is only include in this top level makefile to determine when
7002f155f6cSGrant Likely# to regenerate the autoconf.mk file.
7011510b82dSWolfgang Denk$(obj)include/autoconf.mk.dep: $(obj)include/config.h include/common.h
7021510b82dSWolfgang Denk	@$(XECHO) Generating $@ ; \
70316fe7775SMike Frysinger	set -e ; \
704ae6d1056SWolfgang Denk	: Generate the dependancies ; \
7054c34b2a0SMike Frysinger	$(CC) -x c -DDO_DEPS_ONLY -M $(CFLAGS) $(CPPFLAGS) \
7061510b82dSWolfgang Denk		-MQ $(obj)include/autoconf.mk include/common.h > $@
7071510b82dSWolfgang Denk
7081510b82dSWolfgang Denk$(obj)include/autoconf.mk: $(obj)include/config.h
7091510b82dSWolfgang Denk	@$(XECHO) Generating $@ ; \
7101510b82dSWolfgang Denk	set -e ; \
711ae6d1056SWolfgang Denk	: Extract the config macros ; \
7121510b82dSWolfgang Denk	$(CPP) $(CFLAGS) -DDO_DEPS_ONLY -dM include/common.h | \
7134a0f7538SWolfgang Denk		sed -n -f tools/scripts/define2mk.sed > $@.tmp && \
7144a0f7538SWolfgang Denk	mv $@.tmp $@
7152f155f6cSGrant Likely
71639bc12ddSJoel Fernandes# Auto-generate the spl-autoconf.mk file (which is included by all makefiles for SPL)
717*3aa29de0SYing Zhang$(obj)include/tpl-autoconf.mk: $(obj)include/config.h
718*3aa29de0SYing Zhang	@$(XECHO) Generating $@ ; \
719*3aa29de0SYing Zhang	set -e ; \
720*3aa29de0SYing Zhang	: Extract the config macros ; \
721*3aa29de0SYing Zhang	$(CPP) $(CFLAGS) -DCONFIG_TPL_BUILD  -DCONFIG_SPL_BUILD\
722*3aa29de0SYing Zhang			-DDO_DEPS_ONLY -dM include/common.h | \
723*3aa29de0SYing Zhang	sed -n -f tools/scripts/define2mk.sed > $@.tmp && \
724*3aa29de0SYing Zhang	mv $@.tmp $@
725*3aa29de0SYing Zhang
72639bc12ddSJoel Fernandes$(obj)include/spl-autoconf.mk: $(obj)include/config.h
72739bc12ddSJoel Fernandes	@$(XECHO) Generating $@ ; \
72839bc12ddSJoel Fernandes	set -e ; \
72939bc12ddSJoel Fernandes	: Extract the config macros ; \
73039bc12ddSJoel Fernandes	$(CPP) $(CFLAGS) -DCONFIG_SPL_BUILD -DDO_DEPS_ONLY -dM include/common.h | \
73139bc12ddSJoel Fernandes	sed -n -f tools/scripts/define2mk.sed > $@.tmp && \
73239bc12ddSJoel Fernandes	mv $@.tmp $@
73339bc12ddSJoel Fernandes
73416a354f9SWolfgang Denk$(obj)include/generated/generic-asm-offsets.h:	$(obj)include/autoconf.mk.dep \
73539bc12ddSJoel Fernandes	$(obj)include/spl-autoconf.mk \
736*3aa29de0SYing Zhang	$(obj)include/tpl-autoconf.mk \
73716a354f9SWolfgang Denk	$(obj)lib/asm-offsets.s
73816a354f9SWolfgang Denk	@$(XECHO) Generating $@
73916a354f9SWolfgang Denk	tools/scripts/make-asm-offsets $(obj)lib/asm-offsets.s $@
74016a354f9SWolfgang Denk
74116a354f9SWolfgang Denk$(obj)lib/asm-offsets.s:	$(obj)include/autoconf.mk.dep \
74239bc12ddSJoel Fernandes	$(obj)include/spl-autoconf.mk \
743*3aa29de0SYing Zhang	$(obj)include/tpl-autoconf.mk \
74416a354f9SWolfgang Denk	$(src)lib/asm-offsets.c
74516a354f9SWolfgang Denk	@mkdir -p $(obj)lib
74616a354f9SWolfgang Denk	$(CC) -DDO_DEPS_ONLY \
74716a354f9SWolfgang Denk		$(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
74816a354f9SWolfgang Denk		-o $@ $(src)lib/asm-offsets.c -c -S
74916a354f9SWolfgang Denk
750a4814a69SStefano Babic$(obj)include/generated/asm-offsets.h:	$(obj)include/autoconf.mk.dep \
75139bc12ddSJoel Fernandes	$(obj)include/spl-autoconf.mk \
752*3aa29de0SYing Zhang	$(obj)include/tpl-autoconf.mk \
753a4814a69SStefano Babic	$(obj)$(CPUDIR)/$(SOC)/asm-offsets.s
754b12734eeSWolfgang Denk	@$(XECHO) Generating $@
755a4814a69SStefano Babic	tools/scripts/make-asm-offsets $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s $@
756a4814a69SStefano Babic
75739bc12ddSJoel Fernandes$(obj)$(CPUDIR)/$(SOC)/asm-offsets.s:	$(obj)include/autoconf.mk.dep \
758*3aa29de0SYing Zhang	$(obj)include/spl-autoconf.mk \
759*3aa29de0SYing Zhang	$(obj)include/tpl-autoconf.mk
760a4814a69SStefano Babic	@mkdir -p $(obj)$(CPUDIR)/$(SOC)
761a4814a69SStefano Babic	if [ -f $(src)$(CPUDIR)/$(SOC)/asm-offsets.c ];then \
762a4814a69SStefano Babic		$(CC) -DDO_DEPS_ONLY \
763a4814a69SStefano Babic		$(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
764a4814a69SStefano Babic			-o $@ $(src)$(CPUDIR)/$(SOC)/asm-offsets.c -c -S; \
765a4814a69SStefano Babic	else \
766a4814a69SStefano Babic		touch $@; \
767a4814a69SStefano Babic	fi
768a4814a69SStefano Babic
7697ebf7443Swdenk#########################################################################
770ae6d1056SWolfgang Denkelse	# !config.mk
771f9328639SMarian Balakowiczall $(obj)u-boot.hex $(obj)u-boot.srec $(obj)u-boot.bin \
772f9328639SMarian Balakowicz$(obj)u-boot.img $(obj)u-boot.dis $(obj)u-boot \
773249b53a6SLoïc Minier$(filter-out tools,$(SUBDIRS)) \
7740358df42SMike Frysingerupdater depend dep tags ctags etags cscope $(obj)System.map:
7757ebf7443Swdenk	@echo "System not configured - see README" >&2
7767ebf7443Swdenk	@ exit 1
777c7c0d542SMike Frysinger
778249b53a6SLoïc Miniertools: $(VERSION_FILE) $(TIMESTAMP_FILE)
7790358df42SMike Frysinger	$(MAKE) -C $@ all
780ae6d1056SWolfgang Denkendif	# config.mk
7817ebf7443Swdenk
782c37980c3SAlbert ARIBAUD# ARM relocations should all be R_ARM_RELATIVE.
783c37980c3SAlbert ARIBAUDcheckarmreloc: $(obj)u-boot
784c37980c3SAlbert ARIBAUD	@if test "R_ARM_RELATIVE" != \
785c1273d71SAndreas Bießmann		"`$(CROSS_COMPILE)readelf -r $< | cut -d ' ' -f 4 | grep R_ARM | sort -u`"; \
786c37980c3SAlbert ARIBAUD		then echo "$< contains relocations other than \
787c37980c3SAlbert ARIBAUD		R_ARM_RELATIVE"; false; fi
788c37980c3SAlbert ARIBAUD
78928abd48fSIlya Yanok$(VERSION_FILE):
79014ce91b1SMike Frysinger		@mkdir -p $(dir $(VERSION_FILE))
79128abd48fSIlya Yanok		@( localvers='$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ; \
79228abd48fSIlya Yanok		   printf '#define PLAIN_VERSION "%s%s"\n' \
79328abd48fSIlya Yanok			"$(U_BOOT_VERSION)" "$${localvers}" ; \
79428abd48fSIlya Yanok		   printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' \
79528abd48fSIlya Yanok			"$(U_BOOT_VERSION)" "$${localvers}" ; \
79628abd48fSIlya Yanok		) > $@.tmp
79728abd48fSIlya Yanok		@( printf '#define CC_VERSION_STRING "%s"\n' \
79828abd48fSIlya Yanok		 '$(shell $(CC) --version | head -n 1)' )>>  $@.tmp
79928abd48fSIlya Yanok		@( printf '#define LD_VERSION_STRING "%s"\n' \
80028abd48fSIlya Yanok		 '$(shell $(LD) -v | head -n 1)' )>>  $@.tmp
80128abd48fSIlya Yanok		@cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
80228abd48fSIlya Yanok
803249b53a6SLoïc Minier$(TIMESTAMP_FILE):
804249b53a6SLoïc Minier		@mkdir -p $(dir $(TIMESTAMP_FILE))
805a76406fbSLoïc Minier		@LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > $@.tmp
806a76406fbSLoïc Minier		@LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> $@.tmp
807a76406fbSLoïc Minier		@cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
808249b53a6SLoïc Minier
8090358df42SMike Frysingereasylogo env gdb:
8100358df42SMike Frysinger	$(MAKE) -C tools/$@ all MTD_VERSION=${MTD_VERSION}
8110358df42SMike Frysingergdbtools: gdb
8120358df42SMike Frysinger
81330ff8918SMarek Vasutxmldocs pdfdocs psdocs htmldocs mandocs: tools/kernel-doc/docproc
81430ff8918SMarek Vasut	$(MAKE) U_BOOT_VERSION=$(U_BOOT_VERSION) -C doc/DocBook/ $@
81530ff8918SMarek Vasut
816249b53a6SLoïc Miniertools-all: easylogo env gdb $(VERSION_FILE) $(TIMESTAMP_FILE)
8170358df42SMike Frysinger	$(MAKE) -C tools HOST_TOOLS_ALL=y
8180358df42SMike Frysinger
8194e53a258SWolfgang Denk.PHONY : CHANGELOG
8204e53a258SWolfgang DenkCHANGELOG:
821b985b5d6SBen Warren	git log --no-merges U-Boot-1_1_5.. | \
822b985b5d6SBen Warren	unexpand -a | sed -e 's/\s\s*$$//' > $@
8234e53a258SWolfgang Denk
8240a823aa2SHarald Welteinclude/license.h: tools/bin2header COPYING
8250a823aa2SHarald Welte	cat COPYING | gzip -9 -c | ./tools/bin2header license_gzip > include/license.h
8267ebf7443Swdenk#########################################################################
8277ebf7443Swdenk
8287ebf7443Swdenkunconfig:
829887e2ec9SStefan Roese	@rm -f $(obj)include/config.h $(obj)include/config.mk \
8302f155f6cSGrant Likely		$(obj)board/*/config.tmp $(obj)board/*/*/config.tmp \
83139bc12ddSJoel Fernandes		$(obj)include/autoconf.mk $(obj)include/autoconf.mk.dep \
832*3aa29de0SYing Zhang		$(obj)include/spl-autoconf.mk \
833*3aa29de0SYing Zhang		$(obj)include/tpl-autoconf.mk
8347ebf7443Swdenk
835a6862bc1SWolfgang Denk%_config::	unconfig
836a6862bc1SWolfgang Denk	@$(MKCONFIG) -A $(@:_config=)
837a6862bc1SWolfgang Denk
838d6a5e6d5SLoïc Miniersinclude $(obj).boards.depend
839d6a5e6d5SLoïc Minier$(obj).boards.depend:	boards.cfg
84037d0e777SLauri Hintsala	@awk '(NF && $$1 !~ /^#/) { print $$1 ": " $$1 "_config; $$(MAKE)" }' $< > $@
8419f4a4206SMike Frysinger
8428c994630SWolfgang Denk#
8438c994630SWolfgang Denk# Functions to generate common board directory names
8448c994630SWolfgang Denk#
8458c994630SWolfgang Denklcname	= $(shell echo $(1) | sed -e 's/\(.*\)_config/\L\1/')
8468c994630SWolfgang Denkucname	= $(shell echo $(1) | sed -e 's/\(.*\)_config/\U\1/')
8478c994630SWolfgang Denk
848699f0512SWolfgang Denk#########################################################################
8493e38691eSwdenk#########################################################################
8507ebf7443Swdenk
8517ebf7443Swdenkclean:
8521bc15386SPeter Tyser	@rm -f $(obj)examples/standalone/82559_eeprom			  \
853d640ac58SWolfgang Denk	       $(obj)examples/standalone/atmel_df_pow2			  \
8541bc15386SPeter Tyser	       $(obj)examples/standalone/eepro100_eeprom		  \
8551bc15386SPeter Tyser	       $(obj)examples/standalone/hello_world			  \
8561bc15386SPeter Tyser	       $(obj)examples/standalone/interrupt			  \
8571bc15386SPeter Tyser	       $(obj)examples/standalone/mem_to_mem_idma2intr		  \
8581bc15386SPeter Tyser	       $(obj)examples/standalone/sched				  \
859201a017cSMike Frysinger	       $(obj)examples/standalone/smc911{11,x}_eeprom		  \
8601bc15386SPeter Tyser	       $(obj)examples/standalone/test_burst			  \
8611bc15386SPeter Tyser	       $(obj)examples/standalone/timer
862d4abc757SPeter Tyser	@rm -f $(obj)examples/api/demo{,.bin}
863f9301e1cSWolfgang Denk	@rm -f $(obj)tools/bmp_logo	   $(obj)tools/easylogo/easylogo  \
864f9301e1cSWolfgang Denk	       $(obj)tools/env/{fw_printenv,fw_setenv}			  \
865f9301e1cSWolfgang Denk	       $(obj)tools/envcrc					  \
866f9301e1cSWolfgang Denk	       $(obj)tools/gdb/{astest,gdbcont,gdbsend}			  \
867f9301e1cSWolfgang Denk	       $(obj)tools/gen_eth_addr    $(obj)tools/img2srec		  \
8687717fe10SHorst Kronstorfer	       $(obj)tools/mk{env,}image   $(obj)tools/mpc86x_clk	  \
86981e35203SChander Kashyap	       $(obj)tools/mk{smdk5250,}spl				  \
8708aa09026SMarek Vasut	       $(obj)tools/mxsboot					  \
87130ff8918SMarek Vasut	       $(obj)tools/ncb		   $(obj)tools/ubsha1		  \
8726c887b2aSSimon Glass	       $(obj)tools/kernel-doc/docproc				  \
8736c887b2aSSimon Glass	       $(obj)tools/proftool
874f9301e1cSWolfgang Denk	@rm -f $(obj)board/cray/L1/{bootscript.c,bootscript.image}	  \
87574c7a95fSWolfgang Denk	       $(obj)board/matrix_vision/*/bootscript.img		  \
876566e5cf4SWolfgang Denk	       $(obj)board/voiceblue/eeprom 				  \
8771aada9cdSWolfgang Denk	       $(obj)u-boot.lds						  \
878fb5166ceSMike Frysinger	       $(obj)arch/blackfin/cpu/bootrom-asm-offsets.[chs]	  \
879fb5166ceSMike Frysinger	       $(obj)arch/blackfin/cpu/init.{lds,elf}
880dc7746d8SWolfgang Denk	@rm -f $(obj)include/bmp_logo.h
881c270730fSChe-Liang Chiou	@rm -f $(obj)include/bmp_logo_data.h
88216a354f9SWolfgang Denk	@rm -f $(obj)lib/asm-offsets.s
883a4814a69SStefano Babic	@rm -f $(obj)include/generated/asm-offsets.h
884a4814a69SStefano Babic	@rm -f $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s
885d4abc757SPeter Tyser	@rm -f $(TIMESTAMP_FILE) $(VERSION_FILE)
886b3141fdbSAndreas Bießmann	@$(MAKE) -s -C doc/DocBook/ cleandocs
887ae6d1056SWolfgang Denk	@find $(OBJTREE) -type f \
8884a30f1e8STom Rini		\( -name 'core' -o -name '*.bak' -o -name '*~' -o -name '*.su' \
88971a988aaSTroy Kisky		-o -name '*.o'	-o -name '*.a' -o -name '*.exe' \
89071a988aaSTroy Kisky		-o -name '*.cfgtmp' \) -print \
8917ebf7443Swdenk		| xargs rm -f
8927ebf7443Swdenk
893734329f9SAndy Fleming# Removes everything not needed for testing u-boot
894734329f9SAndy Flemingtidy:	clean
895734329f9SAndy Fleming	@find $(OBJTREE) -type f \( -name '*.depend*' \) -print | xargs rm -f
896734329f9SAndy Fleming
897734329f9SAndy Flemingclobber:	tidy
898734329f9SAndy Fleming	@find $(OBJTREE) -type f \( -name '*.srec' \
899734329f9SAndy Fleming		-o -name '*.bin' -o -name u-boot.img \) \
900734329f9SAndy Fleming		-print0 | xargs -0 rm -f
901ffda586fSLi Yang	@rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS \
9025013c09fSWolfgang Denk		$(obj)cscope.* $(obj)*.*~
9034e0fbb98SDaniel Schwierzeck	@rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL-y)
904aa0c7a86SPrafulla Wadaskar	@rm -f $(obj)u-boot.kwb
9055d898a00SShaohui Xie	@rm -f $(obj)u-boot.pbl
906c5fb70c9SStefano Babic	@rm -f $(obj)u-boot.imx
907ba597609SBenoît Thébaudeau	@rm -f $(obj)u-boot-with-spl.imx
9087d5a5c79SBenoît Thébaudeau	@rm -f $(obj)u-boot-with-nand-spl.imx
9097816f2cfSHeiko Schocher	@rm -f $(obj)u-boot.ubl
910d36d8859SChristian Riesch	@rm -f $(obj)u-boot.ais
911bbb0b128SSimon Glass	@rm -f $(obj)u-boot.dtb
91230b9b932SMarek Vasut	@rm -f $(obj)u-boot.sb
913714dc001SMarek Vasut	@rm -f $(obj)u-boot.bd
91494aebe6cSStefan Roese	@rm -f $(obj)u-boot.spr
91597b24d3dSMarek Vasut	@rm -f $(obj)nand_spl/{u-boot.{lds,lst},System.map}
91697b24d3dSMarek Vasut	@rm -f $(obj)nand_spl/{u-boot-nand_spl.lds,u-boot-spl,u-boot-spl.map}
91797b24d3dSMarek Vasut	@rm -f $(obj)spl/{u-boot-spl,u-boot-spl.bin,u-boot-spl.map}
918ef123c52SAlbert ARIBAUD	@rm -f $(obj)spl/u-boot-spl.lds
919*3aa29de0SYing Zhang	@rm -f $(obj)tpl/{u-boot-tpl,u-boot-tpl.bin,u-boot-tpl.map}
920*3aa29de0SYing Zhang	@rm -f $(obj)tpl/u-boot-spl.lds
92194bcfe52SNishanth Menon	@rm -f $(obj)MLO MLO.byteswap
922a3cbc396SStefano Babic	@rm -f $(obj)SPL
9238b425b3fSDaniel Schwierzeck	@rm -f $(obj)tools/xway-swap-bytes
924a47a12beSStefan Roese	@rm -f $(obj)arch/powerpc/cpu/mpc824x/bedbug_603e.c
9252d14e36aSYork Sun	@rm -f $(obj)arch/powerpc/cpu/mpc83xx/ddr-gen?.c
926a9d8bc98SLoïc Minier	@rm -fr $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
92716a354f9SWolfgang Denk	@rm -fr $(obj)include/generated
928a958b663SJean-Christophe PLAGNIOL-VILLARD	@[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name "*" -type l -print | xargs rm -f
929bbb0b128SSimon Glass	@rm -f $(obj)dts/*.tmp
9306d660e77SSughosh Ganu	@rm -f $(obj)spl/u-boot-spl{,-pad}.ais
9317ebf7443Swdenk
9327ebf7443Swdenkmrproper \
9337ebf7443Swdenkdistclean:	clobber unconfig
934afd077bdSMike Frysingerifneq ($(OBJTREE),$(SRCTREE))
935ae6d1056SWolfgang Denk	rm -rf $(obj)*
936f9328639SMarian Balakowiczendif
9377ebf7443Swdenk
9387ebf7443Swdenkbackup:
9397ebf7443Swdenk	F=`basename $(TOPDIR)` ; cd .. ; \
940d6b93714SIlya Yanok	gtar --force-local -zcvf `LC_ALL=C date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F
9417ebf7443Swdenk
9427ebf7443Swdenk#########################################################################
943