Makefile 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003
  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. VERSION = 2014
  8. PATCHLEVEL = 01
  9. SUBLEVEL =
  10. EXTRAVERSION =
  11. ifneq "$(SUBLEVEL)" ""
  12. U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
  13. else
  14. U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL)$(EXTRAVERSION)
  15. endif
  16. TIMESTAMP_FILE = $(obj)include/generated/timestamp_autogenerated.h
  17. VERSION_FILE = $(obj)include/generated/version_autogenerated.h
  18. HOSTARCH := $(shell uname -m | \
  19. sed -e s/i.86/x86/ \
  20. -e s/sun4u/sparc64/ \
  21. -e s/arm.*/arm/ \
  22. -e s/sa110/arm/ \
  23. -e s/ppc64/powerpc/ \
  24. -e s/ppc/powerpc/ \
  25. -e s/macppc/powerpc/\
  26. -e s/sh.*/sh/)
  27. HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
  28. sed -e 's/\(cygwin\).*/cygwin/')
  29. export HOSTARCH HOSTOS
  30. # Deal with colliding definitions from tcsh etc.
  31. VENDOR=
  32. #########################################################################
  33. # Allow for silent builds
  34. ifeq (,$(findstring s,$(MAKEFLAGS)))
  35. XECHO = echo
  36. else
  37. XECHO = :
  38. endif
  39. #########################################################################
  40. #
  41. # U-boot build supports generating object files in a separate external
  42. # directory. Two use cases are supported:
  43. #
  44. # 1) Add O= to the make command line
  45. # 'make O=/tmp/build all'
  46. #
  47. # 2) Set environment variable BUILD_DIR to point to the desired location
  48. # 'export BUILD_DIR=/tmp/build'
  49. # 'make'
  50. #
  51. # The second approach can also be used with a MAKEALL script
  52. # 'export BUILD_DIR=/tmp/build'
  53. # './MAKEALL'
  54. #
  55. # Command line 'O=' setting overrides BUILD_DIR environment variable.
  56. #
  57. # When none of the above methods is used the local build is performed and
  58. # the object files are placed in the source directory.
  59. #
  60. ifeq ("$(origin O)", "command line")
  61. BUILD_DIR := $(O)
  62. endif
  63. # Call a source code checker (by default, "sparse") as part of the
  64. # C compilation.
  65. #
  66. # Use 'make C=1' to enable checking of re-compiled files.
  67. #
  68. # See the linux kernel file "Documentation/sparse.txt" for more details,
  69. # including where to get the "sparse" utility.
  70. ifdef C
  71. ifeq ("$(origin C)", "command line")
  72. CHECKSRC := $(C)
  73. endif
  74. endif
  75. ifndef CHECKSRC
  76. CHECKSRC = 0
  77. endif
  78. export CHECKSRC
  79. ifneq ($(BUILD_DIR),)
  80. saved-output := $(BUILD_DIR)
  81. # Attempt to create a output directory.
  82. $(shell [ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR})
  83. # Verify if it was successful.
  84. BUILD_DIR := $(shell cd $(BUILD_DIR) && /bin/pwd)
  85. $(if $(BUILD_DIR),,$(error output directory "$(saved-output)" does not exist))
  86. endif # ifneq ($(BUILD_DIR),)
  87. OBJTREE := $(if $(BUILD_DIR),$(BUILD_DIR),$(CURDIR))
  88. SPLTREE := $(OBJTREE)/spl
  89. TPLTREE := $(OBJTREE)/tpl
  90. SRCTREE := $(CURDIR)
  91. srctree := $(SRCTREE)
  92. TOPDIR := $(SRCTREE)
  93. LNDIR := $(OBJTREE)
  94. export TOPDIR SRCTREE srctree OBJTREE SPLTREE TPLTREE
  95. MKCONFIG := $(SRCTREE)/mkconfig
  96. export MKCONFIG
  97. # $(obj) and (src) are defined in config.mk but here in main Makefile
  98. # we also need them before config.mk is included which is the case for
  99. # some targets like unconfig, clean, clobber, distclean, etc.
  100. ifneq ($(OBJTREE),$(SRCTREE))
  101. obj := $(OBJTREE)/
  102. src := $(SRCTREE)/
  103. else
  104. obj :=
  105. src :=
  106. endif
  107. export obj src
  108. # Make sure CDPATH settings don't interfere
  109. unexport CDPATH
  110. #########################################################################
  111. # The "tools" are needed early, so put this first
  112. # Don't include stuff already done in $(LIBS)
  113. # The "examples" conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC
  114. # is "yes"), so compile examples after U-Boot is compiled.
  115. SUBDIR_TOOLS = tools
  116. SUBDIRS = $(SUBDIR_TOOLS)
  117. .PHONY : $(SUBDIRS) $(VERSION_FILE) $(TIMESTAMP_FILE)
  118. ifeq ($(obj)include/config.mk,$(wildcard $(obj)include/config.mk))
  119. # Include autoconf.mk before config.mk so that the config options are available
  120. # to all top level build files. We need the dummy all: target to prevent the
  121. # dependency target in autoconf.mk.dep from being the default.
  122. all:
  123. sinclude $(obj)include/autoconf.mk.dep
  124. sinclude $(obj)include/autoconf.mk
  125. SUBDIR_EXAMPLES-y := examples/standalone
  126. SUBDIR_EXAMPLES-$(CONFIG_API) += examples/api
  127. ifndef CONFIG_SANDBOX
  128. SUBDIRS += $(SUBDIR_EXAMPLES-y)
  129. endif
  130. # load ARCH, BOARD, and CPU configuration
  131. include $(obj)include/config.mk
  132. export ARCH CPU BOARD VENDOR SOC
  133. # set default to nothing for native builds
  134. ifeq ($(HOSTARCH),$(ARCH))
  135. CROSS_COMPILE ?=
  136. endif
  137. # SHELL used by kbuild
  138. CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
  139. else if [ -x /bin/bash ]; then echo /bin/bash; \
  140. else echo sh; fi ; fi)
  141. HOSTCC = gcc
  142. HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
  143. ifeq ($(HOSTOS),cygwin)
  144. HOSTCFLAGS += -ansi
  145. endif
  146. # Mac OS X / Darwin's C preprocessor is Apple specific. It
  147. # generates numerous errors and warnings. We want to bypass it
  148. # and use GNU C's cpp. To do this we pass the -traditional-cpp
  149. # option to the compiler. Note that the -traditional-cpp flag
  150. # DOES NOT have the same semantics as GNU C's flag, all it does
  151. # is invoke the GNU preprocessor in stock ANSI/ISO C fashion.
  152. #
  153. # Apple's linker is similar, thanks to the new 2 stage linking
  154. # multiple symbol definitions are treated as errors, hence the
  155. # -multiply_defined suppress option to turn off this error.
  156. #
  157. ifeq ($(HOSTOS),darwin)
  158. # get major and minor product version (e.g. '10' and '6' for Snow Leopard)
  159. DARWIN_MAJOR_VERSION = $(shell sw_vers -productVersion | cut -f 1 -d '.')
  160. DARWIN_MINOR_VERSION = $(shell sw_vers -productVersion | cut -f 2 -d '.')
  161. os_x_before = $(shell if [ $(DARWIN_MAJOR_VERSION) -le $(1) -a \
  162. $(DARWIN_MINOR_VERSION) -le $(2) ] ; then echo "$(3)"; else echo "$(4)"; fi ;)
  163. # Snow Leopards build environment has no longer restrictions as described above
  164. HOSTCC = $(call os_x_before, 10, 5, "cc", "gcc")
  165. HOSTCFLAGS += $(call os_x_before, 10, 4, "-traditional-cpp")
  166. HOSTLDFLAGS += $(call os_x_before, 10, 5, "-multiply_defined suppress")
  167. endif
  168. # We need some generic definitions (do not try to remake the file).
  169. $(srctree)/scripts/Kbuild.include: ;
  170. include $(srctree)/scripts/Kbuild.include
  171. # Make variables (CC, etc...)
  172. AS = $(CROSS_COMPILE)as
  173. # Always use GNU ld
  174. ifneq ($(shell $(CROSS_COMPILE)ld.bfd -v 2> /dev/null),)
  175. LD = $(CROSS_COMPILE)ld.bfd
  176. else
  177. LD = $(CROSS_COMPILE)ld
  178. endif
  179. CC = $(CROSS_COMPILE)gcc
  180. CPP = $(CC) -E
  181. AR = $(CROSS_COMPILE)ar
  182. NM = $(CROSS_COMPILE)nm
  183. LDR = $(CROSS_COMPILE)ldr
  184. STRIP = $(CROSS_COMPILE)strip
  185. OBJCOPY = $(CROSS_COMPILE)objcopy
  186. OBJDUMP = $(CROSS_COMPILE)objdump
  187. AWK = awk
  188. RANLIB = $(CROSS_COMPILE)RANLIB
  189. DTC = dtc
  190. CHECK = sparse
  191. CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
  192. -Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF)
  193. # Use UBOOTINCLUDE when you must reference the include/ directory.
  194. # Needed to be compatible with the O= option
  195. UBOOTINCLUDE :=
  196. ifneq ($(OBJTREE),$(SRCTREE))
  197. UBOOTINCLUDE += -I$(OBJTREE)/include
  198. endif
  199. UBOOTINCLUDE += -I$(srctree)/include \
  200. -I$(srctree)/arch/$(ARCH)/include
  201. KBUILD_CPPFLAGS := -D__KERNEL__
  202. KBUILD_CFLAGS := -Wall -Wstrict-prototypes \
  203. -Wno-format-security \
  204. -fno-builtin -ffreestanding
  205. KBUILD_AFLAGS := -D__ASSEMBLY__
  206. export CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC
  207. export CPP AR NM LDR STRIP OBJCOPY OBJDUMP
  208. export MAKE AWK
  209. export DTC CHECK CHECKFLAGS
  210. export KBUILD_CPPFLAGS NOSTDINC_FLAGS UBOOTINCLUDE
  211. export KBUILD_CFLAGS KBUILD_AFLAGS
  212. KBUILD_CFLAGS += -Os #-fomit-frame-pointer
  213. ifdef BUILD_TAG
  214. KBUILD_CFLAGS += -DBUILD_TAG='"$(BUILD_TAG)"'
  215. endif
  216. KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
  217. KBUILD_CFLAGS += -g
  218. # $(KBUILD_AFLAGS) sets -g, which causes gcc to pass a suitable -g<format>
  219. # option to the assembler.
  220. KBUILD_AFLAGS += -g
  221. NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
  222. CHECKFLAGS += $(NOSTDINC_FLAGS)
  223. # Report stack usage if supported
  224. KBUILD_CFLAGS += $(call cc-option,-fstack-usage)
  225. KBUILD_CFLAGS += $(call cc-option,-Wno-format-nonliteral)
  226. # turn jbsr into jsr for m68k
  227. ifeq ($(ARCH),m68k)
  228. ifeq ($(findstring 3.4,$(shell $(CC) --version)),3.4)
  229. KBUILD_AFLAGS += -Wa,-gstabs,-S
  230. endif
  231. endif
  232. # load other configuration
  233. include $(TOPDIR)/config.mk
  234. ifneq ($(CONFIG_SYS_TEXT_BASE),)
  235. KBUILD_CPPFLAGS += -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE)
  236. endif
  237. export CONFIG_SYS_TEXT_BASE
  238. LDFLAGS_u-boot += -T $(obj)u-boot.lds $(LDFLAGS_FINAL)
  239. ifneq ($(CONFIG_SYS_TEXT_BASE),)
  240. LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE)
  241. endif
  242. # Targets which don't build the source code
  243. NON_BUILD_TARGETS = backup clean clobber distclean mrproper tidy unconfig %_config
  244. # Only do the generic board check when actually building, not configuring
  245. ifeq ($(filter $(NON_BUILD_TARGETS),$(MAKECMDGOALS)),)
  246. ifeq ($(__HAVE_ARCH_GENERIC_BOARD),)
  247. ifneq ($(CONFIG_SYS_GENERIC_BOARD),)
  248. CHECK_GENERIC_BOARD = $(error Your architecture does not support generic board. \
  249. Please undefined CONFIG_SYS_GENERIC_BOARD in your board config file)
  250. endif
  251. endif
  252. endif
  253. # If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use
  254. # that (or fail if absent). Otherwise, search for a linker script in a
  255. # standard location.
  256. LDSCRIPT_MAKEFILE_DIR = $(dir $(LDSCRIPT))
  257. ifndef LDSCRIPT
  258. #LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug
  259. ifdef CONFIG_SYS_LDSCRIPT
  260. # need to strip off double quotes
  261. LDSCRIPT := $(CONFIG_SYS_LDSCRIPT:"%"=%)
  262. endif
  263. endif
  264. # If there is no specified link script, we look in a number of places for it
  265. ifndef LDSCRIPT
  266. ifeq ($(CONFIG_NAND_U_BOOT),y)
  267. LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds
  268. ifeq ($(wildcard $(LDSCRIPT)),)
  269. LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds
  270. endif
  271. endif
  272. ifeq ($(wildcard $(LDSCRIPT)),)
  273. LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
  274. endif
  275. ifeq ($(wildcard $(LDSCRIPT)),)
  276. LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot.lds
  277. endif
  278. ifeq ($(wildcard $(LDSCRIPT)),)
  279. LDSCRIPT := $(TOPDIR)/arch/$(ARCH)/cpu/u-boot.lds
  280. # We don't expect a Makefile here
  281. LDSCRIPT_MAKEFILE_DIR =
  282. endif
  283. ifeq ($(wildcard $(LDSCRIPT)),)
  284. $(error could not find linker script)
  285. endif
  286. endif
  287. #########################################################################
  288. # U-Boot objects....order is important (i.e. start must be first)
  289. head-y := $(CPUDIR)/start.o
  290. head-$(CONFIG_4xx) += arch/powerpc/cpu/ppc4xx/resetvec.o
  291. head-$(CONFIG_MPC85xx) += arch/powerpc/cpu/mpc85xx/resetvec.o
  292. OBJS := $(addprefix $(obj),$(head-y))
  293. HAVE_VENDOR_COMMON_LIB = $(if $(wildcard board/$(VENDOR)/common/Makefile),y,n)
  294. LIBS-y += lib/
  295. LIBS-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/
  296. LIBS-y += $(CPUDIR)/
  297. ifdef SOC
  298. LIBS-y += $(CPUDIR)/$(SOC)/
  299. endif
  300. LIBS-$(CONFIG_IXP4XX_NPE) += drivers/net/npe/
  301. LIBS-$(CONFIG_OF_EMBED) += dts/
  302. LIBS-y += arch/$(ARCH)/lib/
  303. LIBS-y += fs/
  304. LIBS-y += net/
  305. LIBS-y += disk/
  306. LIBS-y += drivers/
  307. LIBS-y += drivers/dma/
  308. LIBS-y += drivers/gpio/
  309. LIBS-y += drivers/i2c/
  310. LIBS-y += drivers/input/
  311. LIBS-y += drivers/mmc/
  312. LIBS-y += drivers/mtd/
  313. LIBS-$(CONFIG_CMD_NAND) += drivers/mtd/nand/
  314. LIBS-y += drivers/mtd/onenand/
  315. LIBS-$(CONFIG_CMD_UBI) += drivers/mtd/ubi/
  316. LIBS-y += drivers/mtd/spi/
  317. LIBS-y += drivers/net/
  318. LIBS-y += drivers/net/phy/
  319. LIBS-y += drivers/pci/
  320. LIBS-y += drivers/power/ \
  321. drivers/power/fuel_gauge/ \
  322. drivers/power/mfd/ \
  323. drivers/power/pmic/ \
  324. drivers/power/battery/
  325. LIBS-y += drivers/spi/
  326. LIBS-$(CONFIG_FMAN_ENET) += drivers/net/fm/
  327. LIBS-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/
  328. LIBS-y += drivers/serial/
  329. LIBS-y += drivers/usb/eth/
  330. LIBS-y += drivers/usb/gadget/
  331. LIBS-y += drivers/usb/host/
  332. LIBS-y += drivers/usb/musb/
  333. LIBS-y += drivers/usb/musb-new/
  334. LIBS-y += drivers/usb/phy/
  335. LIBS-y += drivers/usb/ulpi/
  336. LIBS-y += common/
  337. LIBS-y += lib/libfdt/
  338. LIBS-$(CONFIG_API) += api/
  339. LIBS-$(CONFIG_HAS_POST) += post/
  340. LIBS-y += test/
  341. ifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35 mxs vf610))
  342. LIBS-y += arch/$(ARCH)/imx-common/
  343. endif
  344. LIBS-$(CONFIG_ARM) += arch/arm/cpu/
  345. LIBS-$(CONFIG_PPC) += arch/powerpc/cpu/
  346. LIBS-y += board/$(BOARDDIR)/
  347. LIBS-y := $(patsubst %/, %/built-in.o, $(LIBS-y))
  348. LIBS := $(addprefix $(obj),$(sort $(LIBS-y)))
  349. .PHONY : $(LIBS)
  350. # Add GCC lib
  351. ifdef USE_PRIVATE_LIBGCC
  352. ifeq ("$(USE_PRIVATE_LIBGCC)", "yes")
  353. PLATFORM_LIBGCC = $(OBJTREE)/arch/$(ARCH)/lib/libgcc.o
  354. else
  355. PLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc
  356. endif
  357. else
  358. PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
  359. endif
  360. PLATFORM_LIBS += $(PLATFORM_LIBGCC)
  361. export PLATFORM_LIBS
  362. # Special flags for CPP when processing the linker script.
  363. # Pass the version down so we can handle backwards compatibility
  364. # on the fly.
  365. LDPPFLAGS += \
  366. -include $(TOPDIR)/include/u-boot/u-boot.lds.h \
  367. -DCPUDIR=$(CPUDIR) \
  368. $(shell $(LD) --version | \
  369. sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p')
  370. __OBJS := $(subst $(obj),,$(OBJS))
  371. __LIBS := $(subst $(obj),,$(LIBS))
  372. #########################################################################
  373. #########################################################################
  374. ifneq ($(CONFIG_BOARD_SIZE_LIMIT),)
  375. BOARD_SIZE_CHECK = \
  376. @actual=`wc -c $@ | awk '{print $$1}'`; \
  377. limit=`printf "%d" $(CONFIG_BOARD_SIZE_LIMIT)`; \
  378. if test $$actual -gt $$limit; then \
  379. echo "$@ exceeds file size limit:" >&2 ; \
  380. echo " limit: $$limit bytes" >&2 ; \
  381. echo " actual: $$actual bytes" >&2 ; \
  382. echo " excess: $$((actual - limit)) bytes" >&2; \
  383. exit 1; \
  384. fi
  385. else
  386. BOARD_SIZE_CHECK =
  387. endif
  388. # Statically apply RELA-style relocations (currently arm64 only)
  389. ifneq ($(CONFIG_STATIC_RELA),)
  390. # $(1) is u-boot ELF, $(2) is u-boot bin, $(3) is text base
  391. DO_STATIC_RELA = \
  392. start=$$($(NM) $(1) | grep __rel_dyn_start | cut -f 1 -d ' '); \
  393. end=$$($(NM) $(1) | grep __rel_dyn_end | cut -f 1 -d ' '); \
  394. $(obj)tools/relocate-rela $(2) $(3) $$start $$end
  395. else
  396. DO_STATIC_RELA =
  397. endif
  398. # Always append ALL so that arch config.mk's can add custom ones
  399. ALL-y += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map
  400. ALL-$(CONFIG_NAND_U_BOOT) += $(obj)u-boot-nand.bin
  401. ALL-$(CONFIG_ONENAND_U_BOOT) += $(obj)u-boot-onenand.bin
  402. ALL-$(CONFIG_RAMBOOT_PBL) += $(obj)u-boot.pbl
  403. ALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin
  404. ALL-$(CONFIG_SPL_FRAMEWORK) += $(obj)u-boot.img
  405. ALL-$(CONFIG_TPL) += $(obj)tpl/u-boot-tpl.bin
  406. ALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot-dtb.bin
  407. ifneq ($(CONFIG_SPL_TARGET),)
  408. ALL-$(CONFIG_SPL) += $(obj)$(CONFIG_SPL_TARGET:"%"=%)
  409. endif
  410. ALL-$(CONFIG_REMAKE_ELF) += $(obj)u-boot.elf
  411. # enable combined SPL/u-boot/dtb rules for tegra
  412. ifneq ($(CONFIG_TEGRA),)
  413. ifeq ($(CONFIG_SPL),y)
  414. ifeq ($(CONFIG_OF_SEPARATE),y)
  415. ALL-y += $(obj)u-boot-dtb-tegra.bin
  416. else
  417. ALL-y += $(obj)u-boot-nodtb-tegra.bin
  418. endif
  419. endif
  420. endif
  421. all: $(ALL-y) $(SUBDIR_EXAMPLES-y)
  422. $(obj)u-boot.dtb: checkdtc $(obj)u-boot
  423. $(MAKE) $(build) dts binary
  424. mv $(obj)dts/dt.dtb $@
  425. $(obj)u-boot-dtb.bin: $(obj)u-boot.bin $(obj)u-boot.dtb
  426. cat $^ >$@
  427. $(obj)u-boot.hex: $(obj)u-boot
  428. $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
  429. $(obj)u-boot.srec: $(obj)u-boot
  430. $(OBJCOPY) ${OBJCFLAGS} -O srec $< $@
  431. $(obj)u-boot.bin: $(obj)u-boot
  432. $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
  433. $(call DO_STATIC_RELA,$<,$@,$(CONFIG_SYS_TEXT_BASE))
  434. $(BOARD_SIZE_CHECK)
  435. $(obj)u-boot.ldr: $(obj)u-boot
  436. $(CREATE_LDR_ENV)
  437. $(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS)
  438. $(BOARD_SIZE_CHECK)
  439. $(obj)u-boot.ldr.hex: $(obj)u-boot.ldr
  440. $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@ -I binary
  441. $(obj)u-boot.ldr.srec: $(obj)u-boot.ldr
  442. $(OBJCOPY) ${OBJCFLAGS} -O srec $< $@ -I binary
  443. #
  444. # U-Boot entry point, needed for booting of full-blown U-Boot
  445. # from the SPL U-Boot version.
  446. #
  447. ifndef CONFIG_SYS_UBOOT_START
  448. CONFIG_SYS_UBOOT_START := 0
  449. endif
  450. $(obj)u-boot.img: $(obj)u-boot.bin
  451. $(obj)tools/mkimage -A $(ARCH) -T firmware -C none \
  452. -O u-boot -a $(CONFIG_SYS_TEXT_BASE) \
  453. -e $(CONFIG_SYS_UBOOT_START) \
  454. -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
  455. sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \
  456. -d $< $@
  457. $(obj)u-boot.imx: $(obj)u-boot.bin depend
  458. $(MAKE) $(build) $(SRCTREE)/arch/arm/imx-common $(OBJTREE)/u-boot.imx
  459. $(obj)u-boot.kwb: $(obj)u-boot.bin
  460. $(obj)tools/mkimage -n $(CONFIG_SYS_KWD_CONFIG) -T kwbimage \
  461. -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) -d $< $@
  462. $(obj)u-boot.pbl: $(obj)u-boot.bin
  463. $(obj)tools/mkimage -n $(CONFIG_SYS_FSL_PBL_RCW) \
  464. -R $(CONFIG_SYS_FSL_PBL_PBI) -T pblimage \
  465. -d $< $@
  466. $(obj)u-boot.sha1: $(obj)u-boot.bin
  467. $(obj)tools/ubsha1 $(obj)u-boot.bin
  468. $(obj)u-boot.dis: $(obj)u-boot
  469. $(OBJDUMP) -d $< > $@
  470. # $@ is output, $(1) and $(2) are inputs, $(3) is padded intermediate,
  471. # $(4) is pad-to
  472. SPL_PAD_APPEND = \
  473. $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(4) -I binary -O binary \
  474. $(1) $(obj)$(3); \
  475. cat $(obj)$(3) $(2) > $@; \
  476. rm $(obj)$(3)
  477. ifdef CONFIG_TPL
  478. SPL_PAYLOAD := $(obj)tpl/u-boot-with-tpl.bin
  479. else
  480. SPL_PAYLOAD := $(obj)u-boot.bin
  481. endif
  482. $(obj)u-boot-with-spl.bin: $(obj)spl/u-boot-spl.bin $(SPL_PAYLOAD)
  483. $(call SPL_PAD_APPEND,$<,$(SPL_PAYLOAD),spl/u-boot-spl-pad.bin,$(CONFIG_SPL_PAD_TO))
  484. $(obj)tpl/u-boot-with-tpl.bin: $(obj)tpl/u-boot-tpl.bin $(obj)u-boot.bin
  485. $(call SPL_PAD_APPEND,$<,$(obj)u-boot.bin,tpl/u-boot-tpl-pad.bin,$(CONFIG_TPL_PAD_TO))
  486. $(obj)u-boot-with-spl.imx: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
  487. $(MAKE) $(build) $(SRCTREE)/arch/arm/imx-common \
  488. $(OBJTREE)/u-boot-with-spl.imx
  489. $(obj)u-boot-with-nand-spl.imx: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
  490. $(MAKE) $(build) $(SRCTREE)/arch/arm/imx-common \
  491. $(OBJTREE)/u-boot-with-nand-spl.imx
  492. $(obj)u-boot.ubl: $(obj)u-boot-with-spl.bin
  493. $(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \
  494. -e $(CONFIG_SYS_TEXT_BASE) -d $< $(obj)u-boot.ubl
  495. $(obj)u-boot.ais: $(obj)spl/u-boot-spl.bin $(obj)u-boot.img
  496. $(obj)tools/mkimage -s -n $(if $(CONFIG_AIS_CONFIG_FILE),$(CONFIG_AIS_CONFIG_FILE),"/dev/null") \
  497. -T aisimage \
  498. -e $(CONFIG_SPL_TEXT_BASE) \
  499. -d $(obj)spl/u-boot-spl.bin \
  500. $(obj)spl/u-boot-spl.ais
  501. $(OBJCOPY) ${OBJCFLAGS} -I binary \
  502. --pad-to=$(CONFIG_SPL_MAX_SIZE) -O binary \
  503. $(obj)spl/u-boot-spl.ais $(obj)spl/u-boot-spl-pad.ais
  504. cat $(obj)spl/u-boot-spl-pad.ais $(obj)u-boot.img > \
  505. $(obj)u-boot.ais
  506. $(obj)u-boot.sb: $(obj)u-boot.bin $(obj)spl/u-boot-spl.bin
  507. $(MAKE) $(build) $(SRCTREE)/$(CPUDIR)/$(SOC)/ $(OBJTREE)/u-boot.sb
  508. # On x600 (SPEAr600) U-Boot is appended to U-Boot SPL.
  509. # Both images are created using mkimage (crc etc), so that the ROM
  510. # bootloader can check its integrity. Padding needs to be done to the
  511. # SPL image (with mkimage header) and not the binary. Otherwise the resulting image
  512. # which is loaded/copied by the ROM bootloader to SRAM doesn't fit.
  513. # The resulting image containing both U-Boot images is called u-boot.spr
  514. $(obj)u-boot.spr: $(obj)u-boot.img $(obj)spl/u-boot-spl.bin
  515. $(obj)tools/mkimage -A $(ARCH) -T firmware -C none \
  516. -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n XLOADER \
  517. -d $(obj)spl/u-boot-spl.bin $@
  518. $(OBJCOPY) -I binary -O binary \
  519. --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff $@
  520. cat $(obj)u-boot.img >> $@
  521. ifneq ($(CONFIG_TEGRA),)
  522. $(obj)u-boot-nodtb-tegra.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
  523. $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SYS_TEXT_BASE) -O binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin
  524. cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > $@
  525. rm $(obj)spl/u-boot-spl-pad.bin
  526. ifeq ($(CONFIG_OF_SEPARATE),y)
  527. $(obj)u-boot-dtb-tegra.bin: $(obj)u-boot-nodtb-tegra.bin $(obj)u-boot.dtb
  528. cat $(obj)u-boot-nodtb-tegra.bin $(obj)u-boot.dtb > $@
  529. endif
  530. endif
  531. $(obj)u-boot-img.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.img
  532. cat $(obj)spl/u-boot-spl.bin $(obj)u-boot.img > $@
  533. # PPC4xx needs the SPL at the end of the image, since the reset vector
  534. # is located at 0xfffffffc. So we can't use the "u-boot-img.bin" target
  535. # and need to introduce a new build target with the full blown U-Boot
  536. # at the start padded up to the start of the SPL image. And then concat
  537. # the SPL image to the end.
  538. $(obj)u-boot-img-spl-at-end.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.img
  539. $(OBJCOPY) -I binary -O binary --pad-to=$(CONFIG_UBOOT_PAD_TO) \
  540. --gap-fill=0xff $(obj)u-boot.img $@
  541. cat $(obj)spl/u-boot-spl.bin >> $@
  542. # Create a new ELF from a raw binary file. This is useful for arm64
  543. # where static relocation needs to be performed on the raw binary,
  544. # but certain simulators only accept an ELF file (but don't do the
  545. # relocation).
  546. # FIXME refactor dts/Makefile to share target/arch detection
  547. $(obj)u-boot.elf: $(obj)u-boot.bin
  548. @$(OBJCOPY) -B aarch64 -I binary -O elf64-littleaarch64 \
  549. $< $(obj)u-boot-elf.o
  550. @$(LD) $(obj)u-boot-elf.o -o $@ \
  551. --defsym=_start=$(CONFIG_SYS_TEXT_BASE) \
  552. -Ttext=$(CONFIG_SYS_TEXT_BASE)
  553. ifeq ($(CONFIG_SANDBOX),y)
  554. GEN_UBOOT = \
  555. cd $(LNDIR) && $(CC) $(SYMS) -T $(obj)u-boot.lds \
  556. -Wl,--start-group $(__LIBS) -Wl,--end-group \
  557. $(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot.map -o u-boot
  558. else
  559. GEN_UBOOT = \
  560. cd $(LNDIR) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \
  561. $(__OBJS) \
  562. --start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
  563. -Map u-boot.map -o u-boot
  564. endif
  565. $(obj)u-boot: depend \
  566. $(SUBDIR_TOOLS) $(OBJS) $(LIBS) $(obj)u-boot.lds
  567. $(GEN_UBOOT)
  568. ifeq ($(CONFIG_KALLSYMS),y)
  569. smap=`$(call SYSTEM_MAP,$(obj)u-boot) | \
  570. awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 "\\\\000"}'` ; \
  571. $(CC) $(CFLAGS) -DSYSTEM_MAP="\"$${smap}\"" \
  572. -c common/system_map.c -o $(obj)common/system_map.o
  573. $(GEN_UBOOT) $(obj)common/system_map.o
  574. endif
  575. $(OBJS):
  576. @:
  577. $(LIBS): depend $(SUBDIR_TOOLS)
  578. $(MAKE) $(build) $(dir $(subst $(obj),,$@))
  579. $(SUBDIRS): depend
  580. $(MAKE) $(build) $@ all
  581. $(SUBDIR_EXAMPLES-y): $(obj)u-boot
  582. $(obj)u-boot.lds: $(LDSCRIPT) depend
  583. $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$< >$@
  584. nand_spl: $(TIMESTAMP_FILE) $(VERSION_FILE) depend
  585. $(MAKE) $(build) nand_spl/board/$(BOARDDIR) all
  586. $(obj)u-boot-nand.bin: nand_spl $(obj)u-boot.bin
  587. cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin
  588. $(obj)spl/u-boot-spl.bin: $(SUBDIR_TOOLS) depend
  589. $(MAKE) -C spl all
  590. $(obj)tpl/u-boot-tpl.bin: $(SUBDIR_TOOLS) depend
  591. $(MAKE) -C spl all CONFIG_TPL_BUILD=y
  592. # Explicitly make _depend in subdirs containing multiple targets to prevent
  593. # parallel sub-makes creating .depend files simultaneously.
  594. depend dep: $(TIMESTAMP_FILE) $(VERSION_FILE) \
  595. $(obj)include/spl-autoconf.mk \
  596. $(obj)include/tpl-autoconf.mk \
  597. $(obj)include/autoconf.mk \
  598. $(obj)include/generated/generic-asm-offsets.h \
  599. $(obj)include/generated/asm-offsets.h
  600. TAG_SUBDIRS = $(SUBDIRS)
  601. TAG_SUBDIRS += $(dir $(__LIBS))
  602. TAG_SUBDIRS += include
  603. FIND := find
  604. FINDFLAGS := -L
  605. checkstack:
  606. $(CROSS_COMPILE)objdump -d $(obj)u-boot \
  607. `$(FIND) $(obj) -name u-boot-spl -print` | \
  608. perl $(src)scripts/checkstack.pl $(ARCH)
  609. tags ctags:
  610. ctags -w -o $(obj)ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
  611. -name '*.[chS]' -print`
  612. etags:
  613. etags -a -o $(obj)etags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
  614. -name '*.[chS]' -print`
  615. cscope:
  616. $(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) -name '*.[chS]' -print > \
  617. cscope.files
  618. cscope -b -q -k
  619. SYSTEM_MAP = \
  620. $(NM) $1 | \
  621. grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
  622. LC_ALL=C sort
  623. $(obj)System.map: $(obj)u-boot
  624. @$(call SYSTEM_MAP,$<) > $@
  625. checkthumb:
  626. @if test $(call cc-version) -lt 0404; then \
  627. echo -n '*** Your GCC does not produce working '; \
  628. echo 'binaries in THUMB mode.'; \
  629. echo '*** Your board is configured for THUMB mode.'; \
  630. false; \
  631. fi
  632. # GCC 3.x is reported to have problems generating the type of relocation
  633. # that U-Boot wants.
  634. # See http://lists.denx.de/pipermail/u-boot/2012-September/135156.html
  635. checkgcc4:
  636. @if test $(call cc-version) -lt 0400; then \
  637. echo -n '*** Your GCC is too old, please upgrade to GCC 4.x or newer'; \
  638. false; \
  639. fi
  640. checkdtc:
  641. @if test $(call dtc-version) -lt 0104; then \
  642. echo '*** Your dtc is too old, please upgrade to dtc 1.4 or newer'; \
  643. false; \
  644. fi
  645. #
  646. # Auto-generate the autoconf.mk file (which is included by all makefiles)
  647. #
  648. # This target actually generates 2 files; autoconf.mk and autoconf.mk.dep.
  649. # the dep file is only include in this top level makefile to determine when
  650. # to regenerate the autoconf.mk file.
  651. $(obj)include/autoconf.mk.dep: $(obj)include/config.h include/common.h
  652. @$(XECHO) Generating $@ ; \
  653. : Generate the dependancies ; \
  654. $(CC) -x c -DDO_DEPS_ONLY -M $(CFLAGS) $(CPPFLAGS) \
  655. -MQ $(obj)include/autoconf.mk include/common.h > $@ || \
  656. rm $@
  657. $(obj)include/autoconf.mk: $(obj)include/config.h
  658. @$(XECHO) Generating $@ ; \
  659. : Extract the config macros ; \
  660. $(CPP) $(CFLAGS) -DDO_DEPS_ONLY -dM include/common.h > $@.tmp && \
  661. sed -n -f tools/scripts/define2mk.sed $@.tmp > $@; \
  662. rm $@.tmp
  663. # Auto-generate the spl-autoconf.mk file (which is included by all makefiles for SPL)
  664. $(obj)include/tpl-autoconf.mk: $(obj)include/config.h
  665. @$(XECHO) Generating $@ ; \
  666. : Extract the config macros ; \
  667. $(CPP) $(CFLAGS) -DCONFIG_TPL_BUILD -DCONFIG_SPL_BUILD\
  668. -DDO_DEPS_ONLY -dM include/common.h > $@.tmp && \
  669. sed -n -f tools/scripts/define2mk.sed $@.tmp > $@; \
  670. rm $@.tmp
  671. $(obj)include/spl-autoconf.mk: $(obj)include/config.h
  672. @$(XECHO) Generating $@ ; \
  673. : Extract the config macros ; \
  674. $(CPP) $(CFLAGS) -DCONFIG_SPL_BUILD -DDO_DEPS_ONLY -dM include/common.h > $@.tmp && \
  675. sed -n -f tools/scripts/define2mk.sed $@.tmp > $@; \
  676. rm $@.tmp
  677. $(obj)include/generated/generic-asm-offsets.h: $(obj)lib/asm-offsets.s
  678. @$(XECHO) Generating $@
  679. tools/scripts/make-asm-offsets $(obj)lib/asm-offsets.s $@
  680. $(obj)lib/asm-offsets.s: $(obj)include/config.h $(src)lib/asm-offsets.c
  681. @mkdir -p $(obj)lib
  682. $(CC) -DDO_DEPS_ONLY \
  683. $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
  684. -o $@ $(src)lib/asm-offsets.c -c -S
  685. $(obj)include/generated/asm-offsets.h: $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s
  686. @$(XECHO) Generating $@
  687. tools/scripts/make-asm-offsets $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s $@
  688. $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s: $(obj)include/config.h
  689. @mkdir -p $(obj)$(CPUDIR)/$(SOC)
  690. if [ -f $(src)$(CPUDIR)/$(SOC)/asm-offsets.c ];then \
  691. $(CC) -DDO_DEPS_ONLY \
  692. $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
  693. -o $@ $(src)$(CPUDIR)/$(SOC)/asm-offsets.c -c -S; \
  694. else \
  695. touch $@; \
  696. fi
  697. #########################################################################
  698. else # !config.mk
  699. all $(obj)u-boot.hex $(obj)u-boot.srec $(obj)u-boot.bin \
  700. $(obj)u-boot.img $(obj)u-boot.dis $(obj)u-boot \
  701. $(filter-out tools,$(SUBDIRS)) \
  702. depend dep tags ctags etags cscope $(obj)System.map:
  703. @echo "System not configured - see README" >&2
  704. @ exit 1
  705. tools: $(VERSION_FILE) $(TIMESTAMP_FILE)
  706. $(MAKE) $(build) $@ all
  707. endif # config.mk
  708. # ARM relocations should all be R_ARM_RELATIVE (32-bit) or
  709. # R_AARCH64_RELATIVE (64-bit).
  710. checkarmreloc: $(obj)u-boot
  711. @RELOC="`$(CROSS_COMPILE)readelf -r -W $< | cut -d ' ' -f 4 | \
  712. grep R_A | sort -u`"; \
  713. if test "$$RELOC" != "R_ARM_RELATIVE" -a \
  714. "$$RELOC" != "R_AARCH64_RELATIVE"; then \
  715. echo "$< contains unexpected relocations: $$RELOC"; \
  716. false; \
  717. fi
  718. $(VERSION_FILE):
  719. @mkdir -p $(dir $(VERSION_FILE))
  720. @( localvers='$(shell $(TOPDIR)/scripts/setlocalversion $(TOPDIR))' ; \
  721. printf '#define PLAIN_VERSION "%s%s"\n' \
  722. "$(U_BOOT_VERSION)" "$${localvers}" ; \
  723. printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' \
  724. "$(U_BOOT_VERSION)" "$${localvers}" ; \
  725. ) > $@.tmp
  726. @( printf '#define CC_VERSION_STRING "%s"\n' \
  727. '$(shell $(CC) --version | head -n 1)' )>> $@.tmp
  728. @( printf '#define LD_VERSION_STRING "%s"\n' \
  729. '$(shell $(LD) -v | head -n 1)' )>> $@.tmp
  730. @cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
  731. $(TIMESTAMP_FILE):
  732. @mkdir -p $(dir $(TIMESTAMP_FILE))
  733. @LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > $@.tmp
  734. @LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> $@.tmp
  735. @cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
  736. easylogo env gdb:
  737. $(MAKE) $(build) tools/$@ MTD_VERSION=${MTD_VERSION}
  738. gdbtools: gdb
  739. xmldocs pdfdocs psdocs htmldocs mandocs: tools/kernel-doc/docproc
  740. $(MAKE) U_BOOT_VERSION=$(U_BOOT_VERSION) -C doc/DocBook/ $@
  741. tools-all: easylogo env gdb $(VERSION_FILE) $(TIMESTAMP_FILE)
  742. $(MAKE) $(build) tools HOST_TOOLS_ALL=y
  743. .PHONY : CHANGELOG
  744. CHANGELOG:
  745. git log --no-merges U-Boot-1_1_5.. | \
  746. unexpand -a | sed -e 's/\s\s*$$//' > $@
  747. include/license.h: tools/bin2header COPYING
  748. cat COPYING | gzip -9 -c | ./tools/bin2header license_gzip > include/license.h
  749. #########################################################################
  750. unconfig:
  751. @rm -f $(obj)include/config.h $(obj)include/config.mk \
  752. $(obj)board/*/config.tmp $(obj)board/*/*/config.tmp \
  753. $(obj)include/autoconf.mk $(obj)include/autoconf.mk.dep \
  754. $(obj)include/spl-autoconf.mk \
  755. $(obj)include/tpl-autoconf.mk
  756. %_config:: unconfig
  757. @$(MKCONFIG) -A $(@:_config=)
  758. sinclude $(obj).boards.depend
  759. $(obj).boards.depend: boards.cfg
  760. @awk '(NF && $$1 !~ /^#/) { print $$7 ": " $$7 "_config; $$(MAKE)" }' $< > $@
  761. #########################################################################
  762. #########################################################################
  763. clean:
  764. @rm -f $(obj)examples/standalone/atmel_df_pow2 \
  765. $(obj)examples/standalone/hello_world \
  766. $(obj)examples/standalone/interrupt \
  767. $(obj)examples/standalone/mem_to_mem_idma2intr \
  768. $(obj)examples/standalone/sched \
  769. $(addprefix $(obj)examples/standalone/, smc91111_eeprom smc911x_eeprom) \
  770. $(obj)examples/standalone/test_burst \
  771. $(obj)examples/standalone/timer
  772. @rm -f $(addprefix $(obj)examples/api/, demo demo.bin)
  773. @rm -f $(obj)tools/bmp_logo $(obj)tools/easylogo/easylogo \
  774. $(obj)tools/env/fw_printenv \
  775. $(obj)tools/envcrc \
  776. $(addprefix $(obj)tools/gdb/, gdbcont gdbsend) \
  777. $(obj)tools/gen_eth_addr $(obj)tools/img2srec \
  778. $(obj)tools/dumpimage \
  779. $(addprefix $(obj)tools/, mkenvimage mkimage) \
  780. $(obj)tools/mpc86x_clk \
  781. $(addprefix $(obj)tools/, mk$(BOARD)spl mkexynosspl) \
  782. $(obj)tools/mxsboot \
  783. $(obj)tools/ncb $(obj)tools/ubsha1 \
  784. $(obj)tools/kernel-doc/docproc \
  785. $(obj)tools/proftool
  786. @rm -f $(addprefix $(obj)board/cray/L1/, bootscript.c bootscript.image) \
  787. $(obj)board/matrix_vision/*/bootscript.img \
  788. $(obj)spl/board/samsung/$(BOARD)/tools/mk$(BOARD)spl \
  789. $(obj)u-boot.lds \
  790. $(addprefix $(obj)arch/blackfin/cpu/, init.lds init.elf)
  791. @rm -f $(obj)include/bmp_logo.h
  792. @rm -f $(obj)include/bmp_logo_data.h
  793. @rm -f $(obj)lib/asm-offsets.s
  794. @rm -f $(obj)include/generated/asm-offsets.h
  795. @rm -f $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s
  796. @rm -f $(TIMESTAMP_FILE) $(VERSION_FILE)
  797. @$(MAKE) -s -C doc/DocBook/ cleandocs
  798. @find $(OBJTREE) -type f \
  799. \( -name 'core' -o -name '*.bak' -o -name '*~' -o -name '*.su' \
  800. -o -name '*.o' -o -name '*.a' -o -name '*.exe' \
  801. -o -name '*.cfgtmp' \) -print \
  802. | xargs rm -f
  803. # Removes everything not needed for testing u-boot
  804. tidy: clean
  805. @find $(OBJTREE) -type f \( -name '*.depend*' \) -print | xargs rm -f
  806. clobber: tidy
  807. @find $(OBJTREE) -type f \( -name '*.srec' \
  808. -o -name '*.bin' -o -name u-boot.img \) \
  809. -print0 | xargs -0 rm -f
  810. @rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS \
  811. $(obj)cscope.* $(obj)*.*~
  812. @rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL-y)
  813. @rm -f $(obj)u-boot.kwb
  814. @rm -f $(obj)u-boot.pbl
  815. @rm -f $(obj)u-boot.imx
  816. @rm -f $(obj)u-boot-with-spl.imx
  817. @rm -f $(obj)u-boot-with-nand-spl.imx
  818. @rm -f $(obj)u-boot.ubl
  819. @rm -f $(obj)u-boot.ais
  820. @rm -f $(obj)u-boot.dtb
  821. @rm -f $(obj)u-boot.sb
  822. @rm -f $(obj)u-boot.spr
  823. @rm -f $(addprefix $(obj)nand_spl/, u-boot.lds u-boot.lst System.map)
  824. @rm -f $(addprefix $(obj)nand_spl/, u-boot-nand_spl.lds u-boot-spl u-boot-spl.map)
  825. @rm -f $(addprefix $(obj)spl/, u-boot-spl u-boot-spl.bin u-boot-spl.map)
  826. @rm -f $(obj)spl/u-boot-spl.lds
  827. @rm -f $(addprefix $(obj)tpl/, u-boot-tpl u-boot-tpl.bin u-boot-tpl.map)
  828. @rm -f $(obj)tpl/u-boot-spl.lds
  829. @rm -f $(obj)MLO MLO.byteswap
  830. @rm -f $(obj)SPL
  831. @rm -f $(obj)tools/xway-swap-bytes
  832. @rm -fr $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
  833. @rm -fr $(obj)include/generated
  834. @[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name "*" -type l -print | xargs rm -f
  835. @rm -f $(obj)dts/*.tmp
  836. @rm -f $(addprefix $(obj)spl/, u-boot-spl.ais, u-boot-spl-pad.ais)
  837. mrproper \
  838. distclean: clobber unconfig
  839. ifneq ($(OBJTREE),$(SRCTREE))
  840. rm -rf $(obj)*
  841. endif
  842. backup:
  843. F=`basename $(TOPDIR)` ; cd .. ; \
  844. gtar --force-local -zcvf `LC_ALL=C date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F
  845. #########################################################################