xref: /rk3399_rockchip-uboot/Makefile (revision 01072b44db66d31dc397ccccd1bf8ccf98e39094)
1#
2# (C) Copyright 2000-2013
3# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4#
5# SPDX-License-Identifier:	GPL-2.0+
6#
7
8VERSION = 2014
9PATCHLEVEL = 01
10SUBLEVEL =
11EXTRAVERSION =
12NAME =
13
14# *DOCUMENTATION*
15# To see a list of typical targets execute "make help"
16# More info can be located in ./README
17# Comments in this file are targeted only to the developer, do not
18# expect to learn how to build the kernel reading this file.
19
20# Do not:
21# o  use make's built-in rules and variables
22#    (this increases performance and avoids hard-to-debug behaviour);
23# o  print "Entering directory ...";
24MAKEFLAGS += -rR --no-print-directory
25
26# Avoid funny character set dependencies
27unexport LC_ALL
28LC_COLLATE=C
29LC_NUMERIC=C
30export LC_COLLATE LC_NUMERIC
31
32# We are using a recursive build, so we need to do a little thinking
33# to get the ordering right.
34#
35# Most importantly: sub-Makefiles should only ever modify files in
36# their own directory. If in some directory we have a dependency on
37# a file in another dir (which doesn't happen often, but it's often
38# unavoidable when linking the built-in.o targets which finally
39# turn into vmlinux), we will call a sub make in that other dir, and
40# after that we are sure that everything which is in that other dir
41# is now up to date.
42#
43# The only cases where we need to modify files which have global
44# effects are thus separated out and done before the recursive
45# descending is started. They are now explicitly listed as the
46# prepare rule.
47
48# To put more focus on warnings, be less verbose as default
49# Use 'make V=1' to see the full commands
50
51ifeq ("$(origin V)", "command line")
52  KBUILD_VERBOSE = $(V)
53endif
54ifndef KBUILD_VERBOSE
55  KBUILD_VERBOSE = 0
56endif
57
58# Call a source code checker (by default, "sparse") as part of the
59# C compilation.
60#
61# Use 'make C=1' to enable checking of only re-compiled files.
62# Use 'make C=2' to enable checking of *all* source files, regardless
63# of whether they are re-compiled or not.
64#
65# See the file "Documentation/sparse.txt" for more details, including
66# where to get the "sparse" utility.
67
68ifeq ("$(origin C)", "command line")
69  KBUILD_CHECKSRC = $(C)
70endif
71ifndef KBUILD_CHECKSRC
72  KBUILD_CHECKSRC = 0
73endif
74
75# Use make M=dir to specify directory of external module to build
76# Old syntax make ... SUBDIRS=$PWD is still supported
77# Setting the environment variable KBUILD_EXTMOD take precedence
78ifdef SUBDIRS
79  KBUILD_EXTMOD ?= $(SUBDIRS)
80endif
81
82ifeq ("$(origin M)", "command line")
83  KBUILD_EXTMOD := $(M)
84endif
85
86# kbuild supports saving output files in a separate directory.
87# To locate output files in a separate directory two syntaxes are supported.
88# In both cases the working directory must be the root of the kernel src.
89# 1) O=
90# Use "make O=dir/to/store/output/files/"
91#
92# 2) Set KBUILD_OUTPUT
93# Set the environment variable KBUILD_OUTPUT to point to the directory
94# where the output files shall be placed.
95# export KBUILD_OUTPUT=dir/to/store/output/files/
96# make
97#
98# The O= assignment takes precedence over the KBUILD_OUTPUT environment
99# variable.
100
101
102# KBUILD_SRC is set on invocation of make in OBJ directory
103# KBUILD_SRC is not intended to be used by the regular user (for now)
104ifeq ($(KBUILD_SRC),)
105
106# OK, Make called in directory where kernel src resides
107# Do we want to locate output files in a separate directory?
108ifeq ("$(origin O)", "command line")
109  KBUILD_OUTPUT := $(O)
110endif
111
112ifeq ("$(origin W)", "command line")
113  export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W)
114endif
115
116# That's our default target when none is given on the command line
117PHONY := _all
118_all:
119
120# Cancel implicit rules on top Makefile
121$(CURDIR)/Makefile Makefile: ;
122
123ifneq ($(KBUILD_OUTPUT),)
124# Invoke a second make in the output directory, passing relevant variables
125# check that the output directory actually exists
126saved-output := $(KBUILD_OUTPUT)
127KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
128$(if $(KBUILD_OUTPUT),, \
129     $(error output directory "$(saved-output)" does not exist))
130
131PHONY += $(MAKECMDGOALS) sub-make
132
133$(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
134	@:
135
136sub-make: FORCE
137	$(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \
138	KBUILD_SRC=$(CURDIR) \
139	KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile \
140	$(filter-out _all sub-make,$(MAKECMDGOALS))
141
142# Leave processing to above invocation of make
143skip-makefile := 1
144endif # ifneq ($(KBUILD_OUTPUT),)
145endif # ifeq ($(KBUILD_SRC),)
146
147# We process the rest of the Makefile if this is the final invocation of make
148ifeq ($(skip-makefile),)
149
150# If building an external module we do not care about the all: rule
151# but instead _all depend on modules
152PHONY += all
153ifeq ($(KBUILD_EXTMOD),)
154_all: all
155else
156_all: modules
157endif
158
159srctree		:= $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR))
160objtree		:= $(CURDIR)
161src		:= $(srctree)
162obj		:= $(objtree)
163
164VPATH		:= $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD))
165
166export srctree objtree VPATH
167
168OBJTREE		:= $(objtree)
169SPLTREE		:= $(OBJTREE)/spl
170TPLTREE		:= $(OBJTREE)/tpl
171SRCTREE		:= $(srctree)
172TOPDIR		:= $(SRCTREE)
173export	TOPDIR SRCTREE OBJTREE SPLTREE TPLTREE
174
175MKCONFIG	:= $(SRCTREE)/mkconfig
176export MKCONFIG
177
178# Make sure CDPATH settings don't interfere
179unexport CDPATH
180
181#########################################################################
182
183TIMESTAMP_FILE = include/generated/timestamp_autogenerated.h
184VERSION_FILE = include/generated/version_autogenerated.h
185
186HOSTARCH := $(shell uname -m | \
187	sed -e s/i.86/x86/ \
188	    -e s/sun4u/sparc64/ \
189	    -e s/arm.*/arm/ \
190	    -e s/sa110/arm/ \
191	    -e s/ppc64/powerpc/ \
192	    -e s/ppc/powerpc/ \
193	    -e s/macppc/powerpc/\
194	    -e s/sh.*/sh/)
195
196HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
197	    sed -e 's/\(cygwin\).*/cygwin/')
198
199export	HOSTARCH HOSTOS
200
201# Deal with colliding definitions from tcsh etc.
202VENDOR=
203
204#########################################################################
205
206# The "tools" are needed early, so put this first
207# Don't include stuff already done in $(LIBS)
208# The "examples" conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC
209# is "yes"), so compile examples after U-Boot is compiled.
210SUBDIR_TOOLS = tools
211SUBDIRS = $(SUBDIR_TOOLS)
212
213.PHONY : $(SUBDIRS) $(VERSION_FILE) $(TIMESTAMP_FILE)
214
215ifeq (include/config.mk,$(wildcard include/config.mk))
216
217# Include autoconf.mk before config.mk so that the config options are available
218# to all top level build files.  We need the dummy all: target to prevent the
219# dependency target in autoconf.mk.dep from being the default.
220all:
221sinclude include/autoconf.mk.dep
222sinclude include/autoconf.mk
223
224SUBDIR_EXAMPLES-y := examples/standalone
225SUBDIR_EXAMPLES-$(CONFIG_API) += examples/api
226ifndef CONFIG_SANDBOX
227SUBDIRS += $(SUBDIR_EXAMPLES-y)
228endif
229
230# load ARCH, BOARD, and CPU configuration
231include include/config.mk
232export	ARCH CPU BOARD VENDOR SOC
233
234# set default to nothing for native builds
235ifeq ($(HOSTARCH),$(ARCH))
236CROSS_COMPILE ?=
237endif
238
239# SHELL used by kbuild
240CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
241	  else if [ -x /bin/bash ]; then echo /bin/bash; \
242	  else echo sh; fi ; fi)
243
244HOSTCC       = gcc
245HOSTCFLAGS   = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
246
247ifeq ($(HOSTOS),cygwin)
248HOSTCFLAGS	+= -ansi
249endif
250
251# Mac OS X / Darwin's C preprocessor is Apple specific.  It
252# generates numerous errors and warnings.  We want to bypass it
253# and use GNU C's cpp.	To do this we pass the -traditional-cpp
254# option to the compiler.  Note that the -traditional-cpp flag
255# DOES NOT have the same semantics as GNU C's flag, all it does
256# is invoke the GNU preprocessor in stock ANSI/ISO C fashion.
257#
258# Apple's linker is similar, thanks to the new 2 stage linking
259# multiple symbol definitions are treated as errors, hence the
260# -multiply_defined suppress option to turn off this error.
261#
262ifeq ($(HOSTOS),darwin)
263# get major and minor product version (e.g. '10' and '6' for Snow Leopard)
264DARWIN_MAJOR_VERSION	= $(shell sw_vers -productVersion | cut -f 1 -d '.')
265DARWIN_MINOR_VERSION	= $(shell sw_vers -productVersion | cut -f 2 -d '.')
266
267os_x_before	= $(shell if [ $(DARWIN_MAJOR_VERSION) -le $(1) -a \
268	$(DARWIN_MINOR_VERSION) -le $(2) ] ; then echo "$(3)"; else echo "$(4)"; fi ;)
269
270# Snow Leopards build environment has no longer restrictions as described above
271HOSTCC       = $(call os_x_before, 10, 5, "cc", "gcc")
272HOSTCFLAGS  += $(call os_x_before, 10, 4, "-traditional-cpp")
273HOSTLDFLAGS += $(call os_x_before, 10, 5, "-multiply_defined suppress")
274endif
275
276# Decide whether to build built-in, modular, or both.
277# Normally, just do built-in.
278
279KBUILD_MODULES :=
280KBUILD_BUILTIN := 1
281
282#	If we have only "make modules", don't compile built-in objects.
283#	When we're building modules with modversions, we need to consider
284#	the built-in objects during the descend as well, in order to
285#	make sure the checksums are up to date before we record them.
286
287ifeq ($(MAKECMDGOALS),modules)
288  KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1)
289endif
290
291#	If we have "make <whatever> modules", compile modules
292#	in addition to whatever we do anyway.
293#	Just "make" or "make all" shall build modules as well
294
295# U-Boot does not need modules
296#ifneq ($(filter all _all modules,$(MAKECMDGOALS)),)
297#  KBUILD_MODULES := 1
298#endif
299
300#ifeq ($(MAKECMDGOALS),)
301#  KBUILD_MODULES := 1
302#endif
303
304export KBUILD_MODULES KBUILD_BUILTIN
305export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD
306
307# Beautify output
308# ---------------------------------------------------------------------------
309#
310# Normally, we echo the whole command before executing it. By making
311# that echo $($(quiet)$(cmd)), we now have the possibility to set
312# $(quiet) to choose other forms of output instead, e.g.
313#
314#         quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@
315#         cmd_cc_o_c       = $(CC) $(c_flags) -c -o $@ $<
316#
317# If $(quiet) is empty, the whole command will be printed.
318# If it is set to "quiet_", only the short version will be printed.
319# If it is set to "silent_", nothing will be printed at all, since
320# the variable $(silent_cmd_cc_o_c) doesn't exist.
321#
322# A simple variant is to prefix commands with $(Q) - that's useful
323# for commands that shall be hidden in non-verbose mode.
324#
325#	$(Q)ln $@ :<
326#
327# If KBUILD_VERBOSE equals 0 then the above command will be hidden.
328# If KBUILD_VERBOSE equals 1 then the above command is displayed.
329
330ifeq ($(KBUILD_VERBOSE),1)
331  quiet =
332  Q =
333else
334  quiet=quiet_
335  Q = @
336endif
337
338# If the user is running make -s (silent mode), suppress echoing of
339# commands
340
341ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
342  quiet=silent_
343endif
344
345export quiet Q KBUILD_VERBOSE
346
347
348# Look for make include files relative to root of kernel src
349MAKEFLAGS += --include-dir=$(srctree)
350
351# We need some generic definitions (do not try to remake the file).
352$(srctree)/scripts/Kbuild.include: ;
353include $(srctree)/scripts/Kbuild.include
354
355# Make variables (CC, etc...)
356
357AS		= $(CROSS_COMPILE)as
358# Always use GNU ld
359ifneq ($(shell $(CROSS_COMPILE)ld.bfd -v 2> /dev/null),)
360LD		= $(CROSS_COMPILE)ld.bfd
361else
362LD		= $(CROSS_COMPILE)ld
363endif
364CC		= $(CROSS_COMPILE)gcc
365CPP		= $(CC) -E
366AR		= $(CROSS_COMPILE)ar
367NM		= $(CROSS_COMPILE)nm
368LDR		= $(CROSS_COMPILE)ldr
369STRIP		= $(CROSS_COMPILE)strip
370OBJCOPY		= $(CROSS_COMPILE)objcopy
371OBJDUMP		= $(CROSS_COMPILE)objdump
372AWK		= awk
373RANLIB		= $(CROSS_COMPILE)RANLIB
374DTC		= dtc
375CHECK		= sparse
376
377CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
378		  -Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF)
379
380# Use UBOOTINCLUDE when you must reference the include/ directory.
381# Needed to be compatible with the O= option
382UBOOTINCLUDE    :=
383ifneq ($(OBJTREE),$(SRCTREE))
384UBOOTINCLUDE	+= -I$(OBJTREE)/include
385endif
386UBOOTINCLUDE	+= -I$(srctree)/include \
387		-I$(srctree)/arch/$(ARCH)/include
388
389KBUILD_CPPFLAGS := -D__KERNEL__
390
391KBUILD_CFLAGS   := -Wall -Wstrict-prototypes \
392		   -Wno-format-security \
393		   -fno-builtin -ffreestanding
394KBUILD_AFLAGS   := -D__ASSEMBLY__
395
396U_BOOT_VERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
397
398export VERSION PATCHLEVEL SUBLEVEL U_BOOT_VERSION
399export CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC
400export CPP AR NM LDR STRIP OBJCOPY OBJDUMP
401export MAKE AWK
402export DTC CHECK CHECKFLAGS
403
404export KBUILD_CPPFLAGS NOSTDINC_FLAGS UBOOTINCLUDE
405export KBUILD_CFLAGS KBUILD_AFLAGS
406
407# When compiling out-of-tree modules, put MODVERDIR in the module
408# tree rather than in the kernel tree. The kernel tree might
409# even be read-only.
410export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions
411
412# Files to ignore in find ... statements
413
414RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \
415		   -o -name .pc -o -name .hg -o -name .git \) -prune -o
416export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \
417			 --exclude CVS --exclude .pc --exclude .hg --exclude .git
418
419# ===========================================================================
420# Rules shared between *config targets and build targets
421
422# Basic helpers built in scripts/
423PHONY += scripts_basic
424scripts_basic:
425	$(Q)$(MAKE) $(build)=scripts/basic
426	$(Q)rm -f .tmp_quiet_recordmcount
427
428# To avoid any implicit rule to kick in, define an empty command.
429scripts/basic/%: scripts_basic ;
430
431
432KBUILD_CFLAGS += -Os #-fomit-frame-pointer
433
434ifdef BUILD_TAG
435KBUILD_CFLAGS += -DBUILD_TAG='"$(BUILD_TAG)"'
436endif
437
438KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
439
440KBUILD_CFLAGS	+= -g
441# $(KBUILD_AFLAGS) sets -g, which causes gcc to pass a suitable -g<format>
442# option to the assembler.
443KBUILD_AFLAGS	+= -g
444
445NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
446CHECKFLAGS     += $(NOSTDINC_FLAGS)
447
448# Report stack usage if supported
449KBUILD_CFLAGS += $(call cc-option,-fstack-usage)
450
451KBUILD_CFLAGS += $(call cc-option,-Wno-format-nonliteral)
452
453# turn jbsr into jsr for m68k
454ifeq ($(ARCH),m68k)
455ifeq ($(findstring 3.4,$(shell $(CC) --version)),3.4)
456KBUILD_AFLAGS += -Wa,-gstabs,-S
457endif
458endif
459
460# load other configuration
461include $(TOPDIR)/config.mk
462
463ifneq ($(CONFIG_SYS_TEXT_BASE),)
464KBUILD_CPPFLAGS += -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE)
465endif
466
467export CONFIG_SYS_TEXT_BASE
468
469LDFLAGS_u-boot += -T u-boot.lds $(LDFLAGS_FINAL)
470ifneq ($(CONFIG_SYS_TEXT_BASE),)
471LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE)
472endif
473
474# Targets which don't build the source code
475NON_BUILD_TARGETS = backup clean clobber distclean mrproper tidy unconfig %_config
476
477# Only do the generic board check when actually building, not configuring
478ifeq ($(filter $(NON_BUILD_TARGETS),$(MAKECMDGOALS)),)
479ifeq ($(__HAVE_ARCH_GENERIC_BOARD),)
480ifneq ($(CONFIG_SYS_GENERIC_BOARD),)
481CHECK_GENERIC_BOARD = $(error Your architecture does not support generic board. \
482Please undefined CONFIG_SYS_GENERIC_BOARD in your board config file)
483endif
484endif
485endif
486
487# FIX ME
488cpp_flags := $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(UBOOTINCLUDE) $(NOSTDINC_FLAGS)
489c_flags := $(KBUILD_CFLAGS) $(cpp_flags)
490
491# If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use
492# that (or fail if absent).  Otherwise, search for a linker script in a
493# standard location.
494
495LDSCRIPT_MAKEFILE_DIR = $(dir $(LDSCRIPT))
496
497ifndef LDSCRIPT
498	#LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug
499	ifdef CONFIG_SYS_LDSCRIPT
500		# need to strip off double quotes
501		LDSCRIPT := $(CONFIG_SYS_LDSCRIPT:"%"=%)
502	endif
503endif
504
505# If there is no specified link script, we look in a number of places for it
506ifndef LDSCRIPT
507	ifeq ($(CONFIG_NAND_U_BOOT),y)
508		LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds
509		ifeq ($(wildcard $(LDSCRIPT)),)
510			LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds
511		endif
512	endif
513	ifeq ($(wildcard $(LDSCRIPT)),)
514		LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
515	endif
516	ifeq ($(wildcard $(LDSCRIPT)),)
517		LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot.lds
518	endif
519	ifeq ($(wildcard $(LDSCRIPT)),)
520		LDSCRIPT := $(TOPDIR)/arch/$(ARCH)/cpu/u-boot.lds
521		# We don't expect a Makefile here
522		LDSCRIPT_MAKEFILE_DIR =
523	endif
524	ifeq ($(wildcard $(LDSCRIPT)),)
525$(error could not find linker script)
526	endif
527endif
528
529#########################################################################
530# U-Boot objects....order is important (i.e. start must be first)
531
532head-y := $(CPUDIR)/start.o
533head-$(CONFIG_4xx) += arch/powerpc/cpu/ppc4xx/resetvec.o
534head-$(CONFIG_MPC85xx) += arch/powerpc/cpu/mpc85xx/resetvec.o
535
536OBJS := $(head-y)
537
538HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makefile),y,n)
539
540LIBS-y += lib/
541LIBS-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/
542LIBS-y += $(CPUDIR)/
543ifdef SOC
544LIBS-y += $(CPUDIR)/$(SOC)/
545endif
546LIBS-$(CONFIG_IXP4XX_NPE) += drivers/net/npe/
547LIBS-$(CONFIG_OF_EMBED) += dts/
548LIBS-y += arch/$(ARCH)/lib/
549LIBS-y += fs/
550LIBS-y += net/
551LIBS-y += disk/
552LIBS-y += drivers/
553LIBS-y += drivers/dma/
554LIBS-y += drivers/gpio/
555LIBS-y += drivers/i2c/
556LIBS-y += drivers/input/
557LIBS-y += drivers/mmc/
558LIBS-y += drivers/mtd/
559LIBS-$(CONFIG_CMD_NAND) += drivers/mtd/nand/
560LIBS-y += drivers/mtd/onenand/
561LIBS-$(CONFIG_CMD_UBI) += drivers/mtd/ubi/
562LIBS-y += drivers/mtd/spi/
563LIBS-y += drivers/net/
564LIBS-y += drivers/net/phy/
565LIBS-y += drivers/pci/
566LIBS-y += drivers/power/ \
567	drivers/power/fuel_gauge/ \
568	drivers/power/mfd/ \
569	drivers/power/pmic/ \
570	drivers/power/battery/
571LIBS-y += drivers/spi/
572LIBS-$(CONFIG_FMAN_ENET) += drivers/net/fm/
573LIBS-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/
574LIBS-y += drivers/serial/
575LIBS-y += drivers/usb/eth/
576LIBS-y += drivers/usb/gadget/
577LIBS-y += drivers/usb/host/
578LIBS-y += drivers/usb/musb/
579LIBS-y += drivers/usb/musb-new/
580LIBS-y += drivers/usb/phy/
581LIBS-y += drivers/usb/ulpi/
582LIBS-y += common/
583LIBS-y += lib/libfdt/
584LIBS-$(CONFIG_API) += api/
585LIBS-$(CONFIG_HAS_POST) += post/
586LIBS-y += test/
587
588ifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35 mxs vf610))
589LIBS-y += arch/$(ARCH)/imx-common/
590endif
591
592LIBS-$(CONFIG_ARM) += arch/arm/cpu/
593LIBS-$(CONFIG_PPC) += arch/powerpc/cpu/
594
595LIBS-y += board/$(BOARDDIR)/
596
597LIBS-y := $(patsubst %/, %/built-in.o, $(LIBS-y))
598LIBS := $(sort $(LIBS-y))
599.PHONY : $(LIBS)
600
601# Add GCC lib
602ifdef USE_PRIVATE_LIBGCC
603ifeq ("$(USE_PRIVATE_LIBGCC)", "yes")
604PLATFORM_LIBGCC = $(OBJTREE)/arch/$(ARCH)/lib/lib.a
605else
606PLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc
607endif
608else
609PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(c_flags) -print-libgcc-file-name`) -lgcc
610endif
611PLATFORM_LIBS += $(PLATFORM_LIBGCC)
612export PLATFORM_LIBS
613
614# Special flags for CPP when processing the linker script.
615# Pass the version down so we can handle backwards compatibility
616# on the fly.
617LDPPFLAGS += \
618	-include $(TOPDIR)/include/u-boot/u-boot.lds.h \
619	-DCPUDIR=$(CPUDIR) \
620	$(shell $(LD) --version | \
621	  sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p')
622
623#########################################################################
624#########################################################################
625
626ifneq ($(CONFIG_BOARD_SIZE_LIMIT),)
627BOARD_SIZE_CHECK = \
628	@actual=`wc -c $@ | awk '{print $$1}'`; \
629	limit=`printf "%d" $(CONFIG_BOARD_SIZE_LIMIT)`; \
630	if test $$actual -gt $$limit; then \
631		echo "$@ exceeds file size limit:" >&2 ; \
632		echo "  limit:  $$limit bytes" >&2 ; \
633		echo "  actual: $$actual bytes" >&2 ; \
634		echo "  excess: $$((actual - limit)) bytes" >&2; \
635		exit 1; \
636	fi
637else
638BOARD_SIZE_CHECK =
639endif
640
641# Statically apply RELA-style relocations (currently arm64 only)
642ifneq ($(CONFIG_STATIC_RELA),)
643# $(1) is u-boot ELF, $(2) is u-boot bin, $(3) is text base
644DO_STATIC_RELA = \
645	start=$$($(NM) $(1) | grep __rel_dyn_start | cut -f 1 -d ' '); \
646	end=$$($(NM) $(1) | grep __rel_dyn_end | cut -f 1 -d ' '); \
647	tools/relocate-rela $(2) $(3) $$start $$end
648else
649DO_STATIC_RELA =
650endif
651
652# Always append ALL so that arch config.mk's can add custom ones
653ALL-y += u-boot.srec u-boot.bin System.map
654
655ALL-$(CONFIG_NAND_U_BOOT) += u-boot-nand.bin
656ALL-$(CONFIG_ONENAND_U_BOOT) += u-boot-onenand.bin
657ALL-$(CONFIG_RAMBOOT_PBL) += u-boot.pbl
658ALL-$(CONFIG_SPL) += spl/u-boot-spl.bin
659ALL-$(CONFIG_SPL_FRAMEWORK) += u-boot.img
660ALL-$(CONFIG_TPL) += tpl/u-boot-tpl.bin
661ALL-$(CONFIG_OF_SEPARATE) += u-boot.dtb u-boot-dtb.bin
662ifneq ($(CONFIG_SPL_TARGET),)
663ALL-$(CONFIG_SPL) += $(CONFIG_SPL_TARGET:"%"=%)
664endif
665ALL-$(CONFIG_REMAKE_ELF) += u-boot.elf
666
667# enable combined SPL/u-boot/dtb rules for tegra
668ifneq ($(CONFIG_TEGRA),)
669ifeq ($(CONFIG_SPL),y)
670ifeq ($(CONFIG_OF_SEPARATE),y)
671ALL-y += u-boot-dtb-tegra.bin
672else
673ALL-y += u-boot-nodtb-tegra.bin
674endif
675endif
676endif
677
678all:		$(ALL-y) $(SUBDIR_EXAMPLES-y)
679
680u-boot.dtb:	checkdtc u-boot
681		$(MAKE) $(build)=dts binary
682		mv dts/dt.dtb $@
683
684u-boot-dtb.bin:	u-boot.bin u-boot.dtb
685		cat $^ >$@
686
687u-boot.hex:	u-boot
688		$(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
689
690u-boot.srec:	u-boot
691		$(OBJCOPY) ${OBJCFLAGS} -O srec $< $@
692
693u-boot.bin:	u-boot
694		$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
695		$(call DO_STATIC_RELA,$<,$@,$(CONFIG_SYS_TEXT_BASE))
696		$(BOARD_SIZE_CHECK)
697
698u-boot.ldr:	u-boot
699		$(CREATE_LDR_ENV)
700		$(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS)
701		$(BOARD_SIZE_CHECK)
702
703u-boot.ldr.hex:	u-boot.ldr
704		$(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@ -I binary
705
706u-boot.ldr.srec:	u-boot.ldr
707		$(OBJCOPY) ${OBJCFLAGS} -O srec $< $@ -I binary
708
709#
710# U-Boot entry point, needed for booting of full-blown U-Boot
711# from the SPL U-Boot version.
712#
713ifndef CONFIG_SYS_UBOOT_START
714CONFIG_SYS_UBOOT_START := 0
715endif
716
717u-boot.img:	u-boot.bin
718		tools/mkimage -A $(ARCH) -T firmware -C none \
719		-O u-boot -a $(CONFIG_SYS_TEXT_BASE) \
720		-e $(CONFIG_SYS_UBOOT_START) \
721		-n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
722			sed -e 's/"[	 ]*$$/ for $(BOARD) board"/') \
723		-d $< $@
724
725u-boot.imx: u-boot.bin depend
726		$(MAKE) $(build)=arch/arm/imx-common $(objtree)/u-boot.imx
727
728u-boot.kwb:       u-boot.bin
729		tools/mkimage -n $(CONFIG_SYS_KWD_CONFIG) -T kwbimage \
730		-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) -d $< $@
731
732u-boot.pbl:	u-boot.bin
733		tools/mkimage -n $(CONFIG_SYS_FSL_PBL_RCW) \
734		-R $(CONFIG_SYS_FSL_PBL_PBI) -T pblimage \
735		-d $< $@
736
737u-boot.sha1:	u-boot.bin
738		tools/ubsha1 u-boot.bin
739
740u-boot.dis:	u-boot
741		$(OBJDUMP) -d $< > $@
742
743# $@ is output, $(1) and $(2) are inputs, $(3) is padded intermediate,
744# $(4) is pad-to
745SPL_PAD_APPEND = \
746		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(4) -I binary -O binary \
747		$(1) $(3); \
748		cat $(3) $(2) > $@; \
749		rm $(3)
750
751ifdef CONFIG_TPL
752SPL_PAYLOAD := tpl/u-boot-with-tpl.bin
753else
754SPL_PAYLOAD := u-boot.bin
755endif
756
757u-boot-with-spl.bin: spl/u-boot-spl.bin $(SPL_PAYLOAD)
758		$(call SPL_PAD_APPEND,$<,$(SPL_PAYLOAD),spl/u-boot-spl-pad.bin,$(CONFIG_SPL_PAD_TO))
759
760tpl/u-boot-with-tpl.bin: tpl/u-boot-tpl.bin u-boot.bin
761		$(call SPL_PAD_APPEND,$<,u-boot.bin,tpl/u-boot-tpl-pad.bin,$(CONFIG_TPL_PAD_TO))
762
763u-boot-with-spl.imx: spl/u-boot-spl.bin u-boot.bin
764		$(MAKE) $(build)=arch/arm/imx-common \
765			$(OBJTREE)/u-boot-with-spl.imx
766
767u-boot-with-nand-spl.imx: spl/u-boot-spl.bin u-boot.bin
768		$(MAKE) $(build)=arch/arm/imx-common \
769			$(OBJTREE)/u-boot-with-nand-spl.imx
770
771u-boot.ubl:       u-boot-with-spl.bin
772		tools/mkimage -n $(UBL_CONFIG) -T ublimage \
773		-e $(CONFIG_SYS_TEXT_BASE) -d $< u-boot.ubl
774
775u-boot.ais:       spl/u-boot-spl.bin u-boot.img
776		tools/mkimage -s -n $(if $(CONFIG_AIS_CONFIG_FILE),$(srctree)/$(CONFIG_AIS_CONFIG_FILE:"%"=%),"/dev/null") \
777			-T aisimage \
778			-e $(CONFIG_SPL_TEXT_BASE) \
779			-d spl/u-boot-spl.bin \
780			spl/u-boot-spl.ais
781		$(OBJCOPY) ${OBJCFLAGS} -I binary \
782			--pad-to=$(CONFIG_SPL_MAX_SIZE) -O binary \
783			spl/u-boot-spl.ais spl/u-boot-spl-pad.ais
784		cat spl/u-boot-spl-pad.ais u-boot.img > u-boot.ais
785
786
787u-boot.sb:       u-boot.bin spl/u-boot-spl.bin
788		$(MAKE) $(build)=$(CPUDIR)/$(SOC)/ $(OBJTREE)/u-boot.sb
789
790# On x600 (SPEAr600) U-Boot is appended to U-Boot SPL.
791# Both images are created using mkimage (crc etc), so that the ROM
792# bootloader can check its integrity. Padding needs to be done to the
793# SPL image (with mkimage header) and not the binary. Otherwise the resulting image
794# which is loaded/copied by the ROM bootloader to SRAM doesn't fit.
795# The resulting image containing both U-Boot images is called u-boot.spr
796u-boot.spr:	u-boot.img spl/u-boot-spl.bin
797		tools/mkimage -A $(ARCH) -T firmware -C none \
798		-a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n XLOADER \
799		-d spl/u-boot-spl.bin $@
800		$(OBJCOPY) -I binary -O binary \
801			--pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff $@
802		cat u-boot.img >> $@
803
804ifneq ($(CONFIG_TEGRA),)
805u-boot-nodtb-tegra.bin: spl/u-boot-spl.bin u-boot.bin
806		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SYS_TEXT_BASE) -O binary spl/u-boot-spl spl/u-boot-spl-pad.bin
807		cat spl/u-boot-spl-pad.bin u-boot.bin > $@
808		rm spl/u-boot-spl-pad.bin
809
810ifeq ($(CONFIG_OF_SEPARATE),y)
811u-boot-dtb-tegra.bin: u-boot-nodtb-tegra.bin u-boot.dtb
812		cat u-boot-nodtb-tegra.bin u-boot.dtb > $@
813endif
814endif
815
816u-boot-img.bin: spl/u-boot-spl.bin u-boot.img
817		cat spl/u-boot-spl.bin u-boot.img > $@
818
819# PPC4xx needs the SPL at the end of the image, since the reset vector
820# is located at 0xfffffffc. So we can't use the "u-boot-img.bin" target
821# and need to introduce a new build target with the full blown U-Boot
822# at the start padded up to the start of the SPL image. And then concat
823# the SPL image to the end.
824u-boot-img-spl-at-end.bin: spl/u-boot-spl.bin u-boot.img
825		$(OBJCOPY) -I binary -O binary --pad-to=$(CONFIG_UBOOT_PAD_TO) \
826			 --gap-fill=0xff u-boot.img $@
827		cat spl/u-boot-spl.bin >> $@
828
829# Create a new ELF from a raw binary file.  This is useful for arm64
830# where static relocation needs to be performed on the raw binary,
831# but certain simulators only accept an ELF file (but don't do the
832# relocation).
833# FIXME refactor dts/Makefile to share target/arch detection
834u-boot.elf: u-boot.bin
835	@$(OBJCOPY)  -B aarch64 -I binary -O elf64-littleaarch64 \
836		$< u-boot-elf.o
837	@$(LD) u-boot-elf.o -o $@ \
838		--defsym=_start=$(CONFIG_SYS_TEXT_BASE) \
839		-Ttext=$(CONFIG_SYS_TEXT_BASE)
840
841ifeq ($(CONFIG_SANDBOX),y)
842GEN_UBOOT = \
843		$(CC) $(SYMS) -T u-boot.lds \
844			-Wl,--start-group $(LIBS) -Wl,--end-group \
845			$(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot.map -o u-boot
846else
847GEN_UBOOT = \
848		$(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \
849			$(OBJS) \
850			--start-group $(LIBS) --end-group $(PLATFORM_LIBS) \
851			-Map u-boot.map -o u-boot
852endif
853
854u-boot:	depend $(SUBDIR_TOOLS) $(OBJS) $(LIBS) u-boot.lds
855		$(GEN_UBOOT)
856ifeq ($(CONFIG_KALLSYMS),y)
857		smap=`$(call SYSTEM_MAP,u-boot) | \
858			awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 "\\\\000"}'` ; \
859		$(CC) $(c_flags) -DSYSTEM_MAP="\"$${smap}\"" \
860			-c $(srctree)/common/system_map.c -o common/system_map.o
861		$(GEN_UBOOT) common/system_map.o
862endif
863
864$(OBJS):
865	@:
866
867$(LIBS):	depend $(SUBDIR_TOOLS) scripts_basic
868		$(Q)$(MAKE) $(build)=$(patsubst %/,%,$(dir $@))
869
870$(SUBDIRS):	depend scripts_basic
871		$(Q)$(MAKE) $(build)=$@
872
873$(SUBDIR_EXAMPLES-y): u-boot
874
875u-boot.lds: $(LDSCRIPT) depend
876		$(CPP) $(cpp_flags) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$< >$@
877
878nand_spl:	$(TIMESTAMP_FILE) $(VERSION_FILE) depend scripts_basic
879		$(MAKE) $(build)=nand_spl/board/$(BOARDDIR) all
880
881u-boot-nand.bin:	nand_spl u-boot.bin
882		cat nand_spl/u-boot-spl-16k.bin u-boot.bin > u-boot-nand.bin
883
884spl/u-boot-spl.bin:	$(SUBDIR_TOOLS) depend scripts_basic
885		$(MAKE) obj=spl -f $(srctree)/spl/Makefile all
886
887tpl/u-boot-tpl.bin:	$(SUBDIR_TOOLS) depend scripts_basic
888		$(MAKE) obj=tpl -f $(srctree)/spl/Makefile all CONFIG_TPL_BUILD=y
889
890# Explicitly make _depend in subdirs containing multiple targets to prevent
891# parallel sub-makes creating .depend files simultaneously.
892depend dep:	$(TIMESTAMP_FILE) $(VERSION_FILE) \
893		include/spl-autoconf.mk \
894		include/tpl-autoconf.mk \
895		include/autoconf.mk \
896		include/generated/generic-asm-offsets.h \
897		include/generated/asm-offsets.h
898
899TAG_SUBDIRS = $(SUBDIRS)
900TAG_SUBDIRS += $(dir $(LIBS))
901TAG_SUBDIRS += include
902
903FIND := find
904FINDFLAGS := -L
905
906PHONY += checkstack
907
908checkstack:
909	$(OBJDUMP) -d u-boot $$(find . -name u-boot-spl) | \
910	$(PERL) $(src)/scripts/checkstack.pl $(ARCH)
911
912tags ctags:
913		ctags -w -o ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
914						-name '*.[chS]' -print`
915
916etags:
917		etags -a -o $(obj)etags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
918						-name '*.[chS]' -print`
919cscope:
920		$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) -name '*.[chS]' -print > \
921						cscope.files
922		cscope -b -q -k
923
924SYSTEM_MAP = \
925		$(NM) $1 | \
926		grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
927		LC_ALL=C sort
928System.map:	u-boot
929		@$(call SYSTEM_MAP,$<) > $@
930
931checkthumb:
932	@if test $(call cc-version) -lt 0404; then \
933		echo -n '*** Your GCC does not produce working '; \
934		echo 'binaries in THUMB mode.'; \
935		echo '*** Your board is configured for THUMB mode.'; \
936		false; \
937	fi
938
939# GCC 3.x is reported to have problems generating the type of relocation
940# that U-Boot wants.
941# See http://lists.denx.de/pipermail/u-boot/2012-September/135156.html
942checkgcc4:
943	@if test $(call cc-version) -lt 0400; then \
944		echo -n '*** Your GCC is too old, please upgrade to GCC 4.x or newer'; \
945		false; \
946	fi
947
948checkdtc:
949	@if test $(call dtc-version) -lt 0104; then \
950		echo '*** Your dtc is too old, please upgrade to dtc 1.4 or newer'; \
951		false; \
952	fi
953
954#
955# Auto-generate the autoconf.mk file (which is included by all makefiles)
956#
957# This target actually generates 2 files; autoconf.mk and autoconf.mk.dep.
958# the dep file is only include in this top level makefile to determine when
959# to regenerate the autoconf.mk file.
960
961quiet_cmd_autoconf_dep = GEN     $@
962      cmd_autoconf_dep = $(CC) -x c -DDO_DEPS_ONLY -M $(c_flags) \
963	-MQ include/autoconf.mk $(srctree)/include/common.h > $@ || rm $@
964
965include/autoconf.mk.dep: include/config.h include/common.h
966	$(call cmd,autoconf_dep)
967
968quiet_cmd_autoconf = GEN     $@
969      cmd_autoconf = \
970	$(CPP) $(c_flags) -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && \
971	sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp > $@; \
972	rm $@.tmp
973
974include/autoconf.mk: include/config.h
975	$(call cmd,autoconf)
976
977# Auto-generate the spl-autoconf.mk file (which is included by all makefiles for SPL)
978quiet_cmd_tpl-autoconf = GEN     $@
979      cmd_tpl-autoconf = \
980	$(CPP) $(c_flags) -DCONFIG_TPL_BUILD  -DCONFIG_SPL_BUILD\
981			-DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && \
982		sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp > $@; \
983	rm $@.tmp
984
985include/tpl-autoconf.mk: include/config.h
986	$(call cmd,tpl-autoconf)
987
988quiet_cmd_spl-autoconf = GEN     $@
989      cmd_spl-autoconf = \
990	$(CPP) $(c_flags) -DCONFIG_SPL_BUILD -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && \
991		sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp > $@; \
992	rm $@.tmp
993
994include/spl-autoconf.mk: include/config.h
995	$(call cmd,spl-autoconf)
996
997quiet_cmd_offsets = GEN     $@
998      cmd_offsets = $(srctree)/tools/scripts/make-asm-offsets $< $@
999
1000include/generated/generic-asm-offsets.h: lib/asm-offsets.s
1001	$(call cmd,offsets)
1002
1003quiet_cmd_asm-offsets.s = CC      $@
1004      cmd_asm-offsets.s = mkdir -p lib; \
1005		$(CC) -DDO_DEPS_ONLY \
1006		$(c_flags) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
1007		-o $@ $< -c -S
1008
1009lib/asm-offsets.s: $(srctree)/lib/asm-offsets.c include/config.h
1010	$(call cmd,asm-offsets.s)
1011
1012include/generated/asm-offsets.h: $(CPUDIR)/$(SOC)/asm-offsets.s
1013	$(call cmd,offsets)
1014
1015quiet_cmd_soc_asm-offsets.s = CC      $@
1016      cmd_soc_asm-offsets.s = mkdir -p $(CPUDIR)/$(SOC); \
1017	if [ -f $(srctree)/$(CPUDIR)/$(SOC)/asm-offsets.c ];then \
1018		$(CC) -DDO_DEPS_ONLY \
1019		$(c_flags) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
1020			-o $@ $(srctree)/$(CPUDIR)/$(SOC)/asm-offsets.c -c -S; \
1021	else \
1022		touch $@; \
1023	fi
1024
1025$(CPUDIR)/$(SOC)/asm-offsets.s:	include/config.h
1026	$(call cmd,soc_asm-offsets.s)
1027
1028#########################################################################
1029else	# !config.mk
1030all u-boot.hex u-boot.srec u-boot.bin \
1031u-boot.img u-boot.dis u-boot \
1032$(filter-out tools,$(SUBDIRS)) \
1033depend dep tags ctags etags cscope System.map:
1034	@echo "System not configured - see README" >&2
1035	@ exit 1
1036
1037tools: $(VERSION_FILE) $(TIMESTAMP_FILE)
1038	$(MAKE) $(build)=$@ all
1039endif	# config.mk
1040
1041# ARM relocations should all be R_ARM_RELATIVE (32-bit) or
1042# R_AARCH64_RELATIVE (64-bit).
1043checkarmreloc: u-boot
1044	@RELOC="`$(CROSS_COMPILE)readelf -r -W $< | cut -d ' ' -f 4 | \
1045		grep R_A | sort -u`"; \
1046	if test "$$RELOC" != "R_ARM_RELATIVE" -a \
1047		 "$$RELOC" != "R_AARCH64_RELATIVE"; then \
1048		echo "$< contains unexpected relocations: $$RELOC"; \
1049		false; \
1050	fi
1051
1052$(VERSION_FILE):
1053		@mkdir -p $(dir $(VERSION_FILE))
1054		@( localvers='$(shell $(TOPDIR)/scripts/setlocalversion $(TOPDIR))' ; \
1055		   printf '#define PLAIN_VERSION "%s%s"\n' \
1056			"$(U_BOOT_VERSION)" "$${localvers}" ; \
1057		   printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' \
1058			"$(U_BOOT_VERSION)" "$${localvers}" ; \
1059		) > $@.tmp
1060		@( printf '#define CC_VERSION_STRING "%s"\n' \
1061		 '$(shell $(CC) --version | head -n 1)' )>>  $@.tmp
1062		@( printf '#define LD_VERSION_STRING "%s"\n' \
1063		 '$(shell $(LD) -v | head -n 1)' )>>  $@.tmp
1064		@cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
1065
1066$(TIMESTAMP_FILE):
1067		@mkdir -p $(dir $(TIMESTAMP_FILE))
1068		@LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > $@.tmp
1069		@LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> $@.tmp
1070		@cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
1071
1072easylogo env gdb:
1073	$(Q)$(MAKE) $(build)=tools/$@ MTD_VERSION=${MTD_VERSION}
1074
1075gdbtools: gdb
1076
1077xmldocs pdfdocs psdocs htmldocs mandocs: tools/kernel-doc/docproc
1078	$(Q)$(MAKE) U_BOOT_VERSION=$(U_BOOT_VERSION) $(build)=doc/DocBook $@
1079
1080tools-all: easylogo env gdb $(VERSION_FILE) $(TIMESTAMP_FILE)
1081	$(Q)$(MAKE) $(build)=tools HOST_TOOLS_ALL=y
1082
1083.PHONY : CHANGELOG
1084CHANGELOG:
1085	git log --no-merges U-Boot-1_1_5.. | \
1086	unexpand -a | sed -e 's/\s\s*$$//' > $@
1087
1088include/license.h: tools/bin2header COPYING
1089	cat COPYING | gzip -9 -c | ./tools/bin2header license_gzip > include/license.h
1090#########################################################################
1091
1092unconfig:
1093	@rm -f include/config.h include/config.mk \
1094		board/*/config.tmp board/*/*/config.tmp \
1095		include/autoconf.mk include/autoconf.mk.dep \
1096		include/spl-autoconf.mk \
1097		include/tpl-autoconf.mk
1098
1099%_config::	unconfig
1100	@$(MKCONFIG) -A $(@:_config=)
1101
1102#########################################################################
1103
1104clean:
1105	@rm -f examples/standalone/atmel_df_pow2			  \
1106	       examples/standalone/hello_world				  \
1107	       examples/standalone/interrupt				  \
1108	       examples/standalone/mem_to_mem_idma2intr			  \
1109	       examples/standalone/sched				  \
1110	       $(addprefix examples/standalone/, smc91111_eeprom smc911x_eeprom) \
1111	       examples/standalone/test_burst				  \
1112	       examples/standalone/timer
1113	@rm -f $(addprefix examples/api/, demo demo.bin)
1114	@rm -f tools/bmp_logo	   tools/easylogo/easylogo		  \
1115	       tools/env/fw_printenv					  \
1116	       tools/envcrc						  \
1117	       $(addprefix tools/gdb/, gdbcont gdbsend)			  \
1118	       tools/gen_eth_addr    tools/img2srec			  \
1119	       tools/dumpimage						  \
1120	       $(addprefix tools/, mkenvimage mkimage)			  \
1121	       tools/mpc86x_clk						  \
1122	       $(addprefix tools/, mk$(BOARD)spl mkexynosspl)		  \
1123	       tools/mxsboot						  \
1124	       tools/ncb		   tools/ubsha1			  \
1125	       tools/kernel-doc/docproc					  \
1126	       tools/proftool
1127	@rm -f $(addprefix board/cray/L1/, bootscript.c bootscript.image) \
1128	       board/matrix_vision/*/bootscript.img			  \
1129	       spl/board/samsung/$(BOARD)/tools/mk$(BOARD)spl		  \
1130	       u-boot.lds						  \
1131	       $(addprefix arch/blackfin/cpu/, init.lds init.elf)
1132	@rm -f include/bmp_logo.h
1133	@rm -f include/bmp_logo_data.h
1134	@rm -f lib/asm-offsets.s
1135	@rm -f include/generated/asm-offsets.h
1136	@rm -f $(CPUDIR)/$(SOC)/asm-offsets.s
1137	@rm -f $(TIMESTAMP_FILE) $(VERSION_FILE)
1138	@$(MAKE) -f $(srctree)/doc/DocBook/Makefile cleandocs
1139	@find $(OBJTREE) -type f \
1140		\( -name 'core' -o -name '*.bak' -o -name '*~' -o -name '*.su' \
1141		-o -name '*.o'	-o -name '*.a' -o -name '*.exe' -o -name '*.cmd' \
1142		-o -name '*.cfgtmp' \) -print \
1143		| xargs rm -f
1144
1145# Removes everything not needed for testing u-boot
1146tidy:	clean
1147	@find $(OBJTREE) -type f \( -name '*.depend*' \) -print | xargs rm -f
1148
1149clobber:	tidy
1150	@find $(OBJTREE) -type f \( -name '*.srec' \
1151		-o -name '*.bin' -o -name u-boot.img \) \
1152		-print0 | xargs -0 rm -f
1153	@rm -f $(OBJS) *.bak ctags etags TAGS \
1154		cscope.* *.*~
1155	@rm -f u-boot u-boot.map u-boot.hex $(ALL-y)
1156	@rm -f u-boot.kwb
1157	@rm -f u-boot.pbl
1158	@rm -f u-boot.imx
1159	@rm -f u-boot-with-spl.imx
1160	@rm -f u-boot-with-nand-spl.imx
1161	@rm -f u-boot.ubl
1162	@rm -f u-boot.ais
1163	@rm -f u-boot.dtb
1164	@rm -f u-boot.sb
1165	@rm -f u-boot.spr
1166	@rm -f $(addprefix nand_spl/, u-boot.lds u-boot.lst System.map)
1167	@rm -f $(addprefix nand_spl/, u-boot-nand_spl.lds u-boot-spl u-boot-spl.map)
1168	@rm -f $(addprefix spl/, u-boot-spl u-boot-spl.bin u-boot-spl.map)
1169	@rm -f spl/u-boot-spl.lds
1170	@rm -f $(addprefix tpl/, u-boot-tpl u-boot-tpl.bin u-boot-tpl.map)
1171	@rm -f tpl/u-boot-spl.lds
1172	@rm -f MLO MLO.byteswap
1173	@rm -f SPL
1174	@rm -f tools/xway-swap-bytes
1175	@rm -fr include/asm/proc include/asm/arch include/asm
1176	@rm -fr include/generated
1177	@[ ! -d nand_spl ] || find nand_spl -name "*" -type l -print | xargs rm -f
1178	@rm -f dts/*.tmp
1179	@rm -f $(addprefix spl/, u-boot-spl.ais, u-boot-spl-pad.ais)
1180
1181mrproper \
1182distclean:	clobber unconfig
1183ifneq ($(OBJTREE),$(SRCTREE))
1184	rm -rf *
1185endif
1186
1187backup:
1188	F=`basename $(TOPDIR)` ; cd .. ; \
1189	gtar --force-local -zcvf `LC_ALL=C date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F
1190
1191#########################################################################
1192
1193endif	# skip-makefile
1194
1195PHONY += FORCE
1196FORCE:
1197
1198# Declare the contents of the .PHONY variable as phony.  We keep that
1199# information in a variable so we can use it in if_changed and friends.
1200.PHONY: $(PHONY)
1201