]> git.ipfire.org Git - people/ms/u-boot.git/blame - Makefile
kbuild: import more build scripts from Linux v3.13 tag
[people/ms/u-boot.git] / Makefile
CommitLineData
7ebf7443 1#
eca3aeb3 2# (C) Copyright 2000-2013
7ebf7443
WD
3# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4#
eca3aeb3 5# SPDX-License-Identifier: GPL-2.0+
7ebf7443
WD
6#
7
d19ad726
TR
8VERSION = 2014
9PATCHLEVEL = 01
211e4754 10SUBLEVEL =
b44bd2c7 11EXTRAVERSION =
8b9e4787 12ifneq "$(SUBLEVEL)" ""
881a87ec 13U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
8b9e4787
WD
14else
15U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL)$(EXTRAVERSION)
16endif
9e414032
MY
17TIMESTAMP_FILE = include/generated/timestamp_autogenerated.h
18VERSION_FILE = include/generated/version_autogenerated.h
881a87ec 19
7ebf7443 20HOSTARCH := $(shell uname -m | \
fea25720 21 sed -e s/i.86/x86/ \
7ebf7443
WD
22 -e s/sun4u/sparc64/ \
23 -e s/arm.*/arm/ \
24 -e s/sa110/arm/ \
d0179083
KG
25 -e s/ppc64/powerpc/ \
26 -e s/ppc/powerpc/ \
8d1f6355
NI
27 -e s/macppc/powerpc/\
28 -e s/sh.*/sh/)
7ebf7443 29
f9d77ed3 30HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
7ebf7443
WD
31 sed -e 's/\(cygwin\).*/cygwin/')
32
120ae609 33export HOSTARCH HOSTOS
7ebf7443
WD
34
35# Deal with colliding definitions from tcsh etc.
36VENDOR=
37
ae6d1056
WD
38#########################################################################
39# Allow for silent builds
40ifeq (,$(findstring s,$(MAKEFLAGS)))
41XECHO = echo
42else
43XECHO = :
44endif
45
9e414032
MY
46# kbuild supports saving output files in a separate directory.
47# To locate output files in a separate directory two syntaxes are supported.
48# In both cases the working directory must be the root of the kernel src.
49# 1) O=
50# Use "make O=dir/to/store/output/files/"
887e2ec9 51#
9e414032
MY
52# 2) Set KBUILD_OUTPUT
53# Set the environment variable KBUILD_OUTPUT to point to the directory
54# where the output files shall be placed.
55# export KBUILD_OUTPUT=dir/to/store/output/files/
56# make
887e2ec9 57#
9e414032
MY
58# The O= assignment takes precedence over the KBUILD_OUTPUT environment
59# variable.
60
61
62# KBUILD_SRC is set on invocation of make in OBJ directory
63# KBUILD_SRC is not intended to be used by the regular user (for now)
64ifeq ($(KBUILD_SRC),)
f9328639 65
9e414032
MY
66# OK, Make called in directory where kernel src resides
67# Do we want to locate output files in a separate directory?
f9328639 68ifeq ("$(origin O)", "command line")
9e414032
MY
69 KBUILD_OUTPUT := $(O)
70endif
71
72ifeq ("$(origin W)", "command line")
73 export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W)
f9328639 74endif
f9328639 75
9e414032
MY
76# That's our default target when none is given on the command line
77PHONY := _all
78_all:
79
80# Cancel implicit rules on top Makefile
81$(CURDIR)/Makefile Makefile: ;
82
83ifneq ($(KBUILD_OUTPUT),)
84# Invoke a second make in the output directory, passing relevant variables
85# check that the output directory actually exists
86saved-output := $(KBUILD_OUTPUT)
87KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
88$(if $(KBUILD_OUTPUT),, \
89 $(error output directory "$(saved-output)" does not exist))
90
91PHONY += $(MAKECMDGOALS) sub-make
92
93$(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
94 @:
95
96sub-make: FORCE
97 $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \
98 KBUILD_SRC=$(CURDIR) \
99 KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile \
100 $(filter-out _all sub-make,$(MAKECMDGOALS))
101
102# Leave processing to above invocation of make
103skip-makefile := 1
104endif # ifneq ($(KBUILD_OUTPUT),)
105endif # ifeq ($(KBUILD_SRC),)
106
107# We process the rest of the Makefile if this is the final invocation of make
108ifeq ($(skip-makefile),)
109
110PHONY += all
111_all: all
112
113srctree := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR))
114objtree := $(CURDIR)
115src := $(srctree)
116obj := $(objtree)
117
118VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD))
119
120export srctree objtree VPATH
121
4ab64933
KP
122# Call a source code checker (by default, "sparse") as part of the
123# C compilation.
124#
125# Use 'make C=1' to enable checking of re-compiled files.
126#
127# See the linux kernel file "Documentation/sparse.txt" for more details,
128# including where to get the "sparse" utility.
129
130ifdef C
131ifeq ("$(origin C)", "command line")
132CHECKSRC := $(C)
133endif
134endif
135ifndef CHECKSRC
136 CHECKSRC = 0
137endif
138export CHECKSRC
139
9e414032 140OBJTREE := $(objtree)
c8f9c302 141SPLTREE := $(OBJTREE)/spl
3aa29de0 142TPLTREE := $(OBJTREE)/tpl
9e414032 143SRCTREE := $(srctree)
f9328639 144TOPDIR := $(SRCTREE)
9e414032 145export TOPDIR SRCTREE OBJTREE SPLTREE TPLTREE
f9328639
MB
146
147MKCONFIG := $(SRCTREE)/mkconfig
148export MKCONFIG
7ebf7443 149
5013c09f
WD
150# Make sure CDPATH settings don't interfere
151unexport CDPATH
152
7ebf7443
WD
153#########################################################################
154
6d1ce387
MF
155# The "tools" are needed early, so put this first
156# Don't include stuff already done in $(LIBS)
349e83f0
CC
157# The "examples" conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC
158# is "yes"), so compile examples after U-Boot is compiled.
159SUBDIR_TOOLS = tools
349e83f0 160SUBDIRS = $(SUBDIR_TOOLS)
6d1ce387 161
249b53a6 162.PHONY : $(SUBDIRS) $(VERSION_FILE) $(TIMESTAMP_FILE)
6d1ce387 163
9e414032 164ifeq (include/config.mk,$(wildcard include/config.mk))
7ebf7443 165
2632c008
MF
166# Include autoconf.mk before config.mk so that the config options are available
167# to all top level build files. We need the dummy all: target to prevent the
168# dependency target in autoconf.mk.dep from being the default.
169all:
9e414032
MY
170sinclude include/autoconf.mk.dep
171sinclude include/autoconf.mk
2632c008 172
8a7e7d56
MY
173SUBDIR_EXAMPLES-y := examples/standalone
174SUBDIR_EXAMPLES-$(CONFIG_API) += examples/api
b5728756 175ifndef CONFIG_SANDBOX
8a7e7d56 176SUBDIRS += $(SUBDIR_EXAMPLES-y)
b5728756
SG
177endif
178
7ebf7443 179# load ARCH, BOARD, and CPU configuration
9e414032 180include include/config.mk
1d9f4105 181export ARCH CPU BOARD VENDOR SOC
f9328639 182
1ea6bcd8 183# set default to nothing for native builds
a5284efd 184ifeq ($(HOSTARCH),$(ARCH))
1ea6bcd8 185CROSS_COMPILE ?=
5c952cf0 186endif
7ebf7443 187
f6322eb7
MY
188# SHELL used by kbuild
189CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
190 else if [ -x /bin/bash ]; then echo /bin/bash; \
191 else echo sh; fi ; fi)
192
193HOSTCC = gcc
194HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
195
196ifeq ($(HOSTOS),cygwin)
197HOSTCFLAGS += -ansi
198endif
199
200# Mac OS X / Darwin's C preprocessor is Apple specific. It
201# generates numerous errors and warnings. We want to bypass it
202# and use GNU C's cpp. To do this we pass the -traditional-cpp
203# option to the compiler. Note that the -traditional-cpp flag
204# DOES NOT have the same semantics as GNU C's flag, all it does
205# is invoke the GNU preprocessor in stock ANSI/ISO C fashion.
206#
207# Apple's linker is similar, thanks to the new 2 stage linking
208# multiple symbol definitions are treated as errors, hence the
209# -multiply_defined suppress option to turn off this error.
210#
211ifeq ($(HOSTOS),darwin)
212# get major and minor product version (e.g. '10' and '6' for Snow Leopard)
213DARWIN_MAJOR_VERSION = $(shell sw_vers -productVersion | cut -f 1 -d '.')
214DARWIN_MINOR_VERSION = $(shell sw_vers -productVersion | cut -f 2 -d '.')
215
216os_x_before = $(shell if [ $(DARWIN_MAJOR_VERSION) -le $(1) -a \
217 $(DARWIN_MINOR_VERSION) -le $(2) ] ; then echo "$(3)"; else echo "$(4)"; fi ;)
218
219# Snow Leopards build environment has no longer restrictions as described above
220HOSTCC = $(call os_x_before, 10, 5, "cc", "gcc")
221HOSTCFLAGS += $(call os_x_before, 10, 4, "-traditional-cpp")
222HOSTLDFLAGS += $(call os_x_before, 10, 5, "-multiply_defined suppress")
223endif
224
9e414032
MY
225# Look for make include files relative to root of kernel src
226MAKEFLAGS += --include-dir=$(srctree)
227
bf4b3de1
MY
228# We need some generic definitions (do not try to remake the file).
229$(srctree)/scripts/Kbuild.include: ;
230include $(srctree)/scripts/Kbuild.include
231
f6322eb7
MY
232# Make variables (CC, etc...)
233
234AS = $(CROSS_COMPILE)as
235# Always use GNU ld
236ifneq ($(shell $(CROSS_COMPILE)ld.bfd -v 2> /dev/null),)
237LD = $(CROSS_COMPILE)ld.bfd
238else
239LD = $(CROSS_COMPILE)ld
240endif
241CC = $(CROSS_COMPILE)gcc
242CPP = $(CC) -E
243AR = $(CROSS_COMPILE)ar
244NM = $(CROSS_COMPILE)nm
245LDR = $(CROSS_COMPILE)ldr
246STRIP = $(CROSS_COMPILE)strip
247OBJCOPY = $(CROSS_COMPILE)objcopy
248OBJDUMP = $(CROSS_COMPILE)objdump
249AWK = awk
250RANLIB = $(CROSS_COMPILE)RANLIB
251DTC = dtc
252CHECK = sparse
253
254CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
255 -Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF)
256
fea1ca8e
MY
257# Use UBOOTINCLUDE when you must reference the include/ directory.
258# Needed to be compatible with the O= option
259UBOOTINCLUDE :=
260ifneq ($(OBJTREE),$(SRCTREE))
261UBOOTINCLUDE += -I$(OBJTREE)/include
262endif
263UBOOTINCLUDE += -I$(srctree)/include \
264 -I$(srctree)/arch/$(ARCH)/include
265
2b3c9d3d
MY
266KBUILD_CPPFLAGS := -D__KERNEL__
267
268KBUILD_CFLAGS := -Wall -Wstrict-prototypes \
269 -Wno-format-security \
270 -fno-builtin -ffreestanding
271KBUILD_AFLAGS := -D__ASSEMBLY__
272
f6322eb7
MY
273export CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC
274export CPP AR NM LDR STRIP OBJCOPY OBJDUMP
275export MAKE AWK
276export DTC CHECK CHECKFLAGS
277
fea1ca8e 278export KBUILD_CPPFLAGS NOSTDINC_FLAGS UBOOTINCLUDE
2b3c9d3d
MY
279export KBUILD_CFLAGS KBUILD_AFLAGS
280
281KBUILD_CFLAGS += -Os #-fomit-frame-pointer
282
283ifdef BUILD_TAG
284KBUILD_CFLAGS += -DBUILD_TAG='"$(BUILD_TAG)"'
285endif
286
287KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
288
289KBUILD_CFLAGS += -g
290# $(KBUILD_AFLAGS) sets -g, which causes gcc to pass a suitable -g<format>
291# option to the assembler.
292KBUILD_AFLAGS += -g
293
fea1ca8e
MY
294NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
295CHECKFLAGS += $(NOSTDINC_FLAGS)
296
2b3c9d3d
MY
297# Report stack usage if supported
298KBUILD_CFLAGS += $(call cc-option,-fstack-usage)
299
300KBUILD_CFLAGS += $(call cc-option,-Wno-format-nonliteral)
301
302# turn jbsr into jsr for m68k
303ifeq ($(ARCH),m68k)
304ifeq ($(findstring 3.4,$(shell $(CC) --version)),3.4)
305KBUILD_AFLAGS += -Wa,-gstabs,-S
306endif
307endif
308
92b197f0
WD
309# load other configuration
310include $(TOPDIR)/config.mk
311
ced0715d
MY
312ifneq ($(CONFIG_SYS_TEXT_BASE),)
313KBUILD_CPPFLAGS += -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE)
314endif
315
316export CONFIG_SYS_TEXT_BASE
317
9e414032 318LDFLAGS_u-boot += -T u-boot.lds $(LDFLAGS_FINAL)
ced0715d
MY
319ifneq ($(CONFIG_SYS_TEXT_BASE),)
320LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE)
321endif
322
fada9e20 323# Targets which don't build the source code
ced0715d 324NON_BUILD_TARGETS = backup clean clobber distclean mrproper tidy unconfig %_config
fada9e20
SG
325
326# Only do the generic board check when actually building, not configuring
327ifeq ($(filter $(NON_BUILD_TARGETS),$(MAKECMDGOALS)),)
ced0715d
MY
328ifeq ($(__HAVE_ARCH_GENERIC_BOARD),)
329ifneq ($(CONFIG_SYS_GENERIC_BOARD),)
330CHECK_GENERIC_BOARD = $(error Your architecture does not support generic board. \
331Please undefined CONFIG_SYS_GENERIC_BOARD in your board config file)
332endif
fada9e20
SG
333endif
334endif
335
d51dfff7
IY
336# If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use
337# that (or fail if absent). Otherwise, search for a linker script in a
338# standard location.
339
ee60197e
SG
340LDSCRIPT_MAKEFILE_DIR = $(dir $(LDSCRIPT))
341
d51dfff7
IY
342ifndef LDSCRIPT
343 #LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug
344 ifdef CONFIG_SYS_LDSCRIPT
345 # need to strip off double quotes
a8c07541 346 LDSCRIPT := $(CONFIG_SYS_LDSCRIPT:"%"=%)
d51dfff7
IY
347 endif
348endif
349
ee60197e 350# If there is no specified link script, we look in a number of places for it
d51dfff7
IY
351ifndef LDSCRIPT
352 ifeq ($(CONFIG_NAND_U_BOOT),y)
353 LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds
354 ifeq ($(wildcard $(LDSCRIPT)),)
355 LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds
356 endif
357 endif
358 ifeq ($(wildcard $(LDSCRIPT)),)
359 LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
360 endif
361 ifeq ($(wildcard $(LDSCRIPT)),)
362 LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot.lds
363 endif
ee60197e
SG
364 ifeq ($(wildcard $(LDSCRIPT)),)
365 LDSCRIPT := $(TOPDIR)/arch/$(ARCH)/cpu/u-boot.lds
366 # We don't expect a Makefile here
367 LDSCRIPT_MAKEFILE_DIR =
368 endif
d51dfff7
IY
369 ifeq ($(wildcard $(LDSCRIPT)),)
370$(error could not find linker script)
371 endif
372endif
373
7ebf7443
WD
374#########################################################################
375# U-Boot objects....order is important (i.e. start must be first)
376
e8a8b824
MY
377head-y := $(CPUDIR)/start.o
378head-$(CONFIG_4xx) += arch/powerpc/cpu/ppc4xx/resetvec.o
379head-$(CONFIG_MPC85xx) += arch/powerpc/cpu/mpc85xx/resetvec.o
7ebf7443 380
9e414032 381OBJS := $(head-y)
f9328639 382
9e414032 383HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makefile),y,n)
8b5a0264 384
e2906a59 385LIBS-y += lib/
e2906a59
MY
386LIBS-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/
387LIBS-y += $(CPUDIR)/
1d9f4105 388ifdef SOC
e2906a59 389LIBS-y += $(CPUDIR)/$(SOC)/
1d9f4105 390endif
e2906a59
MY
391LIBS-$(CONFIG_IXP4XX_NPE) += drivers/net/npe/
392LIBS-$(CONFIG_OF_EMBED) += dts/
393LIBS-y += arch/$(ARCH)/lib/
57c3e5fc 394LIBS-y += fs/
e2906a59
MY
395LIBS-y += net/
396LIBS-y += disk/
397LIBS-y += drivers/
398LIBS-y += drivers/dma/
399LIBS-y += drivers/gpio/
400LIBS-y += drivers/i2c/
401LIBS-y += drivers/input/
402LIBS-y += drivers/mmc/
403LIBS-y += drivers/mtd/
392ba525 404LIBS-$(CONFIG_CMD_NAND) += drivers/mtd/nand/
e2906a59 405LIBS-y += drivers/mtd/onenand/
392ba525 406LIBS-$(CONFIG_CMD_UBI) += drivers/mtd/ubi/
e2906a59
MY
407LIBS-y += drivers/mtd/spi/
408LIBS-y += drivers/net/
409LIBS-y += drivers/net/phy/
410LIBS-y += drivers/pci/
411LIBS-y += drivers/power/ \
412 drivers/power/fuel_gauge/ \
413 drivers/power/mfd/ \
414 drivers/power/pmic/ \
415 drivers/power/battery/
416LIBS-y += drivers/spi/
417LIBS-$(CONFIG_FMAN_ENET) += drivers/net/fm/
5614e71b 418LIBS-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/
e2906a59
MY
419LIBS-y += drivers/serial/
420LIBS-y += drivers/usb/eth/
421LIBS-y += drivers/usb/gadget/
422LIBS-y += drivers/usb/host/
423LIBS-y += drivers/usb/musb/
424LIBS-y += drivers/usb/musb-new/
425LIBS-y += drivers/usb/phy/
426LIBS-y += drivers/usb/ulpi/
427LIBS-y += common/
428LIBS-y += lib/libfdt/
8a7e7d56 429LIBS-$(CONFIG_API) += api/
755e08f0 430LIBS-$(CONFIG_HAS_POST) += post/
e2906a59 431LIBS-y += test/
f9328639 432
24e8bee5 433ifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35 mxs vf610))
e2906a59 434LIBS-y += arch/$(ARCH)/imx-common/
18936ee2
JL
435endif
436
e2906a59
MY
437LIBS-$(CONFIG_ARM) += arch/arm/cpu/
438LIBS-$(CONFIG_PPC) += arch/powerpc/cpu/
852bd07c 439
e2906a59 440LIBS-y += board/$(BOARDDIR)/
08e39a84 441
e2906a59 442LIBS-y := $(patsubst %/, %/built-in.o, $(LIBS-y))
9e414032 443LIBS := $(sort $(LIBS-y))
249b53a6 444.PHONY : $(LIBS)
a8c7c708 445
4f7cb08e 446# Add GCC lib
52b1bf2c
WD
447ifdef USE_PRIVATE_LIBGCC
448ifeq ("$(USE_PRIVATE_LIBGCC)", "yes")
635d1b3e 449PLATFORM_LIBGCC = $(OBJTREE)/arch/$(ARCH)/lib/libgcc.o
52b1bf2c
WD
450else
451PLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc
452endif
453else
cca4e4ae 454PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
52b1bf2c
WD
455endif
456PLATFORM_LIBS += $(PLATFORM_LIBGCC)
457export PLATFORM_LIBS
3d3befa7 458
6ac9f479
MF
459# Special flags for CPP when processing the linker script.
460# Pass the version down so we can handle backwards compatibility
461# on the fly.
462LDPPFLAGS += \
463 -include $(TOPDIR)/include/u-boot/u-boot.lds.h \
7e6403a6 464 -DCPUDIR=$(CPUDIR) \
6ac9f479
MF
465 $(shell $(LD) --version | \
466 sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p')
467
bdccc4fe 468#########################################################################
7ebf7443
WD
469#########################################################################
470
f3a14d37
MF
471ifneq ($(CONFIG_BOARD_SIZE_LIMIT),)
472BOARD_SIZE_CHECK = \
473 @actual=`wc -c $@ | awk '{print $$1}'`; \
d060e6f4 474 limit=`printf "%d" $(CONFIG_BOARD_SIZE_LIMIT)`; \
f3a14d37 475 if test $$actual -gt $$limit; then \
d060e6f4
JH
476 echo "$@ exceeds file size limit:" >&2 ; \
477 echo " limit: $$limit bytes" >&2 ; \
478 echo " actual: $$actual bytes" >&2 ; \
479 echo " excess: $$((actual - limit)) bytes" >&2; \
f3a14d37
MF
480 exit 1; \
481 fi
482else
483BOARD_SIZE_CHECK =
484endif
485
8137af19
SW
486# Statically apply RELA-style relocations (currently arm64 only)
487ifneq ($(CONFIG_STATIC_RELA),)
488# $(1) is u-boot ELF, $(2) is u-boot bin, $(3) is text base
489DO_STATIC_RELA = \
490 start=$$($(NM) $(1) | grep __rel_dyn_start | cut -f 1 -d ' '); \
491 end=$$($(NM) $(1) | grep __rel_dyn_end | cut -f 1 -d ' '); \
9e414032 492 tools/relocate-rela $(2) $(3) $$start $$end
8137af19
SW
493else
494DO_STATIC_RELA =
495endif
496
3e88337b 497# Always append ALL so that arch config.mk's can add custom ones
9e414032
MY
498ALL-y += u-boot.srec u-boot.bin System.map
499
500ALL-$(CONFIG_NAND_U_BOOT) += u-boot-nand.bin
501ALL-$(CONFIG_ONENAND_U_BOOT) += u-boot-onenand.bin
502ALL-$(CONFIG_RAMBOOT_PBL) += u-boot.pbl
503ALL-$(CONFIG_SPL) += spl/u-boot-spl.bin
504ALL-$(CONFIG_SPL_FRAMEWORK) += u-boot.img
505ALL-$(CONFIG_TPL) += tpl/u-boot-tpl.bin
506ALL-$(CONFIG_OF_SEPARATE) += u-boot.dtb u-boot-dtb.bin
b343bbb5 507ifneq ($(CONFIG_SPL_TARGET),)
9e414032 508ALL-$(CONFIG_SPL) += $(CONFIG_SPL_TARGET:"%"=%)
b343bbb5 509endif
9e414032 510ALL-$(CONFIG_REMAKE_ELF) += u-boot.elf
0d3c62e4 511
12b7b70c 512# enable combined SPL/u-boot/dtb rules for tegra
6d6c0bae 513ifneq ($(CONFIG_TEGRA),)
7dcd3a21 514ifeq ($(CONFIG_SPL),y)
12b7b70c 515ifeq ($(CONFIG_OF_SEPARATE),y)
9e414032 516ALL-y += u-boot-dtb-tegra.bin
12b7b70c 517else
9e414032 518ALL-y += u-boot-nodtb-tegra.bin
12b7b70c
AM
519endif
520endif
7dcd3a21 521endif
12b7b70c 522
8a7e7d56 523all: $(ALL-y) $(SUBDIR_EXAMPLES-y)
7ebf7443 524
9e414032
MY
525u-boot.dtb: checkdtc u-boot
526 $(MAKE) $(build)=dts binary
527 mv dts/dt.dtb $@
2c0f79e4 528
9e414032 529u-boot-dtb.bin: u-boot.bin u-boot.dtb
2c0f79e4
SG
530 cat $^ >$@
531
9e414032 532u-boot.hex: u-boot
6310eb9d
WD
533 $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
534
9e414032 535u-boot.srec: u-boot
47ed5dd0 536 $(OBJCOPY) ${OBJCFLAGS} -O srec $< $@
7ebf7443 537
9e414032 538u-boot.bin: u-boot
7ebf7443 539 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
8137af19 540 $(call DO_STATIC_RELA,$<,$@,$(CONFIG_SYS_TEXT_BASE))
f3a14d37 541 $(BOARD_SIZE_CHECK)
7ebf7443 542
9e414032 543u-boot.ldr: u-boot
76d82187 544 $(CREATE_LDR_ENV)
68e56324 545 $(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS)
f3a14d37 546 $(BOARD_SIZE_CHECK)
94a91e24 547
9e414032 548u-boot.ldr.hex: u-boot.ldr
94a91e24
MF
549 $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@ -I binary
550
9e414032 551u-boot.ldr.srec: u-boot.ldr
94a91e24
MF
552 $(OBJCOPY) ${OBJCFLAGS} -O srec $< $@ -I binary
553
b40bda6b
SR
554#
555# U-Boot entry point, needed for booting of full-blown U-Boot
556# from the SPL U-Boot version.
557#
558ifndef CONFIG_SYS_UBOOT_START
559CONFIG_SYS_UBOOT_START := 0
560endif
561
9e414032
MY
562u-boot.img: u-boot.bin
563 tools/mkimage -A $(ARCH) -T firmware -C none \
b40bda6b
SR
564 -O u-boot -a $(CONFIG_SYS_TEXT_BASE) \
565 -e $(CONFIG_SYS_UBOOT_START) \
881a87ec 566 -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
bdccc4fe
WD
567 sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \
568 -d $< $@
569
9e414032
MY
570u-boot.imx: u-boot.bin depend
571 $(MAKE) $(build)=arch/arm/imx-common $(objtree)/u-boot.imx
8edcde5e 572
9e414032
MY
573u-boot.kwb: u-boot.bin
574 tools/mkimage -n $(CONFIG_SYS_KWD_CONFIG) -T kwbimage \
2ea88b06 575 -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) -d $< $@
aa0c7a86 576
9e414032
MY
577u-boot.pbl: u-boot.bin
578 tools/mkimage -n $(CONFIG_SYS_FSL_PBL_RCW) \
690e4258 579 -R $(CONFIG_SYS_FSL_PBL_PBI) -T pblimage \
5d898a00
SX
580 -d $< $@
581
9e414032
MY
582u-boot.sha1: u-boot.bin
583 tools/ubsha1 u-boot.bin
566a494f 584
9e414032 585u-boot.dis: u-boot
7ebf7443
WD
586 $(OBJDUMP) -d $< > $@
587
3aa29de0
YZ
588# $@ is output, $(1) and $(2) are inputs, $(3) is padded intermediate,
589# $(4) is pad-to
590SPL_PAD_APPEND = \
591 $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(4) -I binary -O binary \
9e414032
MY
592 $(1) $(3); \
593 cat $(3) $(2) > $@; \
594 rm $(3)
74752baa 595
3aa29de0 596ifdef CONFIG_TPL
9e414032 597SPL_PAYLOAD := tpl/u-boot-with-tpl.bin
3aa29de0 598else
9e414032 599SPL_PAYLOAD := u-boot.bin
3aa29de0 600endif
74752baa 601
9e414032 602u-boot-with-spl.bin: spl/u-boot-spl.bin $(SPL_PAYLOAD)
3aa29de0
YZ
603 $(call SPL_PAD_APPEND,$<,$(SPL_PAYLOAD),spl/u-boot-spl-pad.bin,$(CONFIG_SPL_PAD_TO))
604
9e414032
MY
605tpl/u-boot-with-tpl.bin: tpl/u-boot-tpl.bin u-boot.bin
606 $(call SPL_PAD_APPEND,$<,u-boot.bin,tpl/u-boot-tpl-pad.bin,$(CONFIG_TPL_PAD_TO))
7816f2cf 607
9e414032
MY
608u-boot-with-spl.imx: spl/u-boot-spl.bin u-boot.bin
609 $(MAKE) $(build)=arch/arm/imx-common \
ba597609
BT
610 $(OBJTREE)/u-boot-with-spl.imx
611
9e414032
MY
612u-boot-with-nand-spl.imx: spl/u-boot-spl.bin u-boot.bin
613 $(MAKE) $(build)=arch/arm/imx-common \
7d5a5c79
BT
614 $(OBJTREE)/u-boot-with-nand-spl.imx
615
9e414032
MY
616u-boot.ubl: u-boot-with-spl.bin
617 tools/mkimage -n $(UBL_CONFIG) -T ublimage \
618 -e $(CONFIG_SYS_TEXT_BASE) -d $< u-boot.ubl
277f00f5 619
9e414032
MY
620u-boot.ais: spl/u-boot-spl.bin u-boot.img
621 tools/mkimage -s -n $(if $(CONFIG_AIS_CONFIG_FILE),$(srctree)/$(CONFIG_AIS_CONFIG_FILE:"%"=%),"/dev/null") \
6d660e77 622 -T aisimage \
d36d8859 623 -e $(CONFIG_SPL_TEXT_BASE) \
9e414032
MY
624 -d spl/u-boot-spl.bin \
625 spl/u-boot-spl.ais
d36d8859
CR
626 $(OBJCOPY) ${OBJCFLAGS} -I binary \
627 --pad-to=$(CONFIG_SPL_MAX_SIZE) -O binary \
9e414032
MY
628 spl/u-boot-spl.ais spl/u-boot-spl-pad.ais
629 cat spl/u-boot-spl-pad.ais u-boot.img > u-boot.ais
d36d8859 630
a5453555 631
9e414032
MY
632u-boot.sb: u-boot.bin spl/u-boot-spl.bin
633 $(MAKE) $(build)=$(CPUDIR)/$(SOC)/ $(OBJTREE)/u-boot.sb
30b9b932 634
94aebe6c
SR
635# On x600 (SPEAr600) U-Boot is appended to U-Boot SPL.
636# Both images are created using mkimage (crc etc), so that the ROM
637# bootloader can check its integrity. Padding needs to be done to the
638# SPL image (with mkimage header) and not the binary. Otherwise the resulting image
639# which is loaded/copied by the ROM bootloader to SRAM doesn't fit.
640# The resulting image containing both U-Boot images is called u-boot.spr
9e414032
MY
641u-boot.spr: u-boot.img spl/u-boot-spl.bin
642 tools/mkimage -A $(ARCH) -T firmware -C none \
94aebe6c 643 -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n XLOADER \
9e414032 644 -d spl/u-boot-spl.bin $@
57270260
MY
645 $(OBJCOPY) -I binary -O binary \
646 --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff $@
9e414032 647 cat u-boot.img >> $@
94aebe6c 648
6d6c0bae 649ifneq ($(CONFIG_TEGRA),)
9e414032
MY
650u-boot-nodtb-tegra.bin: spl/u-boot-spl.bin u-boot.bin
651 $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SYS_TEXT_BASE) -O binary spl/u-boot-spl spl/u-boot-spl-pad.bin
652 cat spl/u-boot-spl-pad.bin u-boot.bin > $@
653 rm spl/u-boot-spl-pad.bin
9972db5c
SW
654
655ifeq ($(CONFIG_OF_SEPARATE),y)
9e414032
MY
656u-boot-dtb-tegra.bin: u-boot-nodtb-tegra.bin u-boot.dtb
657 cat u-boot-nodtb-tegra.bin u-boot.dtb > $@
9972db5c 658endif
984df4ec 659endif
984df4ec 660
9e414032
MY
661u-boot-img.bin: spl/u-boot-spl.bin u-boot.img
662 cat spl/u-boot-spl.bin u-boot.img > $@
fb3d2b8a 663
ecddccd0
SR
664# PPC4xx needs the SPL at the end of the image, since the reset vector
665# is located at 0xfffffffc. So we can't use the "u-boot-img.bin" target
666# and need to introduce a new build target with the full blown U-Boot
667# at the start padded up to the start of the SPL image. And then concat
668# the SPL image to the end.
9e414032 669u-boot-img-spl-at-end.bin: spl/u-boot-spl.bin u-boot.img
57270260 670 $(OBJCOPY) -I binary -O binary --pad-to=$(CONFIG_UBOOT_PAD_TO) \
9e414032
MY
671 --gap-fill=0xff u-boot.img $@
672 cat spl/u-boot-spl.bin >> $@
ecddccd0 673
f4dc714a
SW
674# Create a new ELF from a raw binary file. This is useful for arm64
675# where static relocation needs to be performed on the raw binary,
676# but certain simulators only accept an ELF file (but don't do the
677# relocation).
678# FIXME refactor dts/Makefile to share target/arch detection
9e414032 679u-boot.elf: u-boot.bin
f4dc714a 680 @$(OBJCOPY) -B aarch64 -I binary -O elf64-littleaarch64 \
9e414032
MY
681 $< u-boot-elf.o
682 @$(LD) u-boot-elf.o -o $@ \
f4dc714a
SW
683 --defsym=_start=$(CONFIG_SYS_TEXT_BASE) \
684 -Ttext=$(CONFIG_SYS_TEXT_BASE)
685
86eb49b3
SG
686ifeq ($(CONFIG_SANDBOX),y)
687GEN_UBOOT = \
9e414032
MY
688 $(CC) $(SYMS) -T u-boot.lds \
689 -Wl,--start-group $(LIBS) -Wl,--end-group \
86eb49b3
SG
690 $(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot.map -o u-boot
691else
ecb1dc89 692GEN_UBOOT = \
9e414032
MY
693 $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \
694 $(OBJS) \
695 --start-group $(LIBS) --end-group $(PLATFORM_LIBS) \
b2184c31 696 -Map u-boot.map -o u-boot
86eb49b3
SG
697endif
698
9e414032 699u-boot: depend $(SUBDIR_TOOLS) $(OBJS) $(LIBS) u-boot.lds
ecb1dc89
MF
700 $(GEN_UBOOT)
701ifeq ($(CONFIG_KALLSYMS),y)
9e414032 702 smap=`$(call SYSTEM_MAP,u-boot) | \
1aada9cd
WD
703 awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 "\\\\000"}'` ; \
704 $(CC) $(CFLAGS) -DSYSTEM_MAP="\"$${smap}\"" \
9e414032
MY
705 -c $(srctree)/common/system_map.c -o common/system_map.o
706 $(GEN_UBOOT) common/system_map.o
ecb1dc89 707endif
7ebf7443 708
3bddafaa
MY
709$(OBJS):
710 @:
f9328639 711
349e83f0 712$(LIBS): depend $(SUBDIR_TOOLS)
9e414032 713 $(MAKE) $(build)=$(patsubst %/,%,$(dir $@))
a8c7c708 714
4a20df39 715$(SUBDIRS): depend
9e414032 716 $(MAKE) $(build)=$@ all
940db16d 717
9e414032 718$(SUBDIR_EXAMPLES-y): u-boot
349e83f0 719
9e414032 720u-boot.lds: $(LDSCRIPT) depend
97b24d3d 721 $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$< >$@
1aada9cd 722
e935a374 723nand_spl: $(TIMESTAMP_FILE) $(VERSION_FILE) depend
9e414032 724 $(MAKE) $(build)=nand_spl/board/$(BOARDDIR) all
887e2ec9 725
9e414032
MY
726u-boot-nand.bin: nand_spl u-boot.bin
727 cat nand_spl/u-boot-spl-16k.bin u-boot.bin > u-boot-nand.bin
887e2ec9 728
9e414032
MY
729spl/u-boot-spl.bin: $(SUBDIR_TOOLS) depend
730 $(MAKE) obj=spl -f $(srctree)/spl/Makefile all
5df2ee27 731
9e414032
MY
732tpl/u-boot-tpl.bin: $(SUBDIR_TOOLS) depend
733 $(MAKE) obj=tpl -f $(srctree)/spl/Makefile all CONFIG_TPL_BUILD=y
3aa29de0 734
2a998793
DH
735# Explicitly make _depend in subdirs containing multiple targets to prevent
736# parallel sub-makes creating .depend files simultaneously.
16a354f9 737depend dep: $(TIMESTAMP_FILE) $(VERSION_FILE) \
9e414032
MY
738 include/spl-autoconf.mk \
739 include/tpl-autoconf.mk \
740 include/autoconf.mk \
741 include/generated/generic-asm-offsets.h \
742 include/generated/asm-offsets.h
7ebf7443 743
e5e4e705 744TAG_SUBDIRS = $(SUBDIRS)
9e414032 745TAG_SUBDIRS += $(dir $(LIBS))
a340c325 746TAG_SUBDIRS += include
a340c325 747
857d9ea6
HK
748FIND := find
749FINDFLAGS := -L
750
1064d980 751checkstack:
9e414032
MY
752 $(CROSS_COMPILE)objdump -d u-boot \
753 `$(FIND) . -name u-boot-spl -print` | \
754 perl $(src)/scripts/checkstack.pl $(ARCH)
1064d980 755
f9328639 756tags ctags:
9e414032 757 ctags -w -o ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
e5e4e705 758 -name '*.[chS]' -print`
7ebf7443
WD
759
760etags:
857d9ea6 761 etags -a -o $(obj)etags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
e5e4e705 762 -name '*.[chS]' -print`
ffda586f 763cscope:
857d9ea6
HK
764 $(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) -name '*.[chS]' -print > \
765 cscope.files
ffda586f 766 cscope -b -q -k
7ebf7443 767
ecb1dc89
MF
768SYSTEM_MAP = \
769 $(NM) $1 | \
7ebf7443 770 grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
ecb1dc89 771 LC_ALL=C sort
9e414032 772System.map: u-boot
bc8bb6ec 773 @$(call SYSTEM_MAP,$<) > $@
7ebf7443 774
06a119a0
TR
775checkthumb:
776 @if test $(call cc-version) -lt 0404; then \
777 echo -n '*** Your GCC does not produce working '; \
778 echo 'binaries in THUMB mode.'; \
779 echo '*** Your board is configured for THUMB mode.'; \
780 false; \
781 fi
6ec63f41
SW
782
783# GCC 3.x is reported to have problems generating the type of relocation
784# that U-Boot wants.
785# See http://lists.denx.de/pipermail/u-boot/2012-September/135156.html
786checkgcc4:
787 @if test $(call cc-version) -lt 0400; then \
788 echo -n '*** Your GCC is too old, please upgrade to GCC 4.x or newer'; \
789 false; \
790 fi
791
501ebdf2
SW
792checkdtc:
793 @if test $(call dtc-version) -lt 0104; then \
794 echo '*** Your dtc is too old, please upgrade to dtc 1.4 or newer'; \
795 false; \
796 fi
797
2f155f6c
GL
798#
799# Auto-generate the autoconf.mk file (which is included by all makefiles)
800#
801# This target actually generates 2 files; autoconf.mk and autoconf.mk.dep.
802# the dep file is only include in this top level makefile to determine when
803# to regenerate the autoconf.mk file.
9e414032 804include/autoconf.mk.dep: include/config.h include/common.h
1510b82d 805 @$(XECHO) Generating $@ ; \
ae6d1056 806 : Generate the dependancies ; \
4c34b2a0 807 $(CC) -x c -DDO_DEPS_ONLY -M $(CFLAGS) $(CPPFLAGS) \
9e414032 808 -MQ include/autoconf.mk $(srctree)/include/common.h > $@ || \
65947ab4 809 rm $@
1510b82d 810
9e414032 811include/autoconf.mk: include/config.h
1510b82d 812 @$(XECHO) Generating $@ ; \
ae6d1056 813 : Extract the config macros ; \
9e414032
MY
814 $(CPP) $(CFLAGS) -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && \
815 sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp > $@; \
65947ab4 816 rm $@.tmp
2f155f6c 817
39bc12dd 818# Auto-generate the spl-autoconf.mk file (which is included by all makefiles for SPL)
9e414032 819include/tpl-autoconf.mk: include/config.h
3aa29de0 820 @$(XECHO) Generating $@ ; \
3aa29de0
YZ
821 : Extract the config macros ; \
822 $(CPP) $(CFLAGS) -DCONFIG_TPL_BUILD -DCONFIG_SPL_BUILD\
9e414032
MY
823 -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && \
824 sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp > $@; \
65947ab4 825 rm $@.tmp
3aa29de0 826
9e414032 827include/spl-autoconf.mk: include/config.h
39bc12dd 828 @$(XECHO) Generating $@ ; \
39bc12dd 829 : Extract the config macros ; \
9e414032
MY
830 $(CPP) $(CFLAGS) -DCONFIG_SPL_BUILD -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && \
831 sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp > $@; \
65947ab4 832 rm $@.tmp
39bc12dd 833
9e414032 834include/generated/generic-asm-offsets.h: lib/asm-offsets.s
16a354f9 835 @$(XECHO) Generating $@
9e414032 836 $(srctree)/tools/scripts/make-asm-offsets lib/asm-offsets.s $@
16a354f9 837
9e414032
MY
838lib/asm-offsets.s: include/config.h $(srctree)/lib/asm-offsets.c
839 @mkdir -p lib
16a354f9
WD
840 $(CC) -DDO_DEPS_ONLY \
841 $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
9e414032 842 -o $@ $(srctree)/lib/asm-offsets.c -c -S
16a354f9 843
9e414032 844include/generated/asm-offsets.h: $(CPUDIR)/$(SOC)/asm-offsets.s
b12734ee 845 @$(XECHO) Generating $@
9e414032 846 $(srctree)/tools/scripts/make-asm-offsets $(CPUDIR)/$(SOC)/asm-offsets.s $@
a4814a69 847
9e414032
MY
848$(CPUDIR)/$(SOC)/asm-offsets.s: include/config.h
849 @mkdir -p $(CPUDIR)/$(SOC)
850 if [ -f $(srctree)/$(CPUDIR)/$(SOC)/asm-offsets.c ];then \
a4814a69
SB
851 $(CC) -DDO_DEPS_ONLY \
852 $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
9e414032 853 -o $@ $(srctree)/$(CPUDIR)/$(SOC)/asm-offsets.c -c -S; \
a4814a69
SB
854 else \
855 touch $@; \
856 fi
857
7ebf7443 858#########################################################################
ae6d1056 859else # !config.mk
9e414032
MY
860all u-boot.hex u-boot.srec u-boot.bin \
861u-boot.img u-boot.dis u-boot \
249b53a6 862$(filter-out tools,$(SUBDIRS)) \
9e414032 863depend dep tags ctags etags cscope System.map:
7ebf7443
WD
864 @echo "System not configured - see README" >&2
865 @ exit 1
c7c0d542 866
249b53a6 867tools: $(VERSION_FILE) $(TIMESTAMP_FILE)
9e414032 868 $(MAKE) $(build)=$@ all
ae6d1056 869endif # config.mk
7ebf7443 870
54799e45
SW
871# ARM relocations should all be R_ARM_RELATIVE (32-bit) or
872# R_AARCH64_RELATIVE (64-bit).
9e414032 873checkarmreloc: u-boot
54799e45
SW
874 @RELOC="`$(CROSS_COMPILE)readelf -r -W $< | cut -d ' ' -f 4 | \
875 grep R_A | sort -u`"; \
876 if test "$$RELOC" != "R_ARM_RELATIVE" -a \
877 "$$RELOC" != "R_AARCH64_RELATIVE"; then \
878 echo "$< contains unexpected relocations: $$RELOC"; \
879 false; \
880 fi
c37980c3 881
28abd48f 882$(VERSION_FILE):
14ce91b1 883 @mkdir -p $(dir $(VERSION_FILE))
dd88ab32 884 @( localvers='$(shell $(TOPDIR)/scripts/setlocalversion $(TOPDIR))' ; \
28abd48f
IY
885 printf '#define PLAIN_VERSION "%s%s"\n' \
886 "$(U_BOOT_VERSION)" "$${localvers}" ; \
887 printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' \
888 "$(U_BOOT_VERSION)" "$${localvers}" ; \
889 ) > $@.tmp
890 @( printf '#define CC_VERSION_STRING "%s"\n' \
891 '$(shell $(CC) --version | head -n 1)' )>> $@.tmp
892 @( printf '#define LD_VERSION_STRING "%s"\n' \
893 '$(shell $(LD) -v | head -n 1)' )>> $@.tmp
894 @cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
895
249b53a6
LM
896$(TIMESTAMP_FILE):
897 @mkdir -p $(dir $(TIMESTAMP_FILE))
a76406fb
LM
898 @LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > $@.tmp
899 @LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> $@.tmp
900 @cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
249b53a6 901
0358df42 902easylogo env gdb:
9e414032 903 $(MAKE) $(build)=tools/$@ MTD_VERSION=${MTD_VERSION}
940db16d 904
0358df42
MF
905gdbtools: gdb
906
30ff8918 907xmldocs pdfdocs psdocs htmldocs mandocs: tools/kernel-doc/docproc
9e414032 908 $(MAKE) U_BOOT_VERSION=$(U_BOOT_VERSION) $(build)=doc/DocBook $@
30ff8918 909
249b53a6 910tools-all: easylogo env gdb $(VERSION_FILE) $(TIMESTAMP_FILE)
9e414032 911 $(MAKE) $(build)=tools HOST_TOOLS_ALL=y
0358df42 912
4e53a258
WD
913.PHONY : CHANGELOG
914CHANGELOG:
b985b5d6
BW
915 git log --no-merges U-Boot-1_1_5.. | \
916 unexpand -a | sed -e 's/\s\s*$$//' > $@
4e53a258 917
0a823aa2 918include/license.h: tools/bin2header COPYING
0e42ada3 919 cat COPYING | gzip -9 -c | ./tools/bin2header license_gzip > include/license.h
7ebf7443
WD
920#########################################################################
921
922unconfig:
9e414032
MY
923 @rm -f include/config.h include/config.mk \
924 board/*/config.tmp board/*/*/config.tmp \
925 include/autoconf.mk include/autoconf.mk.dep \
926 include/spl-autoconf.mk \
927 include/tpl-autoconf.mk
7ebf7443 928
a6862bc1
WD
929%_config:: unconfig
930 @$(MKCONFIG) -A $(@:_config=)
931
3e38691e 932#########################################################################
7ebf7443
WD
933
934clean:
9e414032
MY
935 @rm -f examples/standalone/atmel_df_pow2 \
936 examples/standalone/hello_world \
937 examples/standalone/interrupt \
938 examples/standalone/mem_to_mem_idma2intr \
939 examples/standalone/sched \
940 $(addprefix examples/standalone/, smc91111_eeprom smc911x_eeprom) \
941 examples/standalone/test_burst \
942 examples/standalone/timer
943 @rm -f $(addprefix examples/api/, demo demo.bin)
944 @rm -f tools/bmp_logo tools/easylogo/easylogo \
945 tools/env/fw_printenv \
946 tools/envcrc \
947 $(addprefix tools/gdb/, gdbcont gdbsend) \
948 tools/gen_eth_addr tools/img2srec \
949 tools/dumpimage \
950 $(addprefix tools/, mkenvimage mkimage) \
951 tools/mpc86x_clk \
952 $(addprefix tools/, mk$(BOARD)spl mkexynosspl) \
953 tools/mxsboot \
954 tools/ncb tools/ubsha1 \
955 tools/kernel-doc/docproc \
956 tools/proftool
957 @rm -f $(addprefix board/cray/L1/, bootscript.c bootscript.image) \
958 board/matrix_vision/*/bootscript.img \
959 spl/board/samsung/$(BOARD)/tools/mk$(BOARD)spl \
960 u-boot.lds \
961 $(addprefix arch/blackfin/cpu/, init.lds init.elf)
962 @rm -f include/bmp_logo.h
963 @rm -f include/bmp_logo_data.h
964 @rm -f lib/asm-offsets.s
965 @rm -f include/generated/asm-offsets.h
966 @rm -f $(CPUDIR)/$(SOC)/asm-offsets.s
d4abc757 967 @rm -f $(TIMESTAMP_FILE) $(VERSION_FILE)
9e414032 968 @$(MAKE) -f $(srctree)/doc/DocBook/Makefile cleandocs
ae6d1056 969 @find $(OBJTREE) -type f \
4a30f1e8 970 \( -name 'core' -o -name '*.bak' -o -name '*~' -o -name '*.su' \
71a988aa
TK
971 -o -name '*.o' -o -name '*.a' -o -name '*.exe' \
972 -o -name '*.cfgtmp' \) -print \
7ebf7443 973 | xargs rm -f
7ebf7443 974
734329f9
AF
975# Removes everything not needed for testing u-boot
976tidy: clean
977 @find $(OBJTREE) -type f \( -name '*.depend*' \) -print | xargs rm -f
978
979clobber: tidy
980 @find $(OBJTREE) -type f \( -name '*.srec' \
981 -o -name '*.bin' -o -name u-boot.img \) \
982 -print0 | xargs -0 rm -f
9e414032
MY
983 @rm -f $(OBJS) *.bak ctags etags TAGS \
984 cscope.* *.*~
985 @rm -f u-boot u-boot.map u-boot.hex $(ALL-y)
986 @rm -f u-boot.kwb
987 @rm -f u-boot.pbl
988 @rm -f u-boot.imx
989 @rm -f u-boot-with-spl.imx
990 @rm -f u-boot-with-nand-spl.imx
991 @rm -f u-boot.ubl
992 @rm -f u-boot.ais
993 @rm -f u-boot.dtb
994 @rm -f u-boot.sb
995 @rm -f u-boot.spr
996 @rm -f $(addprefix nand_spl/, u-boot.lds u-boot.lst System.map)
997 @rm -f $(addprefix nand_spl/, u-boot-nand_spl.lds u-boot-spl u-boot-spl.map)
998 @rm -f $(addprefix spl/, u-boot-spl u-boot-spl.bin u-boot-spl.map)
999 @rm -f spl/u-boot-spl.lds
1000 @rm -f $(addprefix tpl/, u-boot-tpl u-boot-tpl.bin u-boot-tpl.map)
1001 @rm -f tpl/u-boot-spl.lds
1002 @rm -f MLO MLO.byteswap
1003 @rm -f SPL
1004 @rm -f tools/xway-swap-bytes
1005 @rm -fr include/asm/proc include/asm/arch include/asm
1006 @rm -fr include/generated
1007 @[ ! -d nand_spl ] || find nand_spl -name "*" -type l -print | xargs rm -f
1008 @rm -f dts/*.tmp
1009 @rm -f $(addprefix spl/, u-boot-spl.ais, u-boot-spl-pad.ais)
f9328639 1010
f9328639
MB
1011mrproper \
1012distclean: clobber unconfig
afd077bd 1013ifneq ($(OBJTREE),$(SRCTREE))
9e414032 1014 rm -rf *
f9328639 1015endif
7ebf7443
WD
1016
1017backup:
1018 F=`basename $(TOPDIR)` ; cd .. ; \
d6b93714 1019 gtar --force-local -zcvf `LC_ALL=C date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F
7ebf7443
WD
1020
1021#########################################################################
9e414032
MY
1022
1023endif # skip-makefile
1024
1025PHONY += FORCE
1026FORCE:
1027
1028# Declare the contents of the .PHONY variable as phony. We keep that
1029# information in a variable so we can use it in if_changed and friends.
1030.PHONY: $(PHONY)