xref: /openbmc/u-boot/Makefile (revision f6322eb7af6a0fafe44f30577c828e175e6c662e)
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
8d19ad726STom RiniVERSION = 2014
9d19ad726STom RiniPATCHLEVEL = 01
10211e4754SWolfgang DenkSUBLEVEL =
11b44bd2c7STom 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 Balakowiczifeq ("$(origin O)", "command line")
69f9328639SMarian BalakowiczBUILD_DIR := $(O)
70f9328639SMarian Balakowiczendif
717ebf7443Swdenk
724ab64933SKim Phillips# Call a source code checker (by default, "sparse") as part of the
734ab64933SKim Phillips# C compilation.
744ab64933SKim Phillips#
754ab64933SKim Phillips# Use 'make C=1' to enable checking of re-compiled files.
764ab64933SKim Phillips#
774ab64933SKim Phillips# See the linux kernel file "Documentation/sparse.txt" for more details,
784ab64933SKim Phillips# including where to get the "sparse" utility.
794ab64933SKim Phillips
804ab64933SKim Phillipsifdef C
814ab64933SKim Phillipsifeq ("$(origin C)", "command line")
824ab64933SKim PhillipsCHECKSRC := $(C)
834ab64933SKim Phillipsendif
844ab64933SKim Phillipsendif
854ab64933SKim Phillipsifndef CHECKSRC
864ab64933SKim Phillips  CHECKSRC = 0
874ab64933SKim Phillipsendif
884ab64933SKim Phillipsexport CHECKSRC
894ab64933SKim Phillips
90f9328639SMarian Balakowiczifneq ($(BUILD_DIR),)
91f9328639SMarian Balakowiczsaved-output := $(BUILD_DIR)
924f0645ebSMarian Balakowicz
934f0645ebSMarian Balakowicz# Attempt to create a output directory.
944f0645ebSMarian Balakowicz$(shell [ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR})
954f0645ebSMarian Balakowicz
964f0645ebSMarian Balakowicz# Verify if it was successful.
97f9328639SMarian BalakowiczBUILD_DIR := $(shell cd $(BUILD_DIR) && /bin/pwd)
98f9328639SMarian Balakowicz$(if $(BUILD_DIR),,$(error output directory "$(saved-output)" does not exist))
99f9328639SMarian Balakowiczendif # ifneq ($(BUILD_DIR),)
100f9328639SMarian Balakowicz
101f9328639SMarian BalakowiczOBJTREE		:= $(if $(BUILD_DIR),$(BUILD_DIR),$(CURDIR))
102c8f9c302SDaniel SchwierzeckSPLTREE		:= $(OBJTREE)/spl
1033aa29de0SYing ZhangTPLTREE		:= $(OBJTREE)/tpl
104f9328639SMarian BalakowiczSRCTREE		:= $(CURDIR)
105f9328639SMarian BalakowiczTOPDIR		:= $(SRCTREE)
106f9328639SMarian BalakowiczLNDIR		:= $(OBJTREE)
1073aa29de0SYing Zhangexport	TOPDIR SRCTREE OBJTREE SPLTREE TPLTREE
108f9328639SMarian Balakowicz
109f9328639SMarian BalakowiczMKCONFIG	:= $(SRCTREE)/mkconfig
110f9328639SMarian Balakowiczexport MKCONFIG
111f9328639SMarian Balakowicz
112f9328639SMarian Balakowicz# $(obj) and (src) are defined in config.mk but here in main Makefile
113f9328639SMarian Balakowicz# we also need them before config.mk is included which is the case for
114f9328639SMarian Balakowicz# some targets like unconfig, clean, clobber, distclean, etc.
115f9328639SMarian Balakowiczifneq ($(OBJTREE),$(SRCTREE))
116f9328639SMarian Balakowiczobj := $(OBJTREE)/
117f9328639SMarian Balakowiczsrc := $(SRCTREE)/
118f9328639SMarian Balakowiczelse
119f9328639SMarian Balakowiczobj :=
120f9328639SMarian Balakowiczsrc :=
121f9328639SMarian Balakowiczendif
122f9328639SMarian Balakowiczexport obj src
123f9328639SMarian Balakowicz
1245013c09fSWolfgang Denk# Make sure CDPATH settings don't interfere
1255013c09fSWolfgang Denkunexport CDPATH
1265013c09fSWolfgang Denk
127f9328639SMarian Balakowicz#########################################################################
128f9328639SMarian Balakowicz
129940db16dSMasahiro Yamadabuild := -f $(TOPDIR)/scripts/Makefile.build -C
130940db16dSMasahiro Yamada
1316d1ce387SMike Frysinger# The "tools" are needed early, so put this first
1326d1ce387SMike Frysinger# Don't include stuff already done in $(LIBS)
133349e83f0SChe-liang Chiou# The "examples" conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC
134349e83f0SChe-liang Chiou# is "yes"), so compile examples after U-Boot is compiled.
135349e83f0SChe-liang ChiouSUBDIR_TOOLS = tools
136349e83f0SChe-liang ChiouSUBDIRS = $(SUBDIR_TOOLS)
1376d1ce387SMike Frysinger
138249b53a6SLoïc Minier.PHONY : $(SUBDIRS) $(VERSION_FILE) $(TIMESTAMP_FILE)
1396d1ce387SMike Frysinger
140ae6d1056SWolfgang Denkifeq ($(obj)include/config.mk,$(wildcard $(obj)include/config.mk))
141f9328639SMarian Balakowicz
1422632c008SMike Frysinger# Include autoconf.mk before config.mk so that the config options are available
1432632c008SMike Frysinger# to all top level build files.  We need the dummy all: target to prevent the
1442632c008SMike Frysinger# dependency target in autoconf.mk.dep from being the default.
1452632c008SMike Frysingerall:
1462632c008SMike Frysingersinclude $(obj)include/autoconf.mk.dep
1472632c008SMike Frysingersinclude $(obj)include/autoconf.mk
1482632c008SMike Frysinger
1498a7e7d56SMasahiro YamadaSUBDIR_EXAMPLES-y := examples/standalone
1508a7e7d56SMasahiro YamadaSUBDIR_EXAMPLES-$(CONFIG_API) += examples/api
151b5728756SSimon Glassifndef CONFIG_SANDBOX
1528a7e7d56SMasahiro YamadaSUBDIRS += $(SUBDIR_EXAMPLES-y)
153b5728756SSimon Glassendif
154b5728756SSimon Glass
1557ebf7443Swdenk# load ARCH, BOARD, and CPU configuration
156ae6d1056SWolfgang Denkinclude $(obj)include/config.mk
1571d9f4105Swdenkexport	ARCH CPU BOARD VENDOR SOC
158f9328639SMarian Balakowicz
1591ea6bcd8SMike Frysinger# set default to nothing for native builds
160a5284efdSWolfgang Denkifeq ($(HOSTARCH),$(ARCH))
1611ea6bcd8SMike FrysingerCROSS_COMPILE ?=
1627ebf7443Swdenkendif
1637ebf7443Swdenk
164*f6322eb7SMasahiro Yamada# SHELL used by kbuild
165*f6322eb7SMasahiro YamadaCONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
166*f6322eb7SMasahiro Yamada	  else if [ -x /bin/bash ]; then echo /bin/bash; \
167*f6322eb7SMasahiro Yamada	  else echo sh; fi ; fi)
168*f6322eb7SMasahiro Yamada
169*f6322eb7SMasahiro YamadaHOSTCC       = gcc
170*f6322eb7SMasahiro YamadaHOSTCFLAGS   = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
171*f6322eb7SMasahiro Yamada
172*f6322eb7SMasahiro Yamadaifeq ($(HOSTOS),cygwin)
173*f6322eb7SMasahiro YamadaHOSTCFLAGS	+= -ansi
174*f6322eb7SMasahiro Yamadaendif
175*f6322eb7SMasahiro Yamada
176*f6322eb7SMasahiro Yamada# Mac OS X / Darwin's C preprocessor is Apple specific.  It
177*f6322eb7SMasahiro Yamada# generates numerous errors and warnings.  We want to bypass it
178*f6322eb7SMasahiro Yamada# and use GNU C's cpp.	To do this we pass the -traditional-cpp
179*f6322eb7SMasahiro Yamada# option to the compiler.  Note that the -traditional-cpp flag
180*f6322eb7SMasahiro Yamada# DOES NOT have the same semantics as GNU C's flag, all it does
181*f6322eb7SMasahiro Yamada# is invoke the GNU preprocessor in stock ANSI/ISO C fashion.
182*f6322eb7SMasahiro Yamada#
183*f6322eb7SMasahiro Yamada# Apple's linker is similar, thanks to the new 2 stage linking
184*f6322eb7SMasahiro Yamada# multiple symbol definitions are treated as errors, hence the
185*f6322eb7SMasahiro Yamada# -multiply_defined suppress option to turn off this error.
186*f6322eb7SMasahiro Yamada#
187*f6322eb7SMasahiro Yamadaifeq ($(HOSTOS),darwin)
188*f6322eb7SMasahiro Yamada# get major and minor product version (e.g. '10' and '6' for Snow Leopard)
189*f6322eb7SMasahiro YamadaDARWIN_MAJOR_VERSION	= $(shell sw_vers -productVersion | cut -f 1 -d '.')
190*f6322eb7SMasahiro YamadaDARWIN_MINOR_VERSION	= $(shell sw_vers -productVersion | cut -f 2 -d '.')
191*f6322eb7SMasahiro Yamada
192*f6322eb7SMasahiro Yamadaos_x_before	= $(shell if [ $(DARWIN_MAJOR_VERSION) -le $(1) -a \
193*f6322eb7SMasahiro Yamada	$(DARWIN_MINOR_VERSION) -le $(2) ] ; then echo "$(3)"; else echo "$(4)"; fi ;)
194*f6322eb7SMasahiro Yamada
195*f6322eb7SMasahiro Yamada# Snow Leopards build environment has no longer restrictions as described above
196*f6322eb7SMasahiro YamadaHOSTCC       = $(call os_x_before, 10, 5, "cc", "gcc")
197*f6322eb7SMasahiro YamadaHOSTCFLAGS  += $(call os_x_before, 10, 4, "-traditional-cpp")
198*f6322eb7SMasahiro YamadaHOSTLDFLAGS += $(call os_x_before, 10, 5, "-multiply_defined suppress")
199*f6322eb7SMasahiro Yamadaendif
200*f6322eb7SMasahiro Yamada
201*f6322eb7SMasahiro Yamada# Make variables (CC, etc...)
202*f6322eb7SMasahiro Yamada
203*f6322eb7SMasahiro YamadaAS		= $(CROSS_COMPILE)as
204*f6322eb7SMasahiro Yamada# Always use GNU ld
205*f6322eb7SMasahiro Yamadaifneq ($(shell $(CROSS_COMPILE)ld.bfd -v 2> /dev/null),)
206*f6322eb7SMasahiro YamadaLD		= $(CROSS_COMPILE)ld.bfd
207*f6322eb7SMasahiro Yamadaelse
208*f6322eb7SMasahiro YamadaLD		= $(CROSS_COMPILE)ld
209*f6322eb7SMasahiro Yamadaendif
210*f6322eb7SMasahiro YamadaCC		= $(CROSS_COMPILE)gcc
211*f6322eb7SMasahiro YamadaCPP		= $(CC) -E
212*f6322eb7SMasahiro YamadaAR		= $(CROSS_COMPILE)ar
213*f6322eb7SMasahiro YamadaNM		= $(CROSS_COMPILE)nm
214*f6322eb7SMasahiro YamadaLDR		= $(CROSS_COMPILE)ldr
215*f6322eb7SMasahiro YamadaSTRIP		= $(CROSS_COMPILE)strip
216*f6322eb7SMasahiro YamadaOBJCOPY		= $(CROSS_COMPILE)objcopy
217*f6322eb7SMasahiro YamadaOBJDUMP		= $(CROSS_COMPILE)objdump
218*f6322eb7SMasahiro YamadaAWK		= awk
219*f6322eb7SMasahiro YamadaRANLIB		= $(CROSS_COMPILE)RANLIB
220*f6322eb7SMasahiro YamadaDTC		= dtc
221*f6322eb7SMasahiro YamadaCHECK		= sparse
222*f6322eb7SMasahiro Yamada
223*f6322eb7SMasahiro YamadaCHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
224*f6322eb7SMasahiro Yamada		  -Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF)
225*f6322eb7SMasahiro Yamada
226*f6322eb7SMasahiro Yamadaexport CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC
227*f6322eb7SMasahiro Yamadaexport CPP AR NM LDR STRIP OBJCOPY OBJDUMP
228*f6322eb7SMasahiro Yamadaexport MAKE AWK
229*f6322eb7SMasahiro Yamadaexport DTC CHECK CHECKFLAGS
230*f6322eb7SMasahiro Yamada
23192b197f0SWolfgang Denk# load other configuration
23292b197f0SWolfgang Denkinclude $(TOPDIR)/config.mk
23392b197f0SWolfgang Denk
234fada9e20SSimon Glass# Targets which don't build the source code
235ace8f506SBo ShenNON_BUILD_TARGETS = backup clean clobber distclean mrproper tidy unconfig
236fada9e20SSimon Glass
237fada9e20SSimon Glass# Only do the generic board check when actually building, not configuring
238fada9e20SSimon Glassifeq ($(filter $(NON_BUILD_TARGETS),$(MAKECMDGOALS)),)
239fada9e20SSimon Glassifeq ($(findstring _config,$(MAKECMDGOALS)),)
240fada9e20SSimon Glass$(CHECK_GENERIC_BOARD)
241fada9e20SSimon Glassendif
242fada9e20SSimon Glassendif
243fada9e20SSimon Glass
244d51dfff7SIlya Yanok# If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use
245d51dfff7SIlya Yanok# that (or fail if absent).  Otherwise, search for a linker script in a
246d51dfff7SIlya Yanok# standard location.
247d51dfff7SIlya Yanok
248ee60197eSSimon GlassLDSCRIPT_MAKEFILE_DIR = $(dir $(LDSCRIPT))
249ee60197eSSimon Glass
250d51dfff7SIlya Yanokifndef LDSCRIPT
251d51dfff7SIlya Yanok	#LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug
252d51dfff7SIlya Yanok	ifdef CONFIG_SYS_LDSCRIPT
253d51dfff7SIlya Yanok		# need to strip off double quotes
254a8c07541SMasahiro Yamada		LDSCRIPT := $(CONFIG_SYS_LDSCRIPT:"%"=%)
255d51dfff7SIlya Yanok	endif
256d51dfff7SIlya Yanokendif
257d51dfff7SIlya Yanok
258ee60197eSSimon Glass# If there is no specified link script, we look in a number of places for it
259d51dfff7SIlya Yanokifndef LDSCRIPT
260d51dfff7SIlya Yanok	ifeq ($(CONFIG_NAND_U_BOOT),y)
261d51dfff7SIlya Yanok		LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds
262d51dfff7SIlya Yanok		ifeq ($(wildcard $(LDSCRIPT)),)
263d51dfff7SIlya Yanok			LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds
264d51dfff7SIlya Yanok		endif
265d51dfff7SIlya Yanok	endif
266d51dfff7SIlya Yanok	ifeq ($(wildcard $(LDSCRIPT)),)
267d51dfff7SIlya Yanok		LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
268d51dfff7SIlya Yanok	endif
269d51dfff7SIlya Yanok	ifeq ($(wildcard $(LDSCRIPT)),)
270d51dfff7SIlya Yanok		LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot.lds
271d51dfff7SIlya Yanok	endif
272d51dfff7SIlya Yanok	ifeq ($(wildcard $(LDSCRIPT)),)
273ee60197eSSimon Glass		LDSCRIPT := $(TOPDIR)/arch/$(ARCH)/cpu/u-boot.lds
274ee60197eSSimon Glass		# We don't expect a Makefile here
275ee60197eSSimon Glass		LDSCRIPT_MAKEFILE_DIR =
276ee60197eSSimon Glass	endif
277ee60197eSSimon Glass	ifeq ($(wildcard $(LDSCRIPT)),)
278d51dfff7SIlya Yanok$(error could not find linker script)
279d51dfff7SIlya Yanok	endif
280d51dfff7SIlya Yanokendif
281d51dfff7SIlya Yanok
2827ebf7443Swdenk#########################################################################
2837ebf7443Swdenk# U-Boot objects....order is important (i.e. start must be first)
2847ebf7443Swdenk
285e8a8b824SMasahiro Yamadahead-y := $(CPUDIR)/start.o
286e8a8b824SMasahiro Yamadahead-$(CONFIG_4xx) += arch/powerpc/cpu/ppc4xx/resetvec.o
287e8a8b824SMasahiro Yamadahead-$(CONFIG_MPC85xx) += arch/powerpc/cpu/mpc85xx/resetvec.o
2887ebf7443Swdenk
289e8a8b824SMasahiro YamadaOBJS := $(addprefix $(obj),$(head-y))
290f9328639SMarian Balakowicz
2918b5a0264SDaniel SchwierzeckHAVE_VENDOR_COMMON_LIB = $(if $(wildcard board/$(VENDOR)/common/Makefile),y,n)
2928b5a0264SDaniel Schwierzeck
293e2906a59SMasahiro YamadaLIBS-y += lib/
294e2906a59SMasahiro YamadaLIBS-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/
295e2906a59SMasahiro YamadaLIBS-y += $(CPUDIR)/
2961d9f4105Swdenkifdef SOC
297e2906a59SMasahiro YamadaLIBS-y += $(CPUDIR)/$(SOC)/
2981d9f4105Swdenkendif
299e2906a59SMasahiro YamadaLIBS-$(CONFIG_IXP4XX_NPE) += drivers/net/npe/
300e2906a59SMasahiro YamadaLIBS-$(CONFIG_OF_EMBED) += dts/
301e2906a59SMasahiro YamadaLIBS-y += arch/$(ARCH)/lib/
30257c3e5fcSMasahiro YamadaLIBS-y += fs/
303e2906a59SMasahiro YamadaLIBS-y += net/
304e2906a59SMasahiro YamadaLIBS-y += disk/
305e2906a59SMasahiro YamadaLIBS-y += drivers/
306e2906a59SMasahiro YamadaLIBS-y += drivers/dma/
307e2906a59SMasahiro YamadaLIBS-y += drivers/gpio/
308e2906a59SMasahiro YamadaLIBS-y += drivers/i2c/
309e2906a59SMasahiro YamadaLIBS-y += drivers/input/
310e2906a59SMasahiro YamadaLIBS-y += drivers/mmc/
311e2906a59SMasahiro YamadaLIBS-y += drivers/mtd/
312392ba525SMasahiro YamadaLIBS-$(CONFIG_CMD_NAND) += drivers/mtd/nand/
313e2906a59SMasahiro YamadaLIBS-y += drivers/mtd/onenand/
314392ba525SMasahiro YamadaLIBS-$(CONFIG_CMD_UBI) += drivers/mtd/ubi/
315e2906a59SMasahiro YamadaLIBS-y += drivers/mtd/spi/
316e2906a59SMasahiro YamadaLIBS-y += drivers/net/
317e2906a59SMasahiro YamadaLIBS-y += drivers/net/phy/
318e2906a59SMasahiro YamadaLIBS-y += drivers/pci/
319e2906a59SMasahiro YamadaLIBS-y += drivers/power/ \
320e2906a59SMasahiro Yamada	drivers/power/fuel_gauge/ \
321e2906a59SMasahiro Yamada	drivers/power/mfd/ \
322e2906a59SMasahiro Yamada	drivers/power/pmic/ \
323e2906a59SMasahiro Yamada	drivers/power/battery/
324e2906a59SMasahiro YamadaLIBS-y += drivers/spi/
325e2906a59SMasahiro YamadaLIBS-$(CONFIG_FMAN_ENET) += drivers/net/fm/
3265614e71bSYork SunLIBS-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/
327e2906a59SMasahiro YamadaLIBS-y += drivers/serial/
328e2906a59SMasahiro YamadaLIBS-y += drivers/usb/eth/
329e2906a59SMasahiro YamadaLIBS-y += drivers/usb/gadget/
330e2906a59SMasahiro YamadaLIBS-y += drivers/usb/host/
331e2906a59SMasahiro YamadaLIBS-y += drivers/usb/musb/
332e2906a59SMasahiro YamadaLIBS-y += drivers/usb/musb-new/
333e2906a59SMasahiro YamadaLIBS-y += drivers/usb/phy/
334e2906a59SMasahiro YamadaLIBS-y += drivers/usb/ulpi/
335e2906a59SMasahiro YamadaLIBS-y += common/
336e2906a59SMasahiro YamadaLIBS-y += lib/libfdt/
3378a7e7d56SMasahiro YamadaLIBS-$(CONFIG_API) += api/
338755e08f0SMasahiro YamadaLIBS-$(CONFIG_HAS_POST) += post/
339e2906a59SMasahiro YamadaLIBS-y += test/
340f9328639SMarian Balakowicz
34124e8bee5SAlison Wangifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35 mxs vf610))
342e2906a59SMasahiro YamadaLIBS-y += arch/$(ARCH)/imx-common/
34318936ee2SJason Liuendif
34418936ee2SJason Liu
345e2906a59SMasahiro YamadaLIBS-$(CONFIG_ARM) += arch/arm/cpu/
346e2906a59SMasahiro YamadaLIBS-$(CONFIG_PPC) += arch/powerpc/cpu/
347852bd07cSMinkyu Kang
348e2906a59SMasahiro YamadaLIBS-y += board/$(BOARDDIR)/
34908e39a84SMasahiro Yamada
350e2906a59SMasahiro YamadaLIBS-y := $(patsubst %/, %/built-in.o, $(LIBS-y))
351f52d7b35SDaniel SchwierzeckLIBS := $(addprefix $(obj),$(sort $(LIBS-y)))
352249b53a6SLoïc Minier.PHONY : $(LIBS)
353a8c7c708Swdenk
3544f7cb08eSwdenk# Add GCC lib
35552b1bf2cSWolfgang Denkifdef USE_PRIVATE_LIBGCC
35652b1bf2cSWolfgang Denkifeq ("$(USE_PRIVATE_LIBGCC)", "yes")
357635d1b3eSMatthias WeisserPLATFORM_LIBGCC = $(OBJTREE)/arch/$(ARCH)/lib/libgcc.o
35852b1bf2cSWolfgang Denkelse
35952b1bf2cSWolfgang DenkPLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc
36052b1bf2cSWolfgang Denkendif
36152b1bf2cSWolfgang Denkelse
362cca4e4aeSWolfgang DenkPLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
36352b1bf2cSWolfgang Denkendif
36452b1bf2cSWolfgang DenkPLATFORM_LIBS += $(PLATFORM_LIBGCC)
36552b1bf2cSWolfgang Denkexport PLATFORM_LIBS
3663d3befa7Swdenk
3676ac9f479SMike Frysinger# Special flags for CPP when processing the linker script.
3686ac9f479SMike Frysinger# Pass the version down so we can handle backwards compatibility
3696ac9f479SMike Frysinger# on the fly.
3706ac9f479SMike FrysingerLDPPFLAGS += \
3716ac9f479SMike Frysinger	-include $(TOPDIR)/include/u-boot/u-boot.lds.h \
3727e6403a6SSimon Glass	-DCPUDIR=$(CPUDIR) \
3736ac9f479SMike Frysinger	$(shell $(LD) --version | \
3746ac9f479SMike Frysinger	  sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p')
3756ac9f479SMike Frysinger
376f9328639SMarian Balakowicz__OBJS := $(subst $(obj),,$(OBJS))
37708e39a84SMasahiro Yamada__LIBS := $(subst $(obj),,$(LIBS))
378f9328639SMarian Balakowicz
3797ebf7443Swdenk#########################################################################
380bdccc4feSwdenk#########################################################################
3817ebf7443Swdenk
382f3a14d37SMike Frysingerifneq ($(CONFIG_BOARD_SIZE_LIMIT),)
383f3a14d37SMike FrysingerBOARD_SIZE_CHECK = \
384f3a14d37SMike Frysinger	@actual=`wc -c $@ | awk '{print $$1}'`; \
385d060e6f4SJoe Hershberger	limit=`printf "%d" $(CONFIG_BOARD_SIZE_LIMIT)`; \
386f3a14d37SMike Frysinger	if test $$actual -gt $$limit; then \
387d060e6f4SJoe Hershberger		echo "$@ exceeds file size limit:" >&2 ; \
388d060e6f4SJoe Hershberger		echo "  limit:  $$limit bytes" >&2 ; \
389d060e6f4SJoe Hershberger		echo "  actual: $$actual bytes" >&2 ; \
390d060e6f4SJoe Hershberger		echo "  excess: $$((actual - limit)) bytes" >&2; \
391f3a14d37SMike Frysinger		exit 1; \
392f3a14d37SMike Frysinger	fi
393f3a14d37SMike Frysingerelse
394f3a14d37SMike FrysingerBOARD_SIZE_CHECK =
395f3a14d37SMike Frysingerendif
396f3a14d37SMike Frysinger
3978137af19SScott Wood# Statically apply RELA-style relocations (currently arm64 only)
3988137af19SScott Woodifneq ($(CONFIG_STATIC_RELA),)
3998137af19SScott Wood# $(1) is u-boot ELF, $(2) is u-boot bin, $(3) is text base
4008137af19SScott WoodDO_STATIC_RELA = \
4018137af19SScott Wood	start=$$($(NM) $(1) | grep __rel_dyn_start | cut -f 1 -d ' '); \
4028137af19SScott Wood	end=$$($(NM) $(1) | grep __rel_dyn_end | cut -f 1 -d ' '); \
4038137af19SScott Wood	$(obj)tools/relocate-rela $(2) $(3) $$start $$end
4048137af19SScott Woodelse
4058137af19SScott WoodDO_STATIC_RELA =
4068137af19SScott Woodendif
4078137af19SScott Wood
4083e88337bSMike Frysinger# Always append ALL so that arch config.mk's can add custom ones
4094e0fbb98SDaniel SchwierzeckALL-y += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map
410e935a374SHaiying Wang
4114e0fbb98SDaniel SchwierzeckALL-$(CONFIG_NAND_U_BOOT) += $(obj)u-boot-nand.bin
4124e0fbb98SDaniel SchwierzeckALL-$(CONFIG_ONENAND_U_BOOT) += $(obj)u-boot-onenand.bin
413262737f0SShaohui XieALL-$(CONFIG_RAMBOOT_PBL) += $(obj)u-boot.pbl
4145df2ee27SDaniel SchwierzeckALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin
4154c267374SHenrik NordströmALL-$(CONFIG_SPL_FRAMEWORK) += $(obj)u-boot.img
4163aa29de0SYing ZhangALL-$(CONFIG_TPL) += $(obj)tpl/u-boot-tpl.bin
4172c0f79e4SSimon GlassALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot-dtb.bin
418b343bbb5SVadim Bendeburyifneq ($(CONFIG_SPL_TARGET),)
419a8c07541SMasahiro YamadaALL-$(CONFIG_SPL) += $(obj)$(CONFIG_SPL_TARGET:"%"=%)
420b343bbb5SVadim Bendeburyendif
421f4dc714aSScott WoodALL-$(CONFIG_REMAKE_ELF) += $(obj)u-boot.elf
4227ebf7443Swdenk
42312b7b70cSAllen Martin# enable combined SPL/u-boot/dtb rules for tegra
4246d6c0baeSTom Warrenifneq ($(CONFIG_TEGRA),)
4257dcd3a21SVidya Sagarifeq ($(CONFIG_SPL),y)
42612b7b70cSAllen Martinifeq ($(CONFIG_OF_SEPARATE),y)
42712b7b70cSAllen MartinALL-y += $(obj)u-boot-dtb-tegra.bin
42812b7b70cSAllen Martinelse
42912b7b70cSAllen MartinALL-y += $(obj)u-boot-nodtb-tegra.bin
43012b7b70cSAllen Martinendif
43112b7b70cSAllen Martinendif
4327dcd3a21SVidya Sagarendif
43312b7b70cSAllen Martin
4348a7e7d56SMasahiro Yamadaall:		$(ALL-y) $(SUBDIR_EXAMPLES-y)
4357ebf7443Swdenk
436501ebdf2SStephen Warren$(obj)u-boot.dtb:	checkdtc $(obj)u-boot
437bcfe8fdfSMasahiro Yamada		$(MAKE) $(build) dts binary
4382c0f79e4SSimon Glass		mv $(obj)dts/dt.dtb $@
4392c0f79e4SSimon Glass
4402c0f79e4SSimon Glass$(obj)u-boot-dtb.bin:	$(obj)u-boot.bin $(obj)u-boot.dtb
4412c0f79e4SSimon Glass		cat $^ >$@
4422c0f79e4SSimon Glass
443f9328639SMarian Balakowicz$(obj)u-boot.hex:	$(obj)u-boot
4446310eb9dSwdenk		$(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
4456310eb9dSwdenk
446f9328639SMarian Balakowicz$(obj)u-boot.srec:	$(obj)u-boot
44747ed5dd0SAlbert ARIBAUD		$(OBJCOPY) ${OBJCFLAGS} -O srec $< $@
4487ebf7443Swdenk
449f9328639SMarian Balakowicz$(obj)u-boot.bin:	$(obj)u-boot
4507ebf7443Swdenk		$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
4518137af19SScott Wood		$(call DO_STATIC_RELA,$<,$@,$(CONFIG_SYS_TEXT_BASE))
452f3a14d37SMike Frysinger		$(BOARD_SIZE_CHECK)
4537ebf7443Swdenk
45494a91e24SMike Frysinger$(obj)u-boot.ldr:	$(obj)u-boot
45576d82187SMike Frysinger		$(CREATE_LDR_ENV)
45668e56324SMike Frysinger		$(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS)
457f3a14d37SMike Frysinger		$(BOARD_SIZE_CHECK)
45894a91e24SMike Frysinger
45994a91e24SMike Frysinger$(obj)u-boot.ldr.hex:	$(obj)u-boot.ldr
46094a91e24SMike Frysinger		$(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@ -I binary
46194a91e24SMike Frysinger
46294a91e24SMike Frysinger$(obj)u-boot.ldr.srec:	$(obj)u-boot.ldr
46394a91e24SMike Frysinger		$(OBJCOPY) ${OBJCFLAGS} -O srec $< $@ -I binary
46494a91e24SMike Frysinger
465b40bda6bSStefan Roese#
466b40bda6bSStefan Roese# U-Boot entry point, needed for booting of full-blown U-Boot
467b40bda6bSStefan Roese# from the SPL U-Boot version.
468b40bda6bSStefan Roese#
469b40bda6bSStefan Roeseifndef CONFIG_SYS_UBOOT_START
470b40bda6bSStefan RoeseCONFIG_SYS_UBOOT_START := 0
471b40bda6bSStefan Roeseendif
472b40bda6bSStefan Roese
473f9328639SMarian Balakowicz$(obj)u-boot.img:	$(obj)u-boot.bin
474a2a0a717SWolfgang Denk		$(obj)tools/mkimage -A $(ARCH) -T firmware -C none \
475b40bda6bSStefan Roese		-O u-boot -a $(CONFIG_SYS_TEXT_BASE) \
476b40bda6bSStefan Roese		-e $(CONFIG_SYS_UBOOT_START) \
477881a87ecSWolfgang Denk		-n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
478bdccc4feSwdenk			sed -e 's/"[	 ]*$$/ for $(BOARD) board"/') \
479bdccc4feSwdenk		-d $< $@
480bdccc4feSwdenk
481291b3dcdSOtavio Salvador$(obj)u-boot.imx: $(obj)u-boot.bin depend
48271f84ef0SMasahiro Yamada		$(MAKE) $(build) $(SRCTREE)/arch/arm/imx-common $(OBJTREE)/u-boot.imx
4838edcde5eSStefano Babic
484aa0c7a86SPrafulla Wadaskar$(obj)u-boot.kwb:       $(obj)u-boot.bin
48531d80c77SPrafulla Wadaskar		$(obj)tools/mkimage -n $(CONFIG_SYS_KWD_CONFIG) -T kwbimage \
4862ea88b06SEric Cooper		-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) -d $< $@
487aa0c7a86SPrafulla Wadaskar
4885d898a00SShaohui Xie$(obj)u-boot.pbl:	$(obj)u-boot.bin
489690e4258SPrabhakar Kushwaha		$(obj)tools/mkimage -n $(CONFIG_SYS_FSL_PBL_RCW) \
490690e4258SPrabhakar Kushwaha		-R $(CONFIG_SYS_FSL_PBL_PBI) -T pblimage \
4915d898a00SShaohui Xie		-d $< $@
4925d898a00SShaohui Xie
493566a494fSHeiko Schocher$(obj)u-boot.sha1:	$(obj)u-boot.bin
49401159530SHeiko Schocher		$(obj)tools/ubsha1 $(obj)u-boot.bin
495566a494fSHeiko Schocher
496f9328639SMarian Balakowicz$(obj)u-boot.dis:	$(obj)u-boot
4977ebf7443Swdenk		$(OBJDUMP) -d $< > $@
4987ebf7443Swdenk
4993aa29de0SYing Zhang# $@ is output, $(1) and $(2) are inputs, $(3) is padded intermediate,
5003aa29de0SYing Zhang# $(4) is pad-to
5013aa29de0SYing ZhangSPL_PAD_APPEND = \
5023aa29de0SYing Zhang		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(4) -I binary -O binary \
5033aa29de0SYing Zhang		$(1) $(obj)$(3); \
504b6df9b01SYork Sun		cat $(obj)$(3) $(2) > $@; \
5053aa29de0SYing Zhang		rm $(obj)$(3)
50674752baaSScott Wood
5073aa29de0SYing Zhangifdef CONFIG_TPL
5083aa29de0SYing ZhangSPL_PAYLOAD := $(obj)tpl/u-boot-with-tpl.bin
5093aa29de0SYing Zhangelse
5103aa29de0SYing ZhangSPL_PAYLOAD := $(obj)u-boot.bin
5113aa29de0SYing Zhangendif
51274752baaSScott Wood
5133aa29de0SYing Zhang$(obj)u-boot-with-spl.bin: $(obj)spl/u-boot-spl.bin $(SPL_PAYLOAD)
5143aa29de0SYing Zhang		$(call SPL_PAD_APPEND,$<,$(SPL_PAYLOAD),spl/u-boot-spl-pad.bin,$(CONFIG_SPL_PAD_TO))
5153aa29de0SYing Zhang
5163aa29de0SYing Zhang$(obj)tpl/u-boot-with-tpl.bin: $(obj)tpl/u-boot-tpl.bin $(obj)u-boot.bin
517b6df9b01SYork Sun		$(call SPL_PAD_APPEND,$<,$(obj)u-boot.bin,tpl/u-boot-tpl-pad.bin,$(CONFIG_TPL_PAD_TO))
5187816f2cfSHeiko Schocher
519ba597609SBenoît Thébaudeau$(obj)u-boot-with-spl.imx: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
52071f84ef0SMasahiro Yamada		$(MAKE) $(build) $(SRCTREE)/arch/arm/imx-common \
521ba597609SBenoît Thébaudeau			$(OBJTREE)/u-boot-with-spl.imx
522ba597609SBenoît Thébaudeau
5237d5a5c79SBenoît Thébaudeau$(obj)u-boot-with-nand-spl.imx: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
52471f84ef0SMasahiro Yamada		$(MAKE) $(build) $(SRCTREE)/arch/arm/imx-common \
5257d5a5c79SBenoît Thébaudeau			$(OBJTREE)/u-boot-with-nand-spl.imx
5267d5a5c79SBenoît Thébaudeau
5275364add4SScott Wood$(obj)u-boot.ubl:       $(obj)u-boot-with-spl.bin
528277f00f5SJosé Miguel Gonçalves		$(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \
5295364add4SScott Wood		-e $(CONFIG_SYS_TEXT_BASE) -d $< $(obj)u-boot.ubl
530277f00f5SJosé Miguel Gonçalves
5313f7f2414STom Rini$(obj)u-boot.ais:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.img
5326d660e77SSughosh Ganu		$(obj)tools/mkimage -s -n $(if $(CONFIG_AIS_CONFIG_FILE),$(CONFIG_AIS_CONFIG_FILE),"/dev/null") \
5336d660e77SSughosh Ganu			-T aisimage \
534d36d8859SChristian Riesch			-e $(CONFIG_SPL_TEXT_BASE) \
535d36d8859SChristian Riesch			-d $(obj)spl/u-boot-spl.bin \
536d36d8859SChristian Riesch			$(obj)spl/u-boot-spl.ais
537d36d8859SChristian Riesch		$(OBJCOPY) ${OBJCFLAGS} -I binary \
538d36d8859SChristian Riesch			--pad-to=$(CONFIG_SPL_MAX_SIZE) -O binary \
539d36d8859SChristian Riesch			$(obj)spl/u-boot-spl.ais $(obj)spl/u-boot-spl-pad.ais
5403f7f2414STom Rini		cat $(obj)spl/u-boot-spl-pad.ais $(obj)u-boot.img > \
541d36d8859SChristian Riesch			$(obj)u-boot.ais
542d36d8859SChristian Riesch
543a5453555SOtavio Salvador
54430b9b932SMarek Vasut$(obj)u-boot.sb:       $(obj)u-boot.bin $(obj)spl/u-boot-spl.bin
545edabc1bcSMasahiro Yamada		$(MAKE) $(build) $(SRCTREE)/$(CPUDIR)/$(SOC)/ $(OBJTREE)/u-boot.sb
54630b9b932SMarek Vasut
54794aebe6cSStefan Roese# On x600 (SPEAr600) U-Boot is appended to U-Boot SPL.
54894aebe6cSStefan Roese# Both images are created using mkimage (crc etc), so that the ROM
54994aebe6cSStefan Roese# bootloader can check its integrity. Padding needs to be done to the
55094aebe6cSStefan Roese# SPL image (with mkimage header) and not the binary. Otherwise the resulting image
55194aebe6cSStefan Roese# which is loaded/copied by the ROM bootloader to SRAM doesn't fit.
55294aebe6cSStefan Roese# The resulting image containing both U-Boot images is called u-boot.spr
55394aebe6cSStefan Roese$(obj)u-boot.spr:	$(obj)u-boot.img $(obj)spl/u-boot-spl.bin
55494aebe6cSStefan Roese		$(obj)tools/mkimage -A $(ARCH) -T firmware -C none \
55594aebe6cSStefan Roese		-a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n XLOADER \
55657270260SMasahiro Yamada		-d $(obj)spl/u-boot-spl.bin $@
55757270260SMasahiro Yamada		$(OBJCOPY) -I binary -O binary \
55857270260SMasahiro Yamada			--pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff $@
55957270260SMasahiro Yamada		cat $(obj)u-boot.img >> $@
56094aebe6cSStefan Roese
5616d6c0baeSTom Warrenifneq ($(CONFIG_TEGRA),)
5629972db5cSStephen Warren$(obj)u-boot-nodtb-tegra.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
563e4ec9346SStephen Warren		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SYS_TEXT_BASE) -O binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin
5649972db5cSStephen Warren		cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > $@
565e4ec9346SStephen Warren		rm $(obj)spl/u-boot-spl-pad.bin
5669972db5cSStephen Warren
5679972db5cSStephen Warrenifeq ($(CONFIG_OF_SEPARATE),y)
5689972db5cSStephen Warren$(obj)u-boot-dtb-tegra.bin: $(obj)u-boot-nodtb-tegra.bin $(obj)u-boot.dtb
5699972db5cSStephen Warren		cat $(obj)u-boot-nodtb-tegra.bin $(obj)u-boot.dtb > $@
5709972db5cSStephen Warrenendif
571984df4ecSAllen Martinendif
572984df4ecSAllen Martin
573fb3d2b8aSStefan Roese$(obj)u-boot-img.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.img
574fb3d2b8aSStefan Roese		cat $(obj)spl/u-boot-spl.bin $(obj)u-boot.img > $@
575fb3d2b8aSStefan Roese
576ecddccd0SStefan Roese# PPC4xx needs the SPL at the end of the image, since the reset vector
577ecddccd0SStefan Roese# is located at 0xfffffffc. So we can't use the "u-boot-img.bin" target
578ecddccd0SStefan Roese# and need to introduce a new build target with the full blown U-Boot
579ecddccd0SStefan Roese# at the start padded up to the start of the SPL image. And then concat
580ecddccd0SStefan Roese# the SPL image to the end.
581ecddccd0SStefan Roese$(obj)u-boot-img-spl-at-end.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.img
58257270260SMasahiro Yamada		$(OBJCOPY) -I binary -O binary --pad-to=$(CONFIG_UBOOT_PAD_TO) \
58357270260SMasahiro Yamada			 --gap-fill=0xff $(obj)u-boot.img $@
58457270260SMasahiro Yamada		cat $(obj)spl/u-boot-spl.bin >> $@
585ecddccd0SStefan Roese
586f4dc714aSScott Wood# Create a new ELF from a raw binary file.  This is useful for arm64
587f4dc714aSScott Wood# where static relocation needs to be performed on the raw binary,
588f4dc714aSScott Wood# but certain simulators only accept an ELF file (but don't do the
589f4dc714aSScott Wood# relocation).
590f4dc714aSScott Wood# FIXME refactor dts/Makefile to share target/arch detection
591f4dc714aSScott Wood$(obj)u-boot.elf: $(obj)u-boot.bin
592f4dc714aSScott Wood	@$(OBJCOPY)  -B aarch64 -I binary -O elf64-littleaarch64 \
593f4dc714aSScott Wood		$< $(obj)u-boot-elf.o
594f4dc714aSScott Wood	@$(LD) $(obj)u-boot-elf.o -o $@ \
595f4dc714aSScott Wood		--defsym=_start=$(CONFIG_SYS_TEXT_BASE) \
596f4dc714aSScott Wood		-Ttext=$(CONFIG_SYS_TEXT_BASE)
597f4dc714aSScott Wood
59886eb49b3SSimon Glassifeq ($(CONFIG_SANDBOX),y)
59986eb49b3SSimon GlassGEN_UBOOT = \
60086eb49b3SSimon Glass		cd $(LNDIR) && $(CC) $(SYMS) -T $(obj)u-boot.lds \
60186eb49b3SSimon Glass			-Wl,--start-group $(__LIBS) -Wl,--end-group \
60286eb49b3SSimon Glass			$(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot.map -o u-boot
60386eb49b3SSimon Glasselse
604ecb1dc89SMike FrysingerGEN_UBOOT = \
60597b24d3dSMarek Vasut		cd $(LNDIR) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \
606ef123c52SAlbert ARIBAUD			$(__OBJS) \
607f9328639SMarian Balakowicz			--start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
608b2184c31Swdenk			-Map u-boot.map -o u-boot
60986eb49b3SSimon Glassendif
61086eb49b3SSimon Glass
61116a354f9SWolfgang Denk$(obj)u-boot:	depend \
6128e9a6cb1SMasahiro Yamada		$(SUBDIR_TOOLS) $(OBJS) $(LIBS) $(obj)u-boot.lds
613ecb1dc89SMike Frysinger		$(GEN_UBOOT)
614ecb1dc89SMike Frysingerifeq ($(CONFIG_KALLSYMS),y)
6158a156fb6SMike Frysinger		smap=`$(call SYSTEM_MAP,$(obj)u-boot) | \
6161aada9cdSWolfgang Denk			awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 "\\\\000"}'` ; \
6171aada9cdSWolfgang Denk		$(CC) $(CFLAGS) -DSYSTEM_MAP="\"$${smap}\"" \
6181aada9cdSWolfgang Denk			-c common/system_map.c -o $(obj)common/system_map.o
619ecb1dc89SMike Frysinger		$(GEN_UBOOT) $(obj)common/system_map.o
620ecb1dc89SMike Frysingerendif
6217ebf7443Swdenk
6223bddafaaSMasahiro Yamada$(OBJS):
6233bddafaaSMasahiro Yamada	@:
624f9328639SMarian Balakowicz
625349e83f0SChe-liang Chiou$(LIBS):	depend $(SUBDIR_TOOLS)
6263bddafaaSMasahiro Yamada		$(MAKE) $(build) $(dir $(subst $(obj),,$@))
627a8c7c708Swdenk
6284a20df39SMasahiro Yamada$(SUBDIRS):	depend
629940db16dSMasahiro Yamada		$(MAKE) $(build) $@ all
630940db16dSMasahiro Yamada
6318a7e7d56SMasahiro Yamada$(SUBDIR_EXAMPLES-y): $(obj)u-boot
632349e83f0SChe-liang Chiou
6338e9a6cb1SMasahiro Yamada$(obj)u-boot.lds: $(LDSCRIPT) depend
63497b24d3dSMarek Vasut		$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$< >$@
6351aada9cdSWolfgang Denk
636e935a374SHaiying Wangnand_spl:	$(TIMESTAMP_FILE) $(VERSION_FILE) depend
637a0b14c3fSMasahiro Yamada		$(MAKE) $(build) nand_spl/board/$(BOARDDIR) all
638887e2ec9SStefan Roese
639e935a374SHaiying Wang$(obj)u-boot-nand.bin:	nand_spl $(obj)u-boot.bin
6408318fbf8SMarian Balakowicz		cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin
641887e2ec9SStefan Roese
642bd25fdbaSAneesh V$(obj)spl/u-boot-spl.bin:	$(SUBDIR_TOOLS) depend
6435df2ee27SDaniel Schwierzeck		$(MAKE) -C spl all
6445df2ee27SDaniel Schwierzeck
6453aa29de0SYing Zhang$(obj)tpl/u-boot-tpl.bin:	$(SUBDIR_TOOLS) depend
6463aa29de0SYing Zhang		$(MAKE) -C spl all CONFIG_TPL_BUILD=y
6473aa29de0SYing Zhang
6482a998793SDaniel Hobi# Explicitly make _depend in subdirs containing multiple targets to prevent
6492a998793SDaniel Hobi# parallel sub-makes creating .depend files simultaneously.
65016a354f9SWolfgang Denkdepend dep:	$(TIMESTAMP_FILE) $(VERSION_FILE) \
65139bc12ddSJoel Fernandes		$(obj)include/spl-autoconf.mk \
6523aa29de0SYing Zhang		$(obj)include/tpl-autoconf.mk \
65316a354f9SWolfgang Denk		$(obj)include/autoconf.mk \
654a4814a69SStefano Babic		$(obj)include/generated/generic-asm-offsets.h \
655a4814a69SStefano Babic		$(obj)include/generated/asm-offsets.h
6567ebf7443Swdenk
657e5e4e705SLi YangTAG_SUBDIRS = $(SUBDIRS)
658e5e4e705SLi YangTAG_SUBDIRS += $(dir $(__LIBS))
659a340c325SJean-Christophe PLAGNIOL-VILLARDTAG_SUBDIRS += include
660a340c325SJean-Christophe PLAGNIOL-VILLARD
661857d9ea6SHorst KronstorferFIND := find
662857d9ea6SHorst KronstorferFINDFLAGS := -L
663857d9ea6SHorst Kronstorfer
6641064d980STom Rinicheckstack:
6651064d980STom Rini		$(CROSS_COMPILE)objdump -d $(obj)u-boot \
6661064d980STom Rini			`$(FIND) $(obj) -name u-boot-spl -print` | \
667dd88ab32SMasahiro Yamada			perl $(src)scripts/checkstack.pl $(ARCH)
6681064d980STom Rini
669f9328639SMarian Balakowicztags ctags:
670857d9ea6SHorst Kronstorfer		ctags -w -o $(obj)ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
671e5e4e705SLi Yang						-name '*.[chS]' -print`
6727ebf7443Swdenk
6737ebf7443Swdenketags:
674857d9ea6SHorst Kronstorfer		etags -a -o $(obj)etags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
675e5e4e705SLi Yang						-name '*.[chS]' -print`
676ffda586fSLi Yangcscope:
677857d9ea6SHorst Kronstorfer		$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) -name '*.[chS]' -print > \
678857d9ea6SHorst Kronstorfer						cscope.files
679ffda586fSLi Yang		cscope -b -q -k
6807ebf7443Swdenk
681ecb1dc89SMike FrysingerSYSTEM_MAP = \
682ecb1dc89SMike Frysinger		$(NM) $1 | \
6837ebf7443Swdenk		grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
684ecb1dc89SMike Frysinger		LC_ALL=C sort
685ecb1dc89SMike Frysinger$(obj)System.map:	$(obj)u-boot
686bc8bb6ecSMasahiro Yamada		@$(call SYSTEM_MAP,$<) > $@
6877ebf7443Swdenk
68806a119a0STom Rinicheckthumb:
68906a119a0STom Rini	@if test $(call cc-version) -lt 0404; then \
69006a119a0STom Rini		echo -n '*** Your GCC does not produce working '; \
69106a119a0STom Rini		echo 'binaries in THUMB mode.'; \
69206a119a0STom Rini		echo '*** Your board is configured for THUMB mode.'; \
69306a119a0STom Rini		false; \
69406a119a0STom Rini	fi
6956ec63f41SScott Wood
6966ec63f41SScott Wood# GCC 3.x is reported to have problems generating the type of relocation
6976ec63f41SScott Wood# that U-Boot wants.
6986ec63f41SScott Wood# See http://lists.denx.de/pipermail/u-boot/2012-September/135156.html
6996ec63f41SScott Woodcheckgcc4:
7006ec63f41SScott Wood	@if test $(call cc-version) -lt 0400; then \
7016ec63f41SScott Wood		echo -n '*** Your GCC is too old, please upgrade to GCC 4.x or newer'; \
7026ec63f41SScott Wood		false; \
7036ec63f41SScott Wood	fi
7046ec63f41SScott Wood
705501ebdf2SStephen Warrencheckdtc:
706501ebdf2SStephen Warren	@if test $(call dtc-version) -lt 0104; then \
707501ebdf2SStephen Warren		echo '*** Your dtc is too old, please upgrade to dtc 1.4 or newer'; \
708501ebdf2SStephen Warren		false; \
709501ebdf2SStephen Warren	fi
710501ebdf2SStephen Warren
7112f155f6cSGrant Likely#
7122f155f6cSGrant Likely# Auto-generate the autoconf.mk file (which is included by all makefiles)
7132f155f6cSGrant Likely#
7142f155f6cSGrant Likely# This target actually generates 2 files; autoconf.mk and autoconf.mk.dep.
7152f155f6cSGrant Likely# the dep file is only include in this top level makefile to determine when
7162f155f6cSGrant Likely# to regenerate the autoconf.mk file.
7171510b82dSWolfgang Denk$(obj)include/autoconf.mk.dep: $(obj)include/config.h include/common.h
7181510b82dSWolfgang Denk	@$(XECHO) Generating $@ ; \
719ae6d1056SWolfgang Denk	: Generate the dependancies ; \
7204c34b2a0SMike Frysinger	$(CC) -x c -DDO_DEPS_ONLY -M $(CFLAGS) $(CPPFLAGS) \
72165947ab4SMasahiro Yamada		-MQ $(obj)include/autoconf.mk include/common.h > $@ || \
72265947ab4SMasahiro Yamada		rm $@
7231510b82dSWolfgang Denk
7241510b82dSWolfgang Denk$(obj)include/autoconf.mk: $(obj)include/config.h
7251510b82dSWolfgang Denk	@$(XECHO) Generating $@ ; \
726ae6d1056SWolfgang Denk	: Extract the config macros ; \
72765947ab4SMasahiro Yamada	$(CPP) $(CFLAGS) -DDO_DEPS_ONLY -dM include/common.h > $@.tmp && \
72865947ab4SMasahiro Yamada		sed -n -f tools/scripts/define2mk.sed $@.tmp > $@; \
72965947ab4SMasahiro Yamada	rm $@.tmp
7302f155f6cSGrant Likely
73139bc12ddSJoel Fernandes# Auto-generate the spl-autoconf.mk file (which is included by all makefiles for SPL)
7323aa29de0SYing Zhang$(obj)include/tpl-autoconf.mk: $(obj)include/config.h
7333aa29de0SYing Zhang	@$(XECHO) Generating $@ ; \
7343aa29de0SYing Zhang	: Extract the config macros ; \
7353aa29de0SYing Zhang	$(CPP) $(CFLAGS) -DCONFIG_TPL_BUILD  -DCONFIG_SPL_BUILD\
73665947ab4SMasahiro Yamada			-DDO_DEPS_ONLY -dM include/common.h > $@.tmp && \
73765947ab4SMasahiro Yamada		sed -n -f tools/scripts/define2mk.sed $@.tmp > $@; \
73865947ab4SMasahiro Yamada	rm $@.tmp
7393aa29de0SYing Zhang
74039bc12ddSJoel Fernandes$(obj)include/spl-autoconf.mk: $(obj)include/config.h
74139bc12ddSJoel Fernandes	@$(XECHO) Generating $@ ; \
74239bc12ddSJoel Fernandes	: Extract the config macros ; \
74365947ab4SMasahiro Yamada	$(CPP) $(CFLAGS) -DCONFIG_SPL_BUILD -DDO_DEPS_ONLY -dM include/common.h > $@.tmp && \
74465947ab4SMasahiro Yamada		sed -n -f tools/scripts/define2mk.sed $@.tmp > $@; \
74565947ab4SMasahiro Yamada	rm $@.tmp
74639bc12ddSJoel Fernandes
74774c43bb3SMasahiro Yamada$(obj)include/generated/generic-asm-offsets.h: $(obj)lib/asm-offsets.s
74816a354f9SWolfgang Denk	@$(XECHO) Generating $@
74916a354f9SWolfgang Denk	tools/scripts/make-asm-offsets $(obj)lib/asm-offsets.s $@
75016a354f9SWolfgang Denk
75174c43bb3SMasahiro Yamada$(obj)lib/asm-offsets.s: $(obj)include/config.h $(src)lib/asm-offsets.c
75216a354f9SWolfgang Denk	@mkdir -p $(obj)lib
75316a354f9SWolfgang Denk	$(CC) -DDO_DEPS_ONLY \
75416a354f9SWolfgang Denk		$(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
75516a354f9SWolfgang Denk		-o $@ $(src)lib/asm-offsets.c -c -S
75616a354f9SWolfgang Denk
75774c43bb3SMasahiro Yamada$(obj)include/generated/asm-offsets.h: $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s
758b12734eeSWolfgang Denk	@$(XECHO) Generating $@
759a4814a69SStefano Babic	tools/scripts/make-asm-offsets $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s $@
760a4814a69SStefano Babic
76174c43bb3SMasahiro Yamada$(obj)$(CPUDIR)/$(SOC)/asm-offsets.s: $(obj)include/config.h
762a4814a69SStefano Babic	@mkdir -p $(obj)$(CPUDIR)/$(SOC)
763a4814a69SStefano Babic	if [ -f $(src)$(CPUDIR)/$(SOC)/asm-offsets.c ];then \
764a4814a69SStefano Babic		$(CC) -DDO_DEPS_ONLY \
765a4814a69SStefano Babic		$(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
766a4814a69SStefano Babic			-o $@ $(src)$(CPUDIR)/$(SOC)/asm-offsets.c -c -S; \
767a4814a69SStefano Babic	else \
768a4814a69SStefano Babic		touch $@; \
769a4814a69SStefano Babic	fi
770a4814a69SStefano Babic
7717ebf7443Swdenk#########################################################################
772ae6d1056SWolfgang Denkelse	# !config.mk
773f9328639SMarian Balakowiczall $(obj)u-boot.hex $(obj)u-boot.srec $(obj)u-boot.bin \
774f9328639SMarian Balakowicz$(obj)u-boot.img $(obj)u-boot.dis $(obj)u-boot \
775249b53a6SLoïc Minier$(filter-out tools,$(SUBDIRS)) \
7762e78e75eSMasahiro Yamadadepend dep tags ctags etags cscope $(obj)System.map:
7777ebf7443Swdenk	@echo "System not configured - see README" >&2
7787ebf7443Swdenk	@ exit 1
779c7c0d542SMike Frysinger
780249b53a6SLoïc Miniertools: $(VERSION_FILE) $(TIMESTAMP_FILE)
781940db16dSMasahiro Yamada	$(MAKE) $(build) $@ all
782ae6d1056SWolfgang Denkendif	# config.mk
7837ebf7443Swdenk
78454799e45SScott Wood# ARM relocations should all be R_ARM_RELATIVE (32-bit) or
78554799e45SScott Wood# R_AARCH64_RELATIVE (64-bit).
786c37980c3SAlbert ARIBAUDcheckarmreloc: $(obj)u-boot
78754799e45SScott Wood	@RELOC="`$(CROSS_COMPILE)readelf -r -W $< | cut -d ' ' -f 4 | \
78854799e45SScott Wood		grep R_A | sort -u`"; \
78954799e45SScott Wood	if test "$$RELOC" != "R_ARM_RELATIVE" -a \
79054799e45SScott Wood		 "$$RELOC" != "R_AARCH64_RELATIVE"; then \
79154799e45SScott Wood		echo "$< contains unexpected relocations: $$RELOC"; \
79254799e45SScott Wood		false; \
79354799e45SScott Wood	fi
794c37980c3SAlbert ARIBAUD
79528abd48fSIlya Yanok$(VERSION_FILE):
79614ce91b1SMike Frysinger		@mkdir -p $(dir $(VERSION_FILE))
797dd88ab32SMasahiro Yamada		@( localvers='$(shell $(TOPDIR)/scripts/setlocalversion $(TOPDIR))' ; \
79828abd48fSIlya Yanok		   printf '#define PLAIN_VERSION "%s%s"\n' \
79928abd48fSIlya Yanok			"$(U_BOOT_VERSION)" "$${localvers}" ; \
80028abd48fSIlya Yanok		   printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' \
80128abd48fSIlya Yanok			"$(U_BOOT_VERSION)" "$${localvers}" ; \
80228abd48fSIlya Yanok		) > $@.tmp
80328abd48fSIlya Yanok		@( printf '#define CC_VERSION_STRING "%s"\n' \
80428abd48fSIlya Yanok		 '$(shell $(CC) --version | head -n 1)' )>>  $@.tmp
80528abd48fSIlya Yanok		@( printf '#define LD_VERSION_STRING "%s"\n' \
80628abd48fSIlya Yanok		 '$(shell $(LD) -v | head -n 1)' )>>  $@.tmp
80728abd48fSIlya Yanok		@cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
80828abd48fSIlya Yanok
809249b53a6SLoïc Minier$(TIMESTAMP_FILE):
810249b53a6SLoïc Minier		@mkdir -p $(dir $(TIMESTAMP_FILE))
811a76406fbSLoïc Minier		@LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > $@.tmp
812a76406fbSLoïc Minier		@LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> $@.tmp
813a76406fbSLoïc Minier		@cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
814249b53a6SLoïc Minier
8150358df42SMike Frysingereasylogo env gdb:
816940db16dSMasahiro Yamada	$(MAKE) $(build) tools/$@ MTD_VERSION=${MTD_VERSION}
817940db16dSMasahiro Yamada
8180358df42SMike Frysingergdbtools: gdb
8190358df42SMike Frysinger
82030ff8918SMarek Vasutxmldocs pdfdocs psdocs htmldocs mandocs: tools/kernel-doc/docproc
82130ff8918SMarek Vasut	$(MAKE) U_BOOT_VERSION=$(U_BOOT_VERSION) -C doc/DocBook/ $@
82230ff8918SMarek Vasut
823249b53a6SLoïc Miniertools-all: easylogo env gdb $(VERSION_FILE) $(TIMESTAMP_FILE)
824940db16dSMasahiro Yamada	$(MAKE) $(build) tools HOST_TOOLS_ALL=y
8250358df42SMike Frysinger
8264e53a258SWolfgang Denk.PHONY : CHANGELOG
8274e53a258SWolfgang DenkCHANGELOG:
828b985b5d6SBen Warren	git log --no-merges U-Boot-1_1_5.. | \
829b985b5d6SBen Warren	unexpand -a | sed -e 's/\s\s*$$//' > $@
8304e53a258SWolfgang Denk
8310a823aa2SHarald Welteinclude/license.h: tools/bin2header COPYING
8320a823aa2SHarald Welte	cat COPYING | gzip -9 -c | ./tools/bin2header license_gzip > include/license.h
8337ebf7443Swdenk#########################################################################
8347ebf7443Swdenk
8357ebf7443Swdenkunconfig:
836887e2ec9SStefan Roese	@rm -f $(obj)include/config.h $(obj)include/config.mk \
8372f155f6cSGrant Likely		$(obj)board/*/config.tmp $(obj)board/*/*/config.tmp \
83839bc12ddSJoel Fernandes		$(obj)include/autoconf.mk $(obj)include/autoconf.mk.dep \
8393aa29de0SYing Zhang		$(obj)include/spl-autoconf.mk \
8403aa29de0SYing Zhang		$(obj)include/tpl-autoconf.mk
8417ebf7443Swdenk
842a6862bc1SWolfgang Denk%_config::	unconfig
843a6862bc1SWolfgang Denk	@$(MKCONFIG) -A $(@:_config=)
844a6862bc1SWolfgang Denk
845d6a5e6d5SLoïc Miniersinclude $(obj).boards.depend
846d6a5e6d5SLoïc Minier$(obj).boards.depend:	boards.cfg
84750c2a91bSMasahiro Yamada	@awk '(NF && $$1 !~ /^#/) { print $$7 ": " $$7 "_config; $$(MAKE)" }' $< > $@
8489f4a4206SMike Frysinger
849699f0512SWolfgang Denk#########################################################################
8503e38691eSwdenk#########################################################################
8517ebf7443Swdenk
8527ebf7443Swdenkclean:
853aaed2eb5SMasahiro Yamada	@rm -f $(obj)examples/standalone/atmel_df_pow2			  \
8541bc15386SPeter Tyser	       $(obj)examples/standalone/hello_world			  \
8551bc15386SPeter Tyser	       $(obj)examples/standalone/interrupt			  \
8561bc15386SPeter Tyser	       $(obj)examples/standalone/mem_to_mem_idma2intr		  \
8571bc15386SPeter Tyser	       $(obj)examples/standalone/sched				  \
858*f6322eb7SMasahiro Yamada	       $(addprefix $(obj)examples/standalone/, smc91111_eeprom smc911x_eeprom) \
8591bc15386SPeter Tyser	       $(obj)examples/standalone/test_burst			  \
8601bc15386SPeter Tyser	       $(obj)examples/standalone/timer
861*f6322eb7SMasahiro Yamada	@rm -f $(addprefix $(obj)examples/api/, demo demo.bin)
862f9301e1cSWolfgang Denk	@rm -f $(obj)tools/bmp_logo	   $(obj)tools/easylogo/easylogo  \
863475c506dSMasahiro Yamada	       $(obj)tools/env/fw_printenv				  \
864f9301e1cSWolfgang Denk	       $(obj)tools/envcrc					  \
865*f6322eb7SMasahiro Yamada	       $(addprefix $(obj)tools/gdb/, gdbcont gdbsend)		  \
866f9301e1cSWolfgang Denk	       $(obj)tools/gen_eth_addr    $(obj)tools/img2srec		  \
867*f6322eb7SMasahiro Yamada	       $(obj)tools/dumpimage					  \
868*f6322eb7SMasahiro Yamada	       $(addprefix $(obj)tools/, mkenvimage mkimage)		  \
869*f6322eb7SMasahiro Yamada	       $(obj)tools/mpc86x_clk					  \
870*f6322eb7SMasahiro Yamada	       $(addprefix $(obj)tools/, mk$(BOARD)spl mkexynosspl)	  \
8718aa09026SMarek Vasut	       $(obj)tools/mxsboot					  \
87230ff8918SMarek Vasut	       $(obj)tools/ncb		   $(obj)tools/ubsha1		  \
8736c887b2aSSimon Glass	       $(obj)tools/kernel-doc/docproc				  \
8746c887b2aSSimon Glass	       $(obj)tools/proftool
875*f6322eb7SMasahiro Yamada	@rm -f $(addprefix $(obj)board/cray/L1/, bootscript.c bootscript.image) \
87674c7a95fSWolfgang Denk	       $(obj)board/matrix_vision/*/bootscript.img		  \
877e183a174SMasahiro Yamada	       $(obj)spl/board/samsung/$(BOARD)/tools/mk$(BOARD)spl	  \
8781aada9cdSWolfgang Denk	       $(obj)u-boot.lds						  \
879*f6322eb7SMasahiro Yamada	       $(addprefix $(obj)arch/blackfin/cpu/, init.lds init.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
91394aebe6cSStefan Roese	@rm -f $(obj)u-boot.spr
914*f6322eb7SMasahiro Yamada	@rm -f $(addprefix $(obj)nand_spl/, u-boot.lds u-boot.lst System.map)
915*f6322eb7SMasahiro Yamada	@rm -f $(addprefix $(obj)nand_spl/, u-boot-nand_spl.lds u-boot-spl u-boot-spl.map)
916*f6322eb7SMasahiro Yamada	@rm -f $(addprefix $(obj)spl/, u-boot-spl u-boot-spl.bin u-boot-spl.map)
917ef123c52SAlbert ARIBAUD	@rm -f $(obj)spl/u-boot-spl.lds
918*f6322eb7SMasahiro Yamada	@rm -f $(addprefix $(obj)tpl/, u-boot-tpl u-boot-tpl.bin u-boot-tpl.map)
9193aa29de0SYing Zhang	@rm -f $(obj)tpl/u-boot-spl.lds
92094bcfe52SNishanth Menon	@rm -f $(obj)MLO MLO.byteswap
921a3cbc396SStefano Babic	@rm -f $(obj)SPL
9228b425b3fSDaniel Schwierzeck	@rm -f $(obj)tools/xway-swap-bytes
923a9d8bc98SLoïc Minier	@rm -fr $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
92416a354f9SWolfgang Denk	@rm -fr $(obj)include/generated
925a958b663SJean-Christophe PLAGNIOL-VILLARD	@[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name "*" -type l -print | xargs rm -f
926bbb0b128SSimon Glass	@rm -f $(obj)dts/*.tmp
927*f6322eb7SMasahiro Yamada	@rm -f $(addprefix $(obj)spl/, u-boot-spl.ais, u-boot-spl-pad.ais)
9287ebf7443Swdenk
9297ebf7443Swdenkmrproper \
9307ebf7443Swdenkdistclean:	clobber unconfig
931afd077bdSMike Frysingerifneq ($(OBJTREE),$(SRCTREE))
932ae6d1056SWolfgang Denk	rm -rf $(obj)*
933f9328639SMarian Balakowiczendif
9347ebf7443Swdenk
9357ebf7443Swdenkbackup:
9367ebf7443Swdenk	F=`basename $(TOPDIR)` ; cd .. ; \
937d6b93714SIlya Yanok	gtar --force-local -zcvf `LC_ALL=C date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F
9387ebf7443Swdenk
9397ebf7443Swdenk#########################################################################
940