Makefile 36 KB

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