xref: /openbmc/u-boot/Makefile (revision bf4b3de1013c1643ffb8f071292c0f0eabb265c3)
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)
105*bf4b3de1SMasahiro Yamadasrctree		:= $(SRCTREE)
106f9328639SMarian BalakowiczTOPDIR		:= $(SRCTREE)
107f9328639SMarian BalakowiczLNDIR		:= $(OBJTREE)
108*bf4b3de1SMasahiro Yamadaexport	TOPDIR SRCTREE srctree OBJTREE SPLTREE TPLTREE
109f9328639SMarian Balakowicz
110f9328639SMarian BalakowiczMKCONFIG	:= $(SRCTREE)/mkconfig
111f9328639SMarian Balakowiczexport MKCONFIG
112f9328639SMarian Balakowicz
113f9328639SMarian Balakowicz# $(obj) and (src) are defined in config.mk but here in main Makefile
114f9328639SMarian Balakowicz# we also need them before config.mk is included which is the case for
115f9328639SMarian Balakowicz# some targets like unconfig, clean, clobber, distclean, etc.
116f9328639SMarian Balakowiczifneq ($(OBJTREE),$(SRCTREE))
117f9328639SMarian Balakowiczobj := $(OBJTREE)/
118f9328639SMarian Balakowiczsrc := $(SRCTREE)/
119f9328639SMarian Balakowiczelse
120f9328639SMarian Balakowiczobj :=
121f9328639SMarian Balakowiczsrc :=
122f9328639SMarian Balakowiczendif
123f9328639SMarian Balakowiczexport obj src
124f9328639SMarian Balakowicz
1255013c09fSWolfgang Denk# Make sure CDPATH settings don't interfere
1265013c09fSWolfgang Denkunexport CDPATH
1275013c09fSWolfgang Denk
128f9328639SMarian Balakowicz#########################################################################
129f9328639SMarian Balakowicz
1306d1ce387SMike Frysinger# The "tools" are needed early, so put this first
1316d1ce387SMike Frysinger# Don't include stuff already done in $(LIBS)
132349e83f0SChe-liang Chiou# The "examples" conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC
133349e83f0SChe-liang Chiou# is "yes"), so compile examples after U-Boot is compiled.
134349e83f0SChe-liang ChiouSUBDIR_TOOLS = tools
135349e83f0SChe-liang ChiouSUBDIRS = $(SUBDIR_TOOLS)
1366d1ce387SMike Frysinger
137249b53a6SLoïc Minier.PHONY : $(SUBDIRS) $(VERSION_FILE) $(TIMESTAMP_FILE)
1386d1ce387SMike Frysinger
139ae6d1056SWolfgang Denkifeq ($(obj)include/config.mk,$(wildcard $(obj)include/config.mk))
140f9328639SMarian Balakowicz
1412632c008SMike Frysinger# Include autoconf.mk before config.mk so that the config options are available
1422632c008SMike Frysinger# to all top level build files.  We need the dummy all: target to prevent the
1432632c008SMike Frysinger# dependency target in autoconf.mk.dep from being the default.
1442632c008SMike Frysingerall:
1452632c008SMike Frysingersinclude $(obj)include/autoconf.mk.dep
1462632c008SMike Frysingersinclude $(obj)include/autoconf.mk
1472632c008SMike Frysinger
1488a7e7d56SMasahiro YamadaSUBDIR_EXAMPLES-y := examples/standalone
1498a7e7d56SMasahiro YamadaSUBDIR_EXAMPLES-$(CONFIG_API) += examples/api
150b5728756SSimon Glassifndef CONFIG_SANDBOX
1518a7e7d56SMasahiro YamadaSUBDIRS += $(SUBDIR_EXAMPLES-y)
152b5728756SSimon Glassendif
153b5728756SSimon Glass
1547ebf7443Swdenk# load ARCH, BOARD, and CPU configuration
155ae6d1056SWolfgang Denkinclude $(obj)include/config.mk
1561d9f4105Swdenkexport	ARCH CPU BOARD VENDOR SOC
157f9328639SMarian Balakowicz
1581ea6bcd8SMike Frysinger# set default to nothing for native builds
159a5284efdSWolfgang Denkifeq ($(HOSTARCH),$(ARCH))
1601ea6bcd8SMike FrysingerCROSS_COMPILE ?=
1617ebf7443Swdenkendif
1627ebf7443Swdenk
163f6322eb7SMasahiro Yamada# SHELL used by kbuild
164f6322eb7SMasahiro YamadaCONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
165f6322eb7SMasahiro Yamada	  else if [ -x /bin/bash ]; then echo /bin/bash; \
166f6322eb7SMasahiro Yamada	  else echo sh; fi ; fi)
167f6322eb7SMasahiro Yamada
168f6322eb7SMasahiro YamadaHOSTCC       = gcc
169f6322eb7SMasahiro YamadaHOSTCFLAGS   = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
170f6322eb7SMasahiro Yamada
171f6322eb7SMasahiro Yamadaifeq ($(HOSTOS),cygwin)
172f6322eb7SMasahiro YamadaHOSTCFLAGS	+= -ansi
173f6322eb7SMasahiro Yamadaendif
174f6322eb7SMasahiro Yamada
175f6322eb7SMasahiro Yamada# Mac OS X / Darwin's C preprocessor is Apple specific.  It
176f6322eb7SMasahiro Yamada# generates numerous errors and warnings.  We want to bypass it
177f6322eb7SMasahiro Yamada# and use GNU C's cpp.	To do this we pass the -traditional-cpp
178f6322eb7SMasahiro Yamada# option to the compiler.  Note that the -traditional-cpp flag
179f6322eb7SMasahiro Yamada# DOES NOT have the same semantics as GNU C's flag, all it does
180f6322eb7SMasahiro Yamada# is invoke the GNU preprocessor in stock ANSI/ISO C fashion.
181f6322eb7SMasahiro Yamada#
182f6322eb7SMasahiro Yamada# Apple's linker is similar, thanks to the new 2 stage linking
183f6322eb7SMasahiro Yamada# multiple symbol definitions are treated as errors, hence the
184f6322eb7SMasahiro Yamada# -multiply_defined suppress option to turn off this error.
185f6322eb7SMasahiro Yamada#
186f6322eb7SMasahiro Yamadaifeq ($(HOSTOS),darwin)
187f6322eb7SMasahiro Yamada# get major and minor product version (e.g. '10' and '6' for Snow Leopard)
188f6322eb7SMasahiro YamadaDARWIN_MAJOR_VERSION	= $(shell sw_vers -productVersion | cut -f 1 -d '.')
189f6322eb7SMasahiro YamadaDARWIN_MINOR_VERSION	= $(shell sw_vers -productVersion | cut -f 2 -d '.')
190f6322eb7SMasahiro Yamada
191f6322eb7SMasahiro Yamadaos_x_before	= $(shell if [ $(DARWIN_MAJOR_VERSION) -le $(1) -a \
192f6322eb7SMasahiro Yamada	$(DARWIN_MINOR_VERSION) -le $(2) ] ; then echo "$(3)"; else echo "$(4)"; fi ;)
193f6322eb7SMasahiro Yamada
194f6322eb7SMasahiro Yamada# Snow Leopards build environment has no longer restrictions as described above
195f6322eb7SMasahiro YamadaHOSTCC       = $(call os_x_before, 10, 5, "cc", "gcc")
196f6322eb7SMasahiro YamadaHOSTCFLAGS  += $(call os_x_before, 10, 4, "-traditional-cpp")
197f6322eb7SMasahiro YamadaHOSTLDFLAGS += $(call os_x_before, 10, 5, "-multiply_defined suppress")
198f6322eb7SMasahiro Yamadaendif
199f6322eb7SMasahiro Yamada
200*bf4b3de1SMasahiro Yamada# We need some generic definitions (do not try to remake the file).
201*bf4b3de1SMasahiro Yamada$(srctree)/scripts/Kbuild.include: ;
202*bf4b3de1SMasahiro Yamadainclude $(srctree)/scripts/Kbuild.include
203*bf4b3de1SMasahiro Yamada
204f6322eb7SMasahiro Yamada# Make variables (CC, etc...)
205f6322eb7SMasahiro Yamada
206f6322eb7SMasahiro YamadaAS		= $(CROSS_COMPILE)as
207f6322eb7SMasahiro Yamada# Always use GNU ld
208f6322eb7SMasahiro Yamadaifneq ($(shell $(CROSS_COMPILE)ld.bfd -v 2> /dev/null),)
209f6322eb7SMasahiro YamadaLD		= $(CROSS_COMPILE)ld.bfd
210f6322eb7SMasahiro Yamadaelse
211f6322eb7SMasahiro YamadaLD		= $(CROSS_COMPILE)ld
212f6322eb7SMasahiro Yamadaendif
213f6322eb7SMasahiro YamadaCC		= $(CROSS_COMPILE)gcc
214f6322eb7SMasahiro YamadaCPP		= $(CC) -E
215f6322eb7SMasahiro YamadaAR		= $(CROSS_COMPILE)ar
216f6322eb7SMasahiro YamadaNM		= $(CROSS_COMPILE)nm
217f6322eb7SMasahiro YamadaLDR		= $(CROSS_COMPILE)ldr
218f6322eb7SMasahiro YamadaSTRIP		= $(CROSS_COMPILE)strip
219f6322eb7SMasahiro YamadaOBJCOPY		= $(CROSS_COMPILE)objcopy
220f6322eb7SMasahiro YamadaOBJDUMP		= $(CROSS_COMPILE)objdump
221f6322eb7SMasahiro YamadaAWK		= awk
222f6322eb7SMasahiro YamadaRANLIB		= $(CROSS_COMPILE)RANLIB
223f6322eb7SMasahiro YamadaDTC		= dtc
224f6322eb7SMasahiro YamadaCHECK		= sparse
225f6322eb7SMasahiro Yamada
226f6322eb7SMasahiro YamadaCHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
227f6322eb7SMasahiro Yamada		  -Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF)
228f6322eb7SMasahiro Yamada
229f6322eb7SMasahiro Yamadaexport CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC
230f6322eb7SMasahiro Yamadaexport CPP AR NM LDR STRIP OBJCOPY OBJDUMP
231f6322eb7SMasahiro Yamadaexport MAKE AWK
232f6322eb7SMasahiro Yamadaexport DTC CHECK CHECKFLAGS
233f6322eb7SMasahiro Yamada
23492b197f0SWolfgang Denk# load other configuration
23592b197f0SWolfgang Denkinclude $(TOPDIR)/config.mk
23692b197f0SWolfgang Denk
237fada9e20SSimon Glass# Targets which don't build the source code
238ace8f506SBo ShenNON_BUILD_TARGETS = backup clean clobber distclean mrproper tidy unconfig
239fada9e20SSimon Glass
240fada9e20SSimon Glass# Only do the generic board check when actually building, not configuring
241fada9e20SSimon Glassifeq ($(filter $(NON_BUILD_TARGETS),$(MAKECMDGOALS)),)
242fada9e20SSimon Glassifeq ($(findstring _config,$(MAKECMDGOALS)),)
243fada9e20SSimon Glass$(CHECK_GENERIC_BOARD)
244fada9e20SSimon Glassendif
245fada9e20SSimon Glassendif
246fada9e20SSimon Glass
247d51dfff7SIlya Yanok# If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use
248d51dfff7SIlya Yanok# that (or fail if absent).  Otherwise, search for a linker script in a
249d51dfff7SIlya Yanok# standard location.
250d51dfff7SIlya Yanok
251ee60197eSSimon GlassLDSCRIPT_MAKEFILE_DIR = $(dir $(LDSCRIPT))
252ee60197eSSimon Glass
253d51dfff7SIlya Yanokifndef LDSCRIPT
254d51dfff7SIlya Yanok	#LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug
255d51dfff7SIlya Yanok	ifdef CONFIG_SYS_LDSCRIPT
256d51dfff7SIlya Yanok		# need to strip off double quotes
257a8c07541SMasahiro Yamada		LDSCRIPT := $(CONFIG_SYS_LDSCRIPT:"%"=%)
258d51dfff7SIlya Yanok	endif
259d51dfff7SIlya Yanokendif
260d51dfff7SIlya Yanok
261ee60197eSSimon Glass# If there is no specified link script, we look in a number of places for it
262d51dfff7SIlya Yanokifndef LDSCRIPT
263d51dfff7SIlya Yanok	ifeq ($(CONFIG_NAND_U_BOOT),y)
264d51dfff7SIlya Yanok		LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds
265d51dfff7SIlya Yanok		ifeq ($(wildcard $(LDSCRIPT)),)
266d51dfff7SIlya Yanok			LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds
267d51dfff7SIlya Yanok		endif
268d51dfff7SIlya Yanok	endif
269d51dfff7SIlya Yanok	ifeq ($(wildcard $(LDSCRIPT)),)
270d51dfff7SIlya Yanok		LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
271d51dfff7SIlya Yanok	endif
272d51dfff7SIlya Yanok	ifeq ($(wildcard $(LDSCRIPT)),)
273d51dfff7SIlya Yanok		LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot.lds
274d51dfff7SIlya Yanok	endif
275d51dfff7SIlya Yanok	ifeq ($(wildcard $(LDSCRIPT)),)
276ee60197eSSimon Glass		LDSCRIPT := $(TOPDIR)/arch/$(ARCH)/cpu/u-boot.lds
277ee60197eSSimon Glass		# We don't expect a Makefile here
278ee60197eSSimon Glass		LDSCRIPT_MAKEFILE_DIR =
279ee60197eSSimon Glass	endif
280ee60197eSSimon Glass	ifeq ($(wildcard $(LDSCRIPT)),)
281d51dfff7SIlya Yanok$(error could not find linker script)
282d51dfff7SIlya Yanok	endif
283d51dfff7SIlya Yanokendif
284d51dfff7SIlya Yanok
2857ebf7443Swdenk#########################################################################
2867ebf7443Swdenk# U-Boot objects....order is important (i.e. start must be first)
2877ebf7443Swdenk
288e8a8b824SMasahiro Yamadahead-y := $(CPUDIR)/start.o
289e8a8b824SMasahiro Yamadahead-$(CONFIG_4xx) += arch/powerpc/cpu/ppc4xx/resetvec.o
290e8a8b824SMasahiro Yamadahead-$(CONFIG_MPC85xx) += arch/powerpc/cpu/mpc85xx/resetvec.o
2917ebf7443Swdenk
292e8a8b824SMasahiro YamadaOBJS := $(addprefix $(obj),$(head-y))
293f9328639SMarian Balakowicz
2948b5a0264SDaniel SchwierzeckHAVE_VENDOR_COMMON_LIB = $(if $(wildcard board/$(VENDOR)/common/Makefile),y,n)
2958b5a0264SDaniel Schwierzeck
296e2906a59SMasahiro YamadaLIBS-y += lib/
297e2906a59SMasahiro YamadaLIBS-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/
298e2906a59SMasahiro YamadaLIBS-y += $(CPUDIR)/
2991d9f4105Swdenkifdef SOC
300e2906a59SMasahiro YamadaLIBS-y += $(CPUDIR)/$(SOC)/
3011d9f4105Swdenkendif
302e2906a59SMasahiro YamadaLIBS-$(CONFIG_IXP4XX_NPE) += drivers/net/npe/
303e2906a59SMasahiro YamadaLIBS-$(CONFIG_OF_EMBED) += dts/
304e2906a59SMasahiro YamadaLIBS-y += arch/$(ARCH)/lib/
30557c3e5fcSMasahiro YamadaLIBS-y += fs/
306e2906a59SMasahiro YamadaLIBS-y += net/
307e2906a59SMasahiro YamadaLIBS-y += disk/
308e2906a59SMasahiro YamadaLIBS-y += drivers/
309e2906a59SMasahiro YamadaLIBS-y += drivers/dma/
310e2906a59SMasahiro YamadaLIBS-y += drivers/gpio/
311e2906a59SMasahiro YamadaLIBS-y += drivers/i2c/
312e2906a59SMasahiro YamadaLIBS-y += drivers/input/
313e2906a59SMasahiro YamadaLIBS-y += drivers/mmc/
314e2906a59SMasahiro YamadaLIBS-y += drivers/mtd/
315392ba525SMasahiro YamadaLIBS-$(CONFIG_CMD_NAND) += drivers/mtd/nand/
316e2906a59SMasahiro YamadaLIBS-y += drivers/mtd/onenand/
317392ba525SMasahiro YamadaLIBS-$(CONFIG_CMD_UBI) += drivers/mtd/ubi/
318e2906a59SMasahiro YamadaLIBS-y += drivers/mtd/spi/
319e2906a59SMasahiro YamadaLIBS-y += drivers/net/
320e2906a59SMasahiro YamadaLIBS-y += drivers/net/phy/
321e2906a59SMasahiro YamadaLIBS-y += drivers/pci/
322e2906a59SMasahiro YamadaLIBS-y += drivers/power/ \
323e2906a59SMasahiro Yamada	drivers/power/fuel_gauge/ \
324e2906a59SMasahiro Yamada	drivers/power/mfd/ \
325e2906a59SMasahiro Yamada	drivers/power/pmic/ \
326e2906a59SMasahiro Yamada	drivers/power/battery/
327e2906a59SMasahiro YamadaLIBS-y += drivers/spi/
328e2906a59SMasahiro YamadaLIBS-$(CONFIG_FMAN_ENET) += drivers/net/fm/
3295614e71bSYork SunLIBS-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/
330e2906a59SMasahiro YamadaLIBS-y += drivers/serial/
331e2906a59SMasahiro YamadaLIBS-y += drivers/usb/eth/
332e2906a59SMasahiro YamadaLIBS-y += drivers/usb/gadget/
333e2906a59SMasahiro YamadaLIBS-y += drivers/usb/host/
334e2906a59SMasahiro YamadaLIBS-y += drivers/usb/musb/
335e2906a59SMasahiro YamadaLIBS-y += drivers/usb/musb-new/
336e2906a59SMasahiro YamadaLIBS-y += drivers/usb/phy/
337e2906a59SMasahiro YamadaLIBS-y += drivers/usb/ulpi/
338e2906a59SMasahiro YamadaLIBS-y += common/
339e2906a59SMasahiro YamadaLIBS-y += lib/libfdt/
3408a7e7d56SMasahiro YamadaLIBS-$(CONFIG_API) += api/
341755e08f0SMasahiro YamadaLIBS-$(CONFIG_HAS_POST) += post/
342e2906a59SMasahiro YamadaLIBS-y += test/
343f9328639SMarian Balakowicz
34424e8bee5SAlison Wangifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35 mxs vf610))
345e2906a59SMasahiro YamadaLIBS-y += arch/$(ARCH)/imx-common/
34618936ee2SJason Liuendif
34718936ee2SJason Liu
348e2906a59SMasahiro YamadaLIBS-$(CONFIG_ARM) += arch/arm/cpu/
349e2906a59SMasahiro YamadaLIBS-$(CONFIG_PPC) += arch/powerpc/cpu/
350852bd07cSMinkyu Kang
351e2906a59SMasahiro YamadaLIBS-y += board/$(BOARDDIR)/
35208e39a84SMasahiro Yamada
353e2906a59SMasahiro YamadaLIBS-y := $(patsubst %/, %/built-in.o, $(LIBS-y))
354f52d7b35SDaniel SchwierzeckLIBS := $(addprefix $(obj),$(sort $(LIBS-y)))
355249b53a6SLoïc Minier.PHONY : $(LIBS)
356a8c7c708Swdenk
3574f7cb08eSwdenk# Add GCC lib
35852b1bf2cSWolfgang Denkifdef USE_PRIVATE_LIBGCC
35952b1bf2cSWolfgang Denkifeq ("$(USE_PRIVATE_LIBGCC)", "yes")
360635d1b3eSMatthias WeisserPLATFORM_LIBGCC = $(OBJTREE)/arch/$(ARCH)/lib/libgcc.o
36152b1bf2cSWolfgang Denkelse
36252b1bf2cSWolfgang DenkPLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc
36352b1bf2cSWolfgang Denkendif
36452b1bf2cSWolfgang Denkelse
365cca4e4aeSWolfgang DenkPLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
36652b1bf2cSWolfgang Denkendif
36752b1bf2cSWolfgang DenkPLATFORM_LIBS += $(PLATFORM_LIBGCC)
36852b1bf2cSWolfgang Denkexport PLATFORM_LIBS
3693d3befa7Swdenk
3706ac9f479SMike Frysinger# Special flags for CPP when processing the linker script.
3716ac9f479SMike Frysinger# Pass the version down so we can handle backwards compatibility
3726ac9f479SMike Frysinger# on the fly.
3736ac9f479SMike FrysingerLDPPFLAGS += \
3746ac9f479SMike Frysinger	-include $(TOPDIR)/include/u-boot/u-boot.lds.h \
3757e6403a6SSimon Glass	-DCPUDIR=$(CPUDIR) \
3766ac9f479SMike Frysinger	$(shell $(LD) --version | \
3776ac9f479SMike Frysinger	  sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p')
3786ac9f479SMike Frysinger
379f9328639SMarian Balakowicz__OBJS := $(subst $(obj),,$(OBJS))
38008e39a84SMasahiro Yamada__LIBS := $(subst $(obj),,$(LIBS))
381f9328639SMarian Balakowicz
3827ebf7443Swdenk#########################################################################
383bdccc4feSwdenk#########################################################################
3847ebf7443Swdenk
385f3a14d37SMike Frysingerifneq ($(CONFIG_BOARD_SIZE_LIMIT),)
386f3a14d37SMike FrysingerBOARD_SIZE_CHECK = \
387f3a14d37SMike Frysinger	@actual=`wc -c $@ | awk '{print $$1}'`; \
388d060e6f4SJoe Hershberger	limit=`printf "%d" $(CONFIG_BOARD_SIZE_LIMIT)`; \
389f3a14d37SMike Frysinger	if test $$actual -gt $$limit; then \
390d060e6f4SJoe Hershberger		echo "$@ exceeds file size limit:" >&2 ; \
391d060e6f4SJoe Hershberger		echo "  limit:  $$limit bytes" >&2 ; \
392d060e6f4SJoe Hershberger		echo "  actual: $$actual bytes" >&2 ; \
393d060e6f4SJoe Hershberger		echo "  excess: $$((actual - limit)) bytes" >&2; \
394f3a14d37SMike Frysinger		exit 1; \
395f3a14d37SMike Frysinger	fi
396f3a14d37SMike Frysingerelse
397f3a14d37SMike FrysingerBOARD_SIZE_CHECK =
398f3a14d37SMike Frysingerendif
399f3a14d37SMike Frysinger
4008137af19SScott Wood# Statically apply RELA-style relocations (currently arm64 only)
4018137af19SScott Woodifneq ($(CONFIG_STATIC_RELA),)
4028137af19SScott Wood# $(1) is u-boot ELF, $(2) is u-boot bin, $(3) is text base
4038137af19SScott WoodDO_STATIC_RELA = \
4048137af19SScott Wood	start=$$($(NM) $(1) | grep __rel_dyn_start | cut -f 1 -d ' '); \
4058137af19SScott Wood	end=$$($(NM) $(1) | grep __rel_dyn_end | cut -f 1 -d ' '); \
4068137af19SScott Wood	$(obj)tools/relocate-rela $(2) $(3) $$start $$end
4078137af19SScott Woodelse
4088137af19SScott WoodDO_STATIC_RELA =
4098137af19SScott Woodendif
4108137af19SScott Wood
4113e88337bSMike Frysinger# Always append ALL so that arch config.mk's can add custom ones
4124e0fbb98SDaniel SchwierzeckALL-y += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map
413e935a374SHaiying Wang
4144e0fbb98SDaniel SchwierzeckALL-$(CONFIG_NAND_U_BOOT) += $(obj)u-boot-nand.bin
4154e0fbb98SDaniel SchwierzeckALL-$(CONFIG_ONENAND_U_BOOT) += $(obj)u-boot-onenand.bin
416262737f0SShaohui XieALL-$(CONFIG_RAMBOOT_PBL) += $(obj)u-boot.pbl
4175df2ee27SDaniel SchwierzeckALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin
4184c267374SHenrik NordströmALL-$(CONFIG_SPL_FRAMEWORK) += $(obj)u-boot.img
4193aa29de0SYing ZhangALL-$(CONFIG_TPL) += $(obj)tpl/u-boot-tpl.bin
4202c0f79e4SSimon GlassALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot-dtb.bin
421b343bbb5SVadim Bendeburyifneq ($(CONFIG_SPL_TARGET),)
422a8c07541SMasahiro YamadaALL-$(CONFIG_SPL) += $(obj)$(CONFIG_SPL_TARGET:"%"=%)
423b343bbb5SVadim Bendeburyendif
424f4dc714aSScott WoodALL-$(CONFIG_REMAKE_ELF) += $(obj)u-boot.elf
4257ebf7443Swdenk
42612b7b70cSAllen Martin# enable combined SPL/u-boot/dtb rules for tegra
4276d6c0baeSTom Warrenifneq ($(CONFIG_TEGRA),)
4287dcd3a21SVidya Sagarifeq ($(CONFIG_SPL),y)
42912b7b70cSAllen Martinifeq ($(CONFIG_OF_SEPARATE),y)
43012b7b70cSAllen MartinALL-y += $(obj)u-boot-dtb-tegra.bin
43112b7b70cSAllen Martinelse
43212b7b70cSAllen MartinALL-y += $(obj)u-boot-nodtb-tegra.bin
43312b7b70cSAllen Martinendif
43412b7b70cSAllen Martinendif
4357dcd3a21SVidya Sagarendif
43612b7b70cSAllen Martin
4378a7e7d56SMasahiro Yamadaall:		$(ALL-y) $(SUBDIR_EXAMPLES-y)
4387ebf7443Swdenk
439501ebdf2SStephen Warren$(obj)u-boot.dtb:	checkdtc $(obj)u-boot
440bcfe8fdfSMasahiro Yamada		$(MAKE) $(build) dts binary
4412c0f79e4SSimon Glass		mv $(obj)dts/dt.dtb $@
4422c0f79e4SSimon Glass
4432c0f79e4SSimon Glass$(obj)u-boot-dtb.bin:	$(obj)u-boot.bin $(obj)u-boot.dtb
4442c0f79e4SSimon Glass		cat $^ >$@
4452c0f79e4SSimon Glass
446f9328639SMarian Balakowicz$(obj)u-boot.hex:	$(obj)u-boot
4476310eb9dSwdenk		$(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
4486310eb9dSwdenk
449f9328639SMarian Balakowicz$(obj)u-boot.srec:	$(obj)u-boot
45047ed5dd0SAlbert ARIBAUD		$(OBJCOPY) ${OBJCFLAGS} -O srec $< $@
4517ebf7443Swdenk
452f9328639SMarian Balakowicz$(obj)u-boot.bin:	$(obj)u-boot
4537ebf7443Swdenk		$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
4548137af19SScott Wood		$(call DO_STATIC_RELA,$<,$@,$(CONFIG_SYS_TEXT_BASE))
455f3a14d37SMike Frysinger		$(BOARD_SIZE_CHECK)
4567ebf7443Swdenk
45794a91e24SMike Frysinger$(obj)u-boot.ldr:	$(obj)u-boot
45876d82187SMike Frysinger		$(CREATE_LDR_ENV)
45968e56324SMike Frysinger		$(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS)
460f3a14d37SMike Frysinger		$(BOARD_SIZE_CHECK)
46194a91e24SMike Frysinger
46294a91e24SMike Frysinger$(obj)u-boot.ldr.hex:	$(obj)u-boot.ldr
46394a91e24SMike Frysinger		$(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@ -I binary
46494a91e24SMike Frysinger
46594a91e24SMike Frysinger$(obj)u-boot.ldr.srec:	$(obj)u-boot.ldr
46694a91e24SMike Frysinger		$(OBJCOPY) ${OBJCFLAGS} -O srec $< $@ -I binary
46794a91e24SMike Frysinger
468b40bda6bSStefan Roese#
469b40bda6bSStefan Roese# U-Boot entry point, needed for booting of full-blown U-Boot
470b40bda6bSStefan Roese# from the SPL U-Boot version.
471b40bda6bSStefan Roese#
472b40bda6bSStefan Roeseifndef CONFIG_SYS_UBOOT_START
473b40bda6bSStefan RoeseCONFIG_SYS_UBOOT_START := 0
474b40bda6bSStefan Roeseendif
475b40bda6bSStefan Roese
476f9328639SMarian Balakowicz$(obj)u-boot.img:	$(obj)u-boot.bin
477a2a0a717SWolfgang Denk		$(obj)tools/mkimage -A $(ARCH) -T firmware -C none \
478b40bda6bSStefan Roese		-O u-boot -a $(CONFIG_SYS_TEXT_BASE) \
479b40bda6bSStefan Roese		-e $(CONFIG_SYS_UBOOT_START) \
480881a87ecSWolfgang Denk		-n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
481bdccc4feSwdenk			sed -e 's/"[	 ]*$$/ for $(BOARD) board"/') \
482bdccc4feSwdenk		-d $< $@
483bdccc4feSwdenk
484291b3dcdSOtavio Salvador$(obj)u-boot.imx: $(obj)u-boot.bin depend
48571f84ef0SMasahiro Yamada		$(MAKE) $(build) $(SRCTREE)/arch/arm/imx-common $(OBJTREE)/u-boot.imx
4868edcde5eSStefano Babic
487aa0c7a86SPrafulla Wadaskar$(obj)u-boot.kwb:       $(obj)u-boot.bin
48831d80c77SPrafulla Wadaskar		$(obj)tools/mkimage -n $(CONFIG_SYS_KWD_CONFIG) -T kwbimage \
4892ea88b06SEric Cooper		-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) -d $< $@
490aa0c7a86SPrafulla Wadaskar
4915d898a00SShaohui Xie$(obj)u-boot.pbl:	$(obj)u-boot.bin
492690e4258SPrabhakar Kushwaha		$(obj)tools/mkimage -n $(CONFIG_SYS_FSL_PBL_RCW) \
493690e4258SPrabhakar Kushwaha		-R $(CONFIG_SYS_FSL_PBL_PBI) -T pblimage \
4945d898a00SShaohui Xie		-d $< $@
4955d898a00SShaohui Xie
496566a494fSHeiko Schocher$(obj)u-boot.sha1:	$(obj)u-boot.bin
49701159530SHeiko Schocher		$(obj)tools/ubsha1 $(obj)u-boot.bin
498566a494fSHeiko Schocher
499f9328639SMarian Balakowicz$(obj)u-boot.dis:	$(obj)u-boot
5007ebf7443Swdenk		$(OBJDUMP) -d $< > $@
5017ebf7443Swdenk
5023aa29de0SYing Zhang# $@ is output, $(1) and $(2) are inputs, $(3) is padded intermediate,
5033aa29de0SYing Zhang# $(4) is pad-to
5043aa29de0SYing ZhangSPL_PAD_APPEND = \
5053aa29de0SYing Zhang		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(4) -I binary -O binary \
5063aa29de0SYing Zhang		$(1) $(obj)$(3); \
507b6df9b01SYork Sun		cat $(obj)$(3) $(2) > $@; \
5083aa29de0SYing Zhang		rm $(obj)$(3)
50974752baaSScott Wood
5103aa29de0SYing Zhangifdef CONFIG_TPL
5113aa29de0SYing ZhangSPL_PAYLOAD := $(obj)tpl/u-boot-with-tpl.bin
5123aa29de0SYing Zhangelse
5133aa29de0SYing ZhangSPL_PAYLOAD := $(obj)u-boot.bin
5143aa29de0SYing Zhangendif
51574752baaSScott Wood
5163aa29de0SYing Zhang$(obj)u-boot-with-spl.bin: $(obj)spl/u-boot-spl.bin $(SPL_PAYLOAD)
5173aa29de0SYing Zhang		$(call SPL_PAD_APPEND,$<,$(SPL_PAYLOAD),spl/u-boot-spl-pad.bin,$(CONFIG_SPL_PAD_TO))
5183aa29de0SYing Zhang
5193aa29de0SYing Zhang$(obj)tpl/u-boot-with-tpl.bin: $(obj)tpl/u-boot-tpl.bin $(obj)u-boot.bin
520b6df9b01SYork Sun		$(call SPL_PAD_APPEND,$<,$(obj)u-boot.bin,tpl/u-boot-tpl-pad.bin,$(CONFIG_TPL_PAD_TO))
5217816f2cfSHeiko Schocher
522ba597609SBenoît Thébaudeau$(obj)u-boot-with-spl.imx: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
52371f84ef0SMasahiro Yamada		$(MAKE) $(build) $(SRCTREE)/arch/arm/imx-common \
524ba597609SBenoît Thébaudeau			$(OBJTREE)/u-boot-with-spl.imx
525ba597609SBenoît Thébaudeau
5267d5a5c79SBenoît Thébaudeau$(obj)u-boot-with-nand-spl.imx: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
52771f84ef0SMasahiro Yamada		$(MAKE) $(build) $(SRCTREE)/arch/arm/imx-common \
5287d5a5c79SBenoît Thébaudeau			$(OBJTREE)/u-boot-with-nand-spl.imx
5297d5a5c79SBenoît Thébaudeau
5305364add4SScott Wood$(obj)u-boot.ubl:       $(obj)u-boot-with-spl.bin
531277f00f5SJosé Miguel Gonçalves		$(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \
5325364add4SScott Wood		-e $(CONFIG_SYS_TEXT_BASE) -d $< $(obj)u-boot.ubl
533277f00f5SJosé Miguel Gonçalves
5343f7f2414STom Rini$(obj)u-boot.ais:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.img
5356d660e77SSughosh Ganu		$(obj)tools/mkimage -s -n $(if $(CONFIG_AIS_CONFIG_FILE),$(CONFIG_AIS_CONFIG_FILE),"/dev/null") \
5366d660e77SSughosh Ganu			-T aisimage \
537d36d8859SChristian Riesch			-e $(CONFIG_SPL_TEXT_BASE) \
538d36d8859SChristian Riesch			-d $(obj)spl/u-boot-spl.bin \
539d36d8859SChristian Riesch			$(obj)spl/u-boot-spl.ais
540d36d8859SChristian Riesch		$(OBJCOPY) ${OBJCFLAGS} -I binary \
541d36d8859SChristian Riesch			--pad-to=$(CONFIG_SPL_MAX_SIZE) -O binary \
542d36d8859SChristian Riesch			$(obj)spl/u-boot-spl.ais $(obj)spl/u-boot-spl-pad.ais
5433f7f2414STom Rini		cat $(obj)spl/u-boot-spl-pad.ais $(obj)u-boot.img > \
544d36d8859SChristian Riesch			$(obj)u-boot.ais
545d36d8859SChristian Riesch
546a5453555SOtavio Salvador
54730b9b932SMarek Vasut$(obj)u-boot.sb:       $(obj)u-boot.bin $(obj)spl/u-boot-spl.bin
548edabc1bcSMasahiro Yamada		$(MAKE) $(build) $(SRCTREE)/$(CPUDIR)/$(SOC)/ $(OBJTREE)/u-boot.sb
54930b9b932SMarek Vasut
55094aebe6cSStefan Roese# On x600 (SPEAr600) U-Boot is appended to U-Boot SPL.
55194aebe6cSStefan Roese# Both images are created using mkimage (crc etc), so that the ROM
55294aebe6cSStefan Roese# bootloader can check its integrity. Padding needs to be done to the
55394aebe6cSStefan Roese# SPL image (with mkimage header) and not the binary. Otherwise the resulting image
55494aebe6cSStefan Roese# which is loaded/copied by the ROM bootloader to SRAM doesn't fit.
55594aebe6cSStefan Roese# The resulting image containing both U-Boot images is called u-boot.spr
55694aebe6cSStefan Roese$(obj)u-boot.spr:	$(obj)u-boot.img $(obj)spl/u-boot-spl.bin
55794aebe6cSStefan Roese		$(obj)tools/mkimage -A $(ARCH) -T firmware -C none \
55894aebe6cSStefan Roese		-a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n XLOADER \
55957270260SMasahiro Yamada		-d $(obj)spl/u-boot-spl.bin $@
56057270260SMasahiro Yamada		$(OBJCOPY) -I binary -O binary \
56157270260SMasahiro Yamada			--pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff $@
56257270260SMasahiro Yamada		cat $(obj)u-boot.img >> $@
56394aebe6cSStefan Roese
5646d6c0baeSTom Warrenifneq ($(CONFIG_TEGRA),)
5659972db5cSStephen Warren$(obj)u-boot-nodtb-tegra.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
566e4ec9346SStephen Warren		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SYS_TEXT_BASE) -O binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin
5679972db5cSStephen Warren		cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > $@
568e4ec9346SStephen Warren		rm $(obj)spl/u-boot-spl-pad.bin
5699972db5cSStephen Warren
5709972db5cSStephen Warrenifeq ($(CONFIG_OF_SEPARATE),y)
5719972db5cSStephen Warren$(obj)u-boot-dtb-tegra.bin: $(obj)u-boot-nodtb-tegra.bin $(obj)u-boot.dtb
5729972db5cSStephen Warren		cat $(obj)u-boot-nodtb-tegra.bin $(obj)u-boot.dtb > $@
5739972db5cSStephen Warrenendif
574984df4ecSAllen Martinendif
575984df4ecSAllen Martin
576fb3d2b8aSStefan Roese$(obj)u-boot-img.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.img
577fb3d2b8aSStefan Roese		cat $(obj)spl/u-boot-spl.bin $(obj)u-boot.img > $@
578fb3d2b8aSStefan Roese
579ecddccd0SStefan Roese# PPC4xx needs the SPL at the end of the image, since the reset vector
580ecddccd0SStefan Roese# is located at 0xfffffffc. So we can't use the "u-boot-img.bin" target
581ecddccd0SStefan Roese# and need to introduce a new build target with the full blown U-Boot
582ecddccd0SStefan Roese# at the start padded up to the start of the SPL image. And then concat
583ecddccd0SStefan Roese# the SPL image to the end.
584ecddccd0SStefan Roese$(obj)u-boot-img-spl-at-end.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.img
58557270260SMasahiro Yamada		$(OBJCOPY) -I binary -O binary --pad-to=$(CONFIG_UBOOT_PAD_TO) \
58657270260SMasahiro Yamada			 --gap-fill=0xff $(obj)u-boot.img $@
58757270260SMasahiro Yamada		cat $(obj)spl/u-boot-spl.bin >> $@
588ecddccd0SStefan Roese
589f4dc714aSScott Wood# Create a new ELF from a raw binary file.  This is useful for arm64
590f4dc714aSScott Wood# where static relocation needs to be performed on the raw binary,
591f4dc714aSScott Wood# but certain simulators only accept an ELF file (but don't do the
592f4dc714aSScott Wood# relocation).
593f4dc714aSScott Wood# FIXME refactor dts/Makefile to share target/arch detection
594f4dc714aSScott Wood$(obj)u-boot.elf: $(obj)u-boot.bin
595f4dc714aSScott Wood	@$(OBJCOPY)  -B aarch64 -I binary -O elf64-littleaarch64 \
596f4dc714aSScott Wood		$< $(obj)u-boot-elf.o
597f4dc714aSScott Wood	@$(LD) $(obj)u-boot-elf.o -o $@ \
598f4dc714aSScott Wood		--defsym=_start=$(CONFIG_SYS_TEXT_BASE) \
599f4dc714aSScott Wood		-Ttext=$(CONFIG_SYS_TEXT_BASE)
600f4dc714aSScott Wood
60186eb49b3SSimon Glassifeq ($(CONFIG_SANDBOX),y)
60286eb49b3SSimon GlassGEN_UBOOT = \
60386eb49b3SSimon Glass		cd $(LNDIR) && $(CC) $(SYMS) -T $(obj)u-boot.lds \
60486eb49b3SSimon Glass			-Wl,--start-group $(__LIBS) -Wl,--end-group \
60586eb49b3SSimon Glass			$(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot.map -o u-boot
60686eb49b3SSimon Glasselse
607ecb1dc89SMike FrysingerGEN_UBOOT = \
60897b24d3dSMarek Vasut		cd $(LNDIR) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \
609ef123c52SAlbert ARIBAUD			$(__OBJS) \
610f9328639SMarian Balakowicz			--start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
611b2184c31Swdenk			-Map u-boot.map -o u-boot
61286eb49b3SSimon Glassendif
61386eb49b3SSimon Glass
61416a354f9SWolfgang Denk$(obj)u-boot:	depend \
6158e9a6cb1SMasahiro Yamada		$(SUBDIR_TOOLS) $(OBJS) $(LIBS) $(obj)u-boot.lds
616ecb1dc89SMike Frysinger		$(GEN_UBOOT)
617ecb1dc89SMike Frysingerifeq ($(CONFIG_KALLSYMS),y)
6188a156fb6SMike Frysinger		smap=`$(call SYSTEM_MAP,$(obj)u-boot) | \
6191aada9cdSWolfgang Denk			awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 "\\\\000"}'` ; \
6201aada9cdSWolfgang Denk		$(CC) $(CFLAGS) -DSYSTEM_MAP="\"$${smap}\"" \
6211aada9cdSWolfgang Denk			-c common/system_map.c -o $(obj)common/system_map.o
622ecb1dc89SMike Frysinger		$(GEN_UBOOT) $(obj)common/system_map.o
623ecb1dc89SMike Frysingerendif
6247ebf7443Swdenk
6253bddafaaSMasahiro Yamada$(OBJS):
6263bddafaaSMasahiro Yamada	@:
627f9328639SMarian Balakowicz
628349e83f0SChe-liang Chiou$(LIBS):	depend $(SUBDIR_TOOLS)
6293bddafaaSMasahiro Yamada		$(MAKE) $(build) $(dir $(subst $(obj),,$@))
630a8c7c708Swdenk
6314a20df39SMasahiro Yamada$(SUBDIRS):	depend
632940db16dSMasahiro Yamada		$(MAKE) $(build) $@ all
633940db16dSMasahiro Yamada
6348a7e7d56SMasahiro Yamada$(SUBDIR_EXAMPLES-y): $(obj)u-boot
635349e83f0SChe-liang Chiou
6368e9a6cb1SMasahiro Yamada$(obj)u-boot.lds: $(LDSCRIPT) depend
63797b24d3dSMarek Vasut		$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$< >$@
6381aada9cdSWolfgang Denk
639e935a374SHaiying Wangnand_spl:	$(TIMESTAMP_FILE) $(VERSION_FILE) depend
640a0b14c3fSMasahiro Yamada		$(MAKE) $(build) nand_spl/board/$(BOARDDIR) all
641887e2ec9SStefan Roese
642e935a374SHaiying Wang$(obj)u-boot-nand.bin:	nand_spl $(obj)u-boot.bin
6438318fbf8SMarian Balakowicz		cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin
644887e2ec9SStefan Roese
645bd25fdbaSAneesh V$(obj)spl/u-boot-spl.bin:	$(SUBDIR_TOOLS) depend
6465df2ee27SDaniel Schwierzeck		$(MAKE) -C spl all
6475df2ee27SDaniel Schwierzeck
6483aa29de0SYing Zhang$(obj)tpl/u-boot-tpl.bin:	$(SUBDIR_TOOLS) depend
6493aa29de0SYing Zhang		$(MAKE) -C spl all CONFIG_TPL_BUILD=y
6503aa29de0SYing Zhang
6512a998793SDaniel Hobi# Explicitly make _depend in subdirs containing multiple targets to prevent
6522a998793SDaniel Hobi# parallel sub-makes creating .depend files simultaneously.
65316a354f9SWolfgang Denkdepend dep:	$(TIMESTAMP_FILE) $(VERSION_FILE) \
65439bc12ddSJoel Fernandes		$(obj)include/spl-autoconf.mk \
6553aa29de0SYing Zhang		$(obj)include/tpl-autoconf.mk \
65616a354f9SWolfgang Denk		$(obj)include/autoconf.mk \
657a4814a69SStefano Babic		$(obj)include/generated/generic-asm-offsets.h \
658a4814a69SStefano Babic		$(obj)include/generated/asm-offsets.h
6597ebf7443Swdenk
660e5e4e705SLi YangTAG_SUBDIRS = $(SUBDIRS)
661e5e4e705SLi YangTAG_SUBDIRS += $(dir $(__LIBS))
662a340c325SJean-Christophe PLAGNIOL-VILLARDTAG_SUBDIRS += include
663a340c325SJean-Christophe PLAGNIOL-VILLARD
664857d9ea6SHorst KronstorferFIND := find
665857d9ea6SHorst KronstorferFINDFLAGS := -L
666857d9ea6SHorst Kronstorfer
6671064d980STom Rinicheckstack:
6681064d980STom Rini		$(CROSS_COMPILE)objdump -d $(obj)u-boot \
6691064d980STom Rini			`$(FIND) $(obj) -name u-boot-spl -print` | \
670dd88ab32SMasahiro Yamada			perl $(src)scripts/checkstack.pl $(ARCH)
6711064d980STom Rini
672f9328639SMarian Balakowicztags ctags:
673857d9ea6SHorst Kronstorfer		ctags -w -o $(obj)ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
674e5e4e705SLi Yang						-name '*.[chS]' -print`
6757ebf7443Swdenk
6767ebf7443Swdenketags:
677857d9ea6SHorst Kronstorfer		etags -a -o $(obj)etags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
678e5e4e705SLi Yang						-name '*.[chS]' -print`
679ffda586fSLi Yangcscope:
680857d9ea6SHorst Kronstorfer		$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) -name '*.[chS]' -print > \
681857d9ea6SHorst Kronstorfer						cscope.files
682ffda586fSLi Yang		cscope -b -q -k
6837ebf7443Swdenk
684ecb1dc89SMike FrysingerSYSTEM_MAP = \
685ecb1dc89SMike Frysinger		$(NM) $1 | \
6867ebf7443Swdenk		grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
687ecb1dc89SMike Frysinger		LC_ALL=C sort
688ecb1dc89SMike Frysinger$(obj)System.map:	$(obj)u-boot
689bc8bb6ecSMasahiro Yamada		@$(call SYSTEM_MAP,$<) > $@
6907ebf7443Swdenk
69106a119a0STom Rinicheckthumb:
69206a119a0STom Rini	@if test $(call cc-version) -lt 0404; then \
69306a119a0STom Rini		echo -n '*** Your GCC does not produce working '; \
69406a119a0STom Rini		echo 'binaries in THUMB mode.'; \
69506a119a0STom Rini		echo '*** Your board is configured for THUMB mode.'; \
69606a119a0STom Rini		false; \
69706a119a0STom Rini	fi
6986ec63f41SScott Wood
6996ec63f41SScott Wood# GCC 3.x is reported to have problems generating the type of relocation
7006ec63f41SScott Wood# that U-Boot wants.
7016ec63f41SScott Wood# See http://lists.denx.de/pipermail/u-boot/2012-September/135156.html
7026ec63f41SScott Woodcheckgcc4:
7036ec63f41SScott Wood	@if test $(call cc-version) -lt 0400; then \
7046ec63f41SScott Wood		echo -n '*** Your GCC is too old, please upgrade to GCC 4.x or newer'; \
7056ec63f41SScott Wood		false; \
7066ec63f41SScott Wood	fi
7076ec63f41SScott Wood
708501ebdf2SStephen Warrencheckdtc:
709501ebdf2SStephen Warren	@if test $(call dtc-version) -lt 0104; then \
710501ebdf2SStephen Warren		echo '*** Your dtc is too old, please upgrade to dtc 1.4 or newer'; \
711501ebdf2SStephen Warren		false; \
712501ebdf2SStephen Warren	fi
713501ebdf2SStephen Warren
7142f155f6cSGrant Likely#
7152f155f6cSGrant Likely# Auto-generate the autoconf.mk file (which is included by all makefiles)
7162f155f6cSGrant Likely#
7172f155f6cSGrant Likely# This target actually generates 2 files; autoconf.mk and autoconf.mk.dep.
7182f155f6cSGrant Likely# the dep file is only include in this top level makefile to determine when
7192f155f6cSGrant Likely# to regenerate the autoconf.mk file.
7201510b82dSWolfgang Denk$(obj)include/autoconf.mk.dep: $(obj)include/config.h include/common.h
7211510b82dSWolfgang Denk	@$(XECHO) Generating $@ ; \
722ae6d1056SWolfgang Denk	: Generate the dependancies ; \
7234c34b2a0SMike Frysinger	$(CC) -x c -DDO_DEPS_ONLY -M $(CFLAGS) $(CPPFLAGS) \
72465947ab4SMasahiro Yamada		-MQ $(obj)include/autoconf.mk include/common.h > $@ || \
72565947ab4SMasahiro Yamada		rm $@
7261510b82dSWolfgang Denk
7271510b82dSWolfgang Denk$(obj)include/autoconf.mk: $(obj)include/config.h
7281510b82dSWolfgang Denk	@$(XECHO) Generating $@ ; \
729ae6d1056SWolfgang Denk	: Extract the config macros ; \
73065947ab4SMasahiro Yamada	$(CPP) $(CFLAGS) -DDO_DEPS_ONLY -dM include/common.h > $@.tmp && \
73165947ab4SMasahiro Yamada		sed -n -f tools/scripts/define2mk.sed $@.tmp > $@; \
73265947ab4SMasahiro Yamada	rm $@.tmp
7332f155f6cSGrant Likely
73439bc12ddSJoel Fernandes# Auto-generate the spl-autoconf.mk file (which is included by all makefiles for SPL)
7353aa29de0SYing Zhang$(obj)include/tpl-autoconf.mk: $(obj)include/config.h
7363aa29de0SYing Zhang	@$(XECHO) Generating $@ ; \
7373aa29de0SYing Zhang	: Extract the config macros ; \
7383aa29de0SYing Zhang	$(CPP) $(CFLAGS) -DCONFIG_TPL_BUILD  -DCONFIG_SPL_BUILD\
73965947ab4SMasahiro Yamada			-DDO_DEPS_ONLY -dM include/common.h > $@.tmp && \
74065947ab4SMasahiro Yamada		sed -n -f tools/scripts/define2mk.sed $@.tmp > $@; \
74165947ab4SMasahiro Yamada	rm $@.tmp
7423aa29de0SYing Zhang
74339bc12ddSJoel Fernandes$(obj)include/spl-autoconf.mk: $(obj)include/config.h
74439bc12ddSJoel Fernandes	@$(XECHO) Generating $@ ; \
74539bc12ddSJoel Fernandes	: Extract the config macros ; \
74665947ab4SMasahiro Yamada	$(CPP) $(CFLAGS) -DCONFIG_SPL_BUILD -DDO_DEPS_ONLY -dM include/common.h > $@.tmp && \
74765947ab4SMasahiro Yamada		sed -n -f tools/scripts/define2mk.sed $@.tmp > $@; \
74865947ab4SMasahiro Yamada	rm $@.tmp
74939bc12ddSJoel Fernandes
75074c43bb3SMasahiro Yamada$(obj)include/generated/generic-asm-offsets.h: $(obj)lib/asm-offsets.s
75116a354f9SWolfgang Denk	@$(XECHO) Generating $@
75216a354f9SWolfgang Denk	tools/scripts/make-asm-offsets $(obj)lib/asm-offsets.s $@
75316a354f9SWolfgang Denk
75474c43bb3SMasahiro Yamada$(obj)lib/asm-offsets.s: $(obj)include/config.h $(src)lib/asm-offsets.c
75516a354f9SWolfgang Denk	@mkdir -p $(obj)lib
75616a354f9SWolfgang Denk	$(CC) -DDO_DEPS_ONLY \
75716a354f9SWolfgang Denk		$(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
75816a354f9SWolfgang Denk		-o $@ $(src)lib/asm-offsets.c -c -S
75916a354f9SWolfgang Denk
76074c43bb3SMasahiro Yamada$(obj)include/generated/asm-offsets.h: $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s
761b12734eeSWolfgang Denk	@$(XECHO) Generating $@
762a4814a69SStefano Babic	tools/scripts/make-asm-offsets $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s $@
763a4814a69SStefano Babic
76474c43bb3SMasahiro Yamada$(obj)$(CPUDIR)/$(SOC)/asm-offsets.s: $(obj)include/config.h
765a4814a69SStefano Babic	@mkdir -p $(obj)$(CPUDIR)/$(SOC)
766a4814a69SStefano Babic	if [ -f $(src)$(CPUDIR)/$(SOC)/asm-offsets.c ];then \
767a4814a69SStefano Babic		$(CC) -DDO_DEPS_ONLY \
768a4814a69SStefano Babic		$(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
769a4814a69SStefano Babic			-o $@ $(src)$(CPUDIR)/$(SOC)/asm-offsets.c -c -S; \
770a4814a69SStefano Babic	else \
771a4814a69SStefano Babic		touch $@; \
772a4814a69SStefano Babic	fi
773a4814a69SStefano Babic
7747ebf7443Swdenk#########################################################################
775ae6d1056SWolfgang Denkelse	# !config.mk
776f9328639SMarian Balakowiczall $(obj)u-boot.hex $(obj)u-boot.srec $(obj)u-boot.bin \
777f9328639SMarian Balakowicz$(obj)u-boot.img $(obj)u-boot.dis $(obj)u-boot \
778249b53a6SLoïc Minier$(filter-out tools,$(SUBDIRS)) \
7792e78e75eSMasahiro Yamadadepend dep tags ctags etags cscope $(obj)System.map:
7807ebf7443Swdenk	@echo "System not configured - see README" >&2
7817ebf7443Swdenk	@ exit 1
782c7c0d542SMike Frysinger
783249b53a6SLoïc Miniertools: $(VERSION_FILE) $(TIMESTAMP_FILE)
784940db16dSMasahiro Yamada	$(MAKE) $(build) $@ all
785ae6d1056SWolfgang Denkendif	# config.mk
7867ebf7443Swdenk
78754799e45SScott Wood# ARM relocations should all be R_ARM_RELATIVE (32-bit) or
78854799e45SScott Wood# R_AARCH64_RELATIVE (64-bit).
789c37980c3SAlbert ARIBAUDcheckarmreloc: $(obj)u-boot
79054799e45SScott Wood	@RELOC="`$(CROSS_COMPILE)readelf -r -W $< | cut -d ' ' -f 4 | \
79154799e45SScott Wood		grep R_A | sort -u`"; \
79254799e45SScott Wood	if test "$$RELOC" != "R_ARM_RELATIVE" -a \
79354799e45SScott Wood		 "$$RELOC" != "R_AARCH64_RELATIVE"; then \
79454799e45SScott Wood		echo "$< contains unexpected relocations: $$RELOC"; \
79554799e45SScott Wood		false; \
79654799e45SScott Wood	fi
797c37980c3SAlbert ARIBAUD
79828abd48fSIlya Yanok$(VERSION_FILE):
79914ce91b1SMike Frysinger		@mkdir -p $(dir $(VERSION_FILE))
800dd88ab32SMasahiro Yamada		@( localvers='$(shell $(TOPDIR)/scripts/setlocalversion $(TOPDIR))' ; \
80128abd48fSIlya Yanok		   printf '#define PLAIN_VERSION "%s%s"\n' \
80228abd48fSIlya Yanok			"$(U_BOOT_VERSION)" "$${localvers}" ; \
80328abd48fSIlya Yanok		   printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' \
80428abd48fSIlya Yanok			"$(U_BOOT_VERSION)" "$${localvers}" ; \
80528abd48fSIlya Yanok		) > $@.tmp
80628abd48fSIlya Yanok		@( printf '#define CC_VERSION_STRING "%s"\n' \
80728abd48fSIlya Yanok		 '$(shell $(CC) --version | head -n 1)' )>>  $@.tmp
80828abd48fSIlya Yanok		@( printf '#define LD_VERSION_STRING "%s"\n' \
80928abd48fSIlya Yanok		 '$(shell $(LD) -v | head -n 1)' )>>  $@.tmp
81028abd48fSIlya Yanok		@cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
81128abd48fSIlya Yanok
812249b53a6SLoïc Minier$(TIMESTAMP_FILE):
813249b53a6SLoïc Minier		@mkdir -p $(dir $(TIMESTAMP_FILE))
814a76406fbSLoïc Minier		@LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > $@.tmp
815a76406fbSLoïc Minier		@LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> $@.tmp
816a76406fbSLoïc Minier		@cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
817249b53a6SLoïc Minier
8180358df42SMike Frysingereasylogo env gdb:
819940db16dSMasahiro Yamada	$(MAKE) $(build) tools/$@ MTD_VERSION=${MTD_VERSION}
820940db16dSMasahiro Yamada
8210358df42SMike Frysingergdbtools: gdb
8220358df42SMike Frysinger
82330ff8918SMarek Vasutxmldocs pdfdocs psdocs htmldocs mandocs: tools/kernel-doc/docproc
82430ff8918SMarek Vasut	$(MAKE) U_BOOT_VERSION=$(U_BOOT_VERSION) -C doc/DocBook/ $@
82530ff8918SMarek Vasut
826249b53a6SLoïc Miniertools-all: easylogo env gdb $(VERSION_FILE) $(TIMESTAMP_FILE)
827940db16dSMasahiro Yamada	$(MAKE) $(build) tools HOST_TOOLS_ALL=y
8280358df42SMike Frysinger
8294e53a258SWolfgang Denk.PHONY : CHANGELOG
8304e53a258SWolfgang DenkCHANGELOG:
831b985b5d6SBen Warren	git log --no-merges U-Boot-1_1_5.. | \
832b985b5d6SBen Warren	unexpand -a | sed -e 's/\s\s*$$//' > $@
8334e53a258SWolfgang Denk
8340a823aa2SHarald Welteinclude/license.h: tools/bin2header COPYING
8350a823aa2SHarald Welte	cat COPYING | gzip -9 -c | ./tools/bin2header license_gzip > include/license.h
8367ebf7443Swdenk#########################################################################
8377ebf7443Swdenk
8387ebf7443Swdenkunconfig:
839887e2ec9SStefan Roese	@rm -f $(obj)include/config.h $(obj)include/config.mk \
8402f155f6cSGrant Likely		$(obj)board/*/config.tmp $(obj)board/*/*/config.tmp \
84139bc12ddSJoel Fernandes		$(obj)include/autoconf.mk $(obj)include/autoconf.mk.dep \
8423aa29de0SYing Zhang		$(obj)include/spl-autoconf.mk \
8433aa29de0SYing Zhang		$(obj)include/tpl-autoconf.mk
8447ebf7443Swdenk
845a6862bc1SWolfgang Denk%_config::	unconfig
846a6862bc1SWolfgang Denk	@$(MKCONFIG) -A $(@:_config=)
847a6862bc1SWolfgang Denk
848d6a5e6d5SLoïc Miniersinclude $(obj).boards.depend
849d6a5e6d5SLoïc Minier$(obj).boards.depend:	boards.cfg
85050c2a91bSMasahiro Yamada	@awk '(NF && $$1 !~ /^#/) { print $$7 ": " $$7 "_config; $$(MAKE)" }' $< > $@
8519f4a4206SMike Frysinger
852699f0512SWolfgang Denk#########################################################################
8533e38691eSwdenk#########################################################################
8547ebf7443Swdenk
8557ebf7443Swdenkclean:
856aaed2eb5SMasahiro Yamada	@rm -f $(obj)examples/standalone/atmel_df_pow2			  \
8571bc15386SPeter Tyser	       $(obj)examples/standalone/hello_world			  \
8581bc15386SPeter Tyser	       $(obj)examples/standalone/interrupt			  \
8591bc15386SPeter Tyser	       $(obj)examples/standalone/mem_to_mem_idma2intr		  \
8601bc15386SPeter Tyser	       $(obj)examples/standalone/sched				  \
861f6322eb7SMasahiro Yamada	       $(addprefix $(obj)examples/standalone/, smc91111_eeprom smc911x_eeprom) \
8621bc15386SPeter Tyser	       $(obj)examples/standalone/test_burst			  \
8631bc15386SPeter Tyser	       $(obj)examples/standalone/timer
864f6322eb7SMasahiro Yamada	@rm -f $(addprefix $(obj)examples/api/, demo demo.bin)
865f9301e1cSWolfgang Denk	@rm -f $(obj)tools/bmp_logo	   $(obj)tools/easylogo/easylogo  \
866475c506dSMasahiro Yamada	       $(obj)tools/env/fw_printenv				  \
867f9301e1cSWolfgang Denk	       $(obj)tools/envcrc					  \
868f6322eb7SMasahiro Yamada	       $(addprefix $(obj)tools/gdb/, gdbcont gdbsend)		  \
869f9301e1cSWolfgang Denk	       $(obj)tools/gen_eth_addr    $(obj)tools/img2srec		  \
870f6322eb7SMasahiro Yamada	       $(obj)tools/dumpimage					  \
871f6322eb7SMasahiro Yamada	       $(addprefix $(obj)tools/, mkenvimage mkimage)		  \
872f6322eb7SMasahiro Yamada	       $(obj)tools/mpc86x_clk					  \
873f6322eb7SMasahiro Yamada	       $(addprefix $(obj)tools/, mk$(BOARD)spl mkexynosspl)	  \
8748aa09026SMarek Vasut	       $(obj)tools/mxsboot					  \
87530ff8918SMarek Vasut	       $(obj)tools/ncb		   $(obj)tools/ubsha1		  \
8766c887b2aSSimon Glass	       $(obj)tools/kernel-doc/docproc				  \
8776c887b2aSSimon Glass	       $(obj)tools/proftool
878f6322eb7SMasahiro Yamada	@rm -f $(addprefix $(obj)board/cray/L1/, bootscript.c bootscript.image) \
87974c7a95fSWolfgang Denk	       $(obj)board/matrix_vision/*/bootscript.img		  \
880e183a174SMasahiro Yamada	       $(obj)spl/board/samsung/$(BOARD)/tools/mk$(BOARD)spl	  \
8811aada9cdSWolfgang Denk	       $(obj)u-boot.lds						  \
882f6322eb7SMasahiro Yamada	       $(addprefix $(obj)arch/blackfin/cpu/, init.lds init.elf)
883dc7746d8SWolfgang Denk	@rm -f $(obj)include/bmp_logo.h
884c270730fSChe-Liang Chiou	@rm -f $(obj)include/bmp_logo_data.h
88516a354f9SWolfgang Denk	@rm -f $(obj)lib/asm-offsets.s
886a4814a69SStefano Babic	@rm -f $(obj)include/generated/asm-offsets.h
887a4814a69SStefano Babic	@rm -f $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s
888d4abc757SPeter Tyser	@rm -f $(TIMESTAMP_FILE) $(VERSION_FILE)
889b3141fdbSAndreas Bießmann	@$(MAKE) -s -C doc/DocBook/ cleandocs
890ae6d1056SWolfgang Denk	@find $(OBJTREE) -type f \
8914a30f1e8STom Rini		\( -name 'core' -o -name '*.bak' -o -name '*~' -o -name '*.su' \
89271a988aaSTroy Kisky		-o -name '*.o'	-o -name '*.a' -o -name '*.exe' \
89371a988aaSTroy Kisky		-o -name '*.cfgtmp' \) -print \
8947ebf7443Swdenk		| xargs rm -f
8957ebf7443Swdenk
896734329f9SAndy Fleming# Removes everything not needed for testing u-boot
897734329f9SAndy Flemingtidy:	clean
898734329f9SAndy Fleming	@find $(OBJTREE) -type f \( -name '*.depend*' \) -print | xargs rm -f
899734329f9SAndy Fleming
900734329f9SAndy Flemingclobber:	tidy
901734329f9SAndy Fleming	@find $(OBJTREE) -type f \( -name '*.srec' \
902734329f9SAndy Fleming		-o -name '*.bin' -o -name u-boot.img \) \
903734329f9SAndy Fleming		-print0 | xargs -0 rm -f
904ffda586fSLi Yang	@rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS \
9055013c09fSWolfgang Denk		$(obj)cscope.* $(obj)*.*~
9064e0fbb98SDaniel Schwierzeck	@rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL-y)
907aa0c7a86SPrafulla Wadaskar	@rm -f $(obj)u-boot.kwb
9085d898a00SShaohui Xie	@rm -f $(obj)u-boot.pbl
909c5fb70c9SStefano Babic	@rm -f $(obj)u-boot.imx
910ba597609SBenoît Thébaudeau	@rm -f $(obj)u-boot-with-spl.imx
9117d5a5c79SBenoît Thébaudeau	@rm -f $(obj)u-boot-with-nand-spl.imx
9127816f2cfSHeiko Schocher	@rm -f $(obj)u-boot.ubl
913d36d8859SChristian Riesch	@rm -f $(obj)u-boot.ais
914bbb0b128SSimon Glass	@rm -f $(obj)u-boot.dtb
91530b9b932SMarek Vasut	@rm -f $(obj)u-boot.sb
91694aebe6cSStefan Roese	@rm -f $(obj)u-boot.spr
917f6322eb7SMasahiro Yamada	@rm -f $(addprefix $(obj)nand_spl/, u-boot.lds u-boot.lst System.map)
918f6322eb7SMasahiro Yamada	@rm -f $(addprefix $(obj)nand_spl/, u-boot-nand_spl.lds u-boot-spl u-boot-spl.map)
919f6322eb7SMasahiro Yamada	@rm -f $(addprefix $(obj)spl/, u-boot-spl u-boot-spl.bin u-boot-spl.map)
920ef123c52SAlbert ARIBAUD	@rm -f $(obj)spl/u-boot-spl.lds
921f6322eb7SMasahiro Yamada	@rm -f $(addprefix $(obj)tpl/, u-boot-tpl u-boot-tpl.bin u-boot-tpl.map)
9223aa29de0SYing Zhang	@rm -f $(obj)tpl/u-boot-spl.lds
92394bcfe52SNishanth Menon	@rm -f $(obj)MLO MLO.byteswap
924a3cbc396SStefano Babic	@rm -f $(obj)SPL
9258b425b3fSDaniel Schwierzeck	@rm -f $(obj)tools/xway-swap-bytes
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
930f6322eb7SMasahiro Yamada	@rm -f $(addprefix $(obj)spl/, u-boot-spl.ais, 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