Makefile 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559
  1. VERSION = 2015
  2. PATCHLEVEL = 04
  3. SUBLEVEL =
  4. EXTRAVERSION =
  5. NAME =
  6. # *DOCUMENTATION*
  7. # To see a list of typical targets execute "make help"
  8. # More info can be located in ./README
  9. # Comments in this file are targeted only to the developer, do not
  10. # expect to learn how to build the kernel reading this file.
  11. # Do not use make's built-in rules and variables
  12. # (this increases performance and avoids hard-to-debug behaviour);
  13. MAKEFLAGS += -rR
  14. # Avoid funny character set dependencies
  15. unexport LC_ALL
  16. LC_COLLATE=C
  17. LC_NUMERIC=C
  18. export LC_COLLATE LC_NUMERIC
  19. # Avoid interference with shell env settings
  20. unexport GREP_OPTIONS
  21. # We are using a recursive build, so we need to do a little thinking
  22. # to get the ordering right.
  23. #
  24. # Most importantly: sub-Makefiles should only ever modify files in
  25. # their own directory. If in some directory we have a dependency on
  26. # a file in another dir (which doesn't happen often, but it's often
  27. # unavoidable when linking the built-in.o targets which finally
  28. # turn into vmlinux), we will call a sub make in that other dir, and
  29. # after that we are sure that everything which is in that other dir
  30. # is now up to date.
  31. #
  32. # The only cases where we need to modify files which have global
  33. # effects are thus separated out and done before the recursive
  34. # descending is started. They are now explicitly listed as the
  35. # prepare rule.
  36. # Beautify output
  37. # ---------------------------------------------------------------------------
  38. #
  39. # Normally, we echo the whole command before executing it. By making
  40. # that echo $($(quiet)$(cmd)), we now have the possibility to set
  41. # $(quiet) to choose other forms of output instead, e.g.
  42. #
  43. # quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@
  44. # cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
  45. #
  46. # If $(quiet) is empty, the whole command will be printed.
  47. # If it is set to "quiet_", only the short version will be printed.
  48. # If it is set to "silent_", nothing will be printed at all, since
  49. # the variable $(silent_cmd_cc_o_c) doesn't exist.
  50. #
  51. # A simple variant is to prefix commands with $(Q) - that's useful
  52. # for commands that shall be hidden in non-verbose mode.
  53. #
  54. # $(Q)ln $@ :<
  55. #
  56. # If KBUILD_VERBOSE equals 0 then the above command will be hidden.
  57. # If KBUILD_VERBOSE equals 1 then the above command is displayed.
  58. #
  59. # To put more focus on warnings, be less verbose as default
  60. # Use 'make V=1' to see the full commands
  61. ifeq ("$(origin V)", "command line")
  62. KBUILD_VERBOSE = $(V)
  63. endif
  64. ifndef KBUILD_VERBOSE
  65. KBUILD_VERBOSE = 0
  66. endif
  67. ifeq ($(KBUILD_VERBOSE),1)
  68. quiet =
  69. Q =
  70. else
  71. quiet=quiet_
  72. Q = @
  73. endif
  74. # If the user is running make -s (silent mode), suppress echoing of
  75. # commands
  76. ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4
  77. ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
  78. quiet=silent_
  79. endif
  80. else # make-3.8x
  81. ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
  82. quiet=silent_
  83. endif
  84. endif
  85. export quiet Q KBUILD_VERBOSE
  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. # KBUILD_SRC is set on invocation of make in OBJ directory
  101. # KBUILD_SRC is not intended to be used by the regular user (for now)
  102. ifeq ($(KBUILD_SRC),)
  103. # OK, Make called in directory where kernel src resides
  104. # Do we want to locate output files in a separate directory?
  105. ifeq ("$(origin O)", "command line")
  106. KBUILD_OUTPUT := $(O)
  107. endif
  108. # That's our default target when none is given on the command line
  109. PHONY := _all
  110. _all:
  111. # Cancel implicit rules on top Makefile
  112. $(CURDIR)/Makefile Makefile: ;
  113. ifneq ($(KBUILD_OUTPUT),)
  114. # Invoke a second make in the output directory, passing relevant variables
  115. # check that the output directory actually exists
  116. saved-output := $(KBUILD_OUTPUT)
  117. KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \
  118. && /bin/pwd)
  119. $(if $(KBUILD_OUTPUT),, \
  120. $(error failed to create output directory "$(saved-output)"))
  121. PHONY += $(MAKECMDGOALS) sub-make
  122. $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
  123. @:
  124. sub-make: FORCE
  125. $(Q)$(MAKE) -C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR) \
  126. -f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS))
  127. # Leave processing to above invocation of make
  128. skip-makefile := 1
  129. endif # ifneq ($(KBUILD_OUTPUT),)
  130. endif # ifeq ($(KBUILD_SRC),)
  131. # We process the rest of the Makefile if this is the final invocation of make
  132. ifeq ($(skip-makefile),)
  133. # Do not print "Entering directory ...",
  134. # but we want to display it when entering to the output directory
  135. # so that IDEs/editors are able to understand relative filenames.
  136. MAKEFLAGS += --no-print-directory
  137. # Call a source code checker (by default, "sparse") as part of the
  138. # C compilation.
  139. #
  140. # Use 'make C=1' to enable checking of only re-compiled files.
  141. # Use 'make C=2' to enable checking of *all* source files, regardless
  142. # of whether they are re-compiled or not.
  143. #
  144. # See the file "Documentation/sparse.txt" for more details, including
  145. # where to get the "sparse" utility.
  146. ifeq ("$(origin C)", "command line")
  147. KBUILD_CHECKSRC = $(C)
  148. endif
  149. ifndef KBUILD_CHECKSRC
  150. KBUILD_CHECKSRC = 0
  151. endif
  152. # Use make M=dir to specify directory of external module to build
  153. # Old syntax make ... SUBDIRS=$PWD is still supported
  154. # Setting the environment variable KBUILD_EXTMOD take precedence
  155. ifdef SUBDIRS
  156. KBUILD_EXTMOD ?= $(SUBDIRS)
  157. endif
  158. ifeq ("$(origin M)", "command line")
  159. KBUILD_EXTMOD := $(M)
  160. endif
  161. # If building an external module we do not care about the all: rule
  162. # but instead _all depend on modules
  163. PHONY += all
  164. ifeq ($(KBUILD_EXTMOD),)
  165. _all: all
  166. else
  167. _all: modules
  168. endif
  169. ifeq ($(KBUILD_SRC),)
  170. # building in the source tree
  171. srctree := .
  172. else
  173. ifeq ($(KBUILD_SRC)/,$(dir $(CURDIR)))
  174. # building in a subdirectory of the source tree
  175. srctree := ..
  176. else
  177. srctree := $(KBUILD_SRC)
  178. endif
  179. endif
  180. objtree := .
  181. src := $(srctree)
  182. obj := $(objtree)
  183. VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD))
  184. export srctree objtree VPATH
  185. # Make sure CDPATH settings don't interfere
  186. unexport CDPATH
  187. #########################################################################
  188. HOSTARCH := $(shell uname -m | \
  189. sed -e s/i.86/x86/ \
  190. -e s/sun4u/sparc64/ \
  191. -e s/arm.*/arm/ \
  192. -e s/sa110/arm/ \
  193. -e s/ppc64/powerpc/ \
  194. -e s/ppc/powerpc/ \
  195. -e s/macppc/powerpc/\
  196. -e s/sh.*/sh/)
  197. HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
  198. sed -e 's/\(cygwin\).*/cygwin/')
  199. export HOSTARCH HOSTOS
  200. #########################################################################
  201. # set default to nothing for native builds
  202. ifeq ($(HOSTARCH),$(ARCH))
  203. CROSS_COMPILE ?=
  204. endif
  205. KCONFIG_CONFIG ?= .config
  206. export KCONFIG_CONFIG
  207. # SHELL used by kbuild
  208. CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
  209. else if [ -x /bin/bash ]; then echo /bin/bash; \
  210. else echo sh; fi ; fi)
  211. HOSTCC = cc
  212. HOSTCXX = c++
  213. HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
  214. HOSTCXXFLAGS = -O2
  215. ifeq ($(HOSTOS),cygwin)
  216. HOSTCFLAGS += -ansi
  217. endif
  218. # Mac OS X / Darwin's C preprocessor is Apple specific. It
  219. # generates numerous errors and warnings. We want to bypass it
  220. # and use GNU C's cpp. To do this we pass the -traditional-cpp
  221. # option to the compiler. Note that the -traditional-cpp flag
  222. # DOES NOT have the same semantics as GNU C's flag, all it does
  223. # is invoke the GNU preprocessor in stock ANSI/ISO C fashion.
  224. #
  225. # Apple's linker is similar, thanks to the new 2 stage linking
  226. # multiple symbol definitions are treated as errors, hence the
  227. # -multiply_defined suppress option to turn off this error.
  228. #
  229. ifeq ($(HOSTOS),darwin)
  230. # get major and minor product version (e.g. '10' and '6' for Snow Leopard)
  231. DARWIN_MAJOR_VERSION = $(shell sw_vers -productVersion | cut -f 1 -d '.')
  232. DARWIN_MINOR_VERSION = $(shell sw_vers -productVersion | cut -f 2 -d '.')
  233. os_x_before = $(shell if [ $(DARWIN_MAJOR_VERSION) -le $(1) -a \
  234. $(DARWIN_MINOR_VERSION) -le $(2) ] ; then echo "$(3)"; else echo "$(4)"; fi ;)
  235. # Snow Leopards build environment has no longer restrictions as described above
  236. HOSTCC = $(call os_x_before, 10, 5, "cc", "gcc")
  237. HOSTCFLAGS += $(call os_x_before, 10, 4, "-traditional-cpp")
  238. HOSTLDFLAGS += $(call os_x_before, 10, 5, "-multiply_defined suppress")
  239. # since Lion (10.7) ASLR is on by default, but we use linker generated lists
  240. # in some host tools which is a problem then ... so disable ASLR for these
  241. # tools
  242. HOSTLDFLAGS += $(call os_x_before, 10, 7, "", "-Xlinker -no_pie")
  243. endif
  244. # Decide whether to build built-in, modular, or both.
  245. # Normally, just do built-in.
  246. KBUILD_MODULES :=
  247. KBUILD_BUILTIN := 1
  248. # If we have only "make modules", don't compile built-in objects.
  249. # When we're building modules with modversions, we need to consider
  250. # the built-in objects during the descend as well, in order to
  251. # make sure the checksums are up to date before we record them.
  252. ifeq ($(MAKECMDGOALS),modules)
  253. KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1)
  254. endif
  255. # If we have "make <whatever> modules", compile modules
  256. # in addition to whatever we do anyway.
  257. # Just "make" or "make all" shall build modules as well
  258. # U-Boot does not need modules
  259. #ifneq ($(filter all _all modules,$(MAKECMDGOALS)),)
  260. # KBUILD_MODULES := 1
  261. #endif
  262. #ifeq ($(MAKECMDGOALS),)
  263. # KBUILD_MODULES := 1
  264. #endif
  265. export KBUILD_MODULES KBUILD_BUILTIN
  266. export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD
  267. # Look for make include files relative to root of kernel src
  268. MAKEFLAGS += --include-dir=$(srctree)
  269. # We need some generic definitions (do not try to remake the file).
  270. $(srctree)/scripts/Kbuild.include: ;
  271. include $(srctree)/scripts/Kbuild.include
  272. # Make variables (CC, etc...)
  273. AS = $(CROSS_COMPILE)as
  274. # Always use GNU ld
  275. ifneq ($(shell $(CROSS_COMPILE)ld.bfd -v 2> /dev/null),)
  276. LD = $(CROSS_COMPILE)ld.bfd
  277. else
  278. LD = $(CROSS_COMPILE)ld
  279. endif
  280. CC = $(CROSS_COMPILE)gcc
  281. CPP = $(CC) -E
  282. AR = $(CROSS_COMPILE)ar
  283. NM = $(CROSS_COMPILE)nm
  284. LDR = $(CROSS_COMPILE)ldr
  285. STRIP = $(CROSS_COMPILE)strip
  286. OBJCOPY = $(CROSS_COMPILE)objcopy
  287. OBJDUMP = $(CROSS_COMPILE)objdump
  288. AWK = awk
  289. PERL = perl
  290. PYTHON = python
  291. DTC = dtc
  292. CHECK = sparse
  293. CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
  294. -Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF)
  295. KBUILD_CPPFLAGS := -D__KERNEL__ -D__UBOOT__
  296. KBUILD_CFLAGS := -Wall -Wstrict-prototypes \
  297. -Wno-format-security \
  298. -fno-builtin -ffreestanding
  299. KBUILD_AFLAGS := -D__ASSEMBLY__
  300. # Read UBOOTRELEASE from include/config/uboot.release (if it exists)
  301. UBOOTRELEASE = $(shell cat include/config/uboot.release 2> /dev/null)
  302. UBOOTVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
  303. export VERSION PATCHLEVEL SUBLEVEL UBOOTRELEASE UBOOTVERSION
  304. export ARCH CPU BOARD VENDOR SOC CPUDIR BOARDDIR
  305. export CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC
  306. export CPP AR NM LDR STRIP OBJCOPY OBJDUMP
  307. export MAKE AWK PERL PYTHON
  308. export HOSTCXX HOSTCXXFLAGS DTC CHECK CHECKFLAGS
  309. export KBUILD_CPPFLAGS NOSTDINC_FLAGS UBOOTINCLUDE OBJCOPYFLAGS LDFLAGS
  310. export KBUILD_CFLAGS KBUILD_AFLAGS
  311. # When compiling out-of-tree modules, put MODVERDIR in the module
  312. # tree rather than in the kernel tree. The kernel tree might
  313. # even be read-only.
  314. export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions
  315. # Files to ignore in find ... statements
  316. export RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o \
  317. -name CVS -o -name .pc -o -name .hg -o -name .git \) \
  318. -prune -o
  319. export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \
  320. --exclude CVS --exclude .pc --exclude .hg --exclude .git
  321. # ===========================================================================
  322. # Rules shared between *config targets and build targets
  323. # Basic helpers built in scripts/
  324. PHONY += scripts_basic
  325. scripts_basic:
  326. $(Q)$(MAKE) $(build)=scripts/basic
  327. $(Q)rm -f .tmp_quiet_recordmcount
  328. # To avoid any implicit rule to kick in, define an empty command.
  329. scripts/basic/%: scripts_basic ;
  330. PHONY += outputmakefile
  331. # outputmakefile generates a Makefile in the output directory, if using a
  332. # separate output directory. This allows convenient use of make in the
  333. # output directory.
  334. outputmakefile:
  335. ifneq ($(KBUILD_SRC),)
  336. $(Q)ln -fsn $(srctree) source
  337. $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
  338. $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
  339. endif
  340. # To make sure we do not include .config for any of the *config targets
  341. # catch them early, and hand them over to scripts/kconfig/Makefile
  342. # It is allowed to specify more targets when calling make, including
  343. # mixing *config targets and build targets.
  344. # For example 'make oldconfig all'.
  345. # Detect when mixed targets is specified, and make a second invocation
  346. # of make so .config is not included in this case either (for *config).
  347. version_h := include/generated/version_autogenerated.h
  348. timestamp_h := include/generated/timestamp_autogenerated.h
  349. no-dot-config-targets := clean clobber mrproper distclean \
  350. help %docs check% coccicheck \
  351. ubootversion backup
  352. config-targets := 0
  353. mixed-targets := 0
  354. dot-config := 1
  355. ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
  356. ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
  357. dot-config := 0
  358. endif
  359. endif
  360. ifeq ($(KBUILD_EXTMOD),)
  361. ifneq ($(filter config %config,$(MAKECMDGOALS)),)
  362. config-targets := 1
  363. ifneq ($(filter-out config %config,$(MAKECMDGOALS)),)
  364. mixed-targets := 1
  365. endif
  366. endif
  367. endif
  368. ifeq ($(mixed-targets),1)
  369. # ===========================================================================
  370. # We're called with mixed targets (*config and build targets).
  371. # Handle them one by one.
  372. PHONY += $(MAKECMDGOALS) __build_one_by_one
  373. $(filter-out __build_one_by_one, $(MAKECMDGOALS)): __build_one_by_one
  374. @:
  375. __build_one_by_one:
  376. $(Q)set -e; \
  377. for i in $(MAKECMDGOALS); do \
  378. $(MAKE) -f $(srctree)/Makefile $$i; \
  379. done
  380. else
  381. ifeq ($(config-targets),1)
  382. # ===========================================================================
  383. # *config targets only - make sure prerequisites are updated, and descend
  384. # in scripts/kconfig to make the *config target
  385. KBUILD_DEFCONFIG := sandbox_defconfig
  386. export KBUILD_DEFCONFIG KBUILD_KCONFIG
  387. config: scripts_basic outputmakefile FORCE
  388. $(Q)$(MAKE) $(build)=scripts/kconfig $@
  389. %config: scripts_basic outputmakefile FORCE
  390. $(Q)$(MAKE) $(build)=scripts/kconfig $@
  391. else
  392. # ===========================================================================
  393. # Build targets only - this includes vmlinux, arch specific targets, clean
  394. # targets and others. In general all targets except *config targets.
  395. ifeq ($(dot-config),1)
  396. # Read in config
  397. -include include/config/auto.conf
  398. # Read in dependencies to all Kconfig* files, make sure to run
  399. # oldconfig if changes are detected.
  400. -include include/config/auto.conf.cmd
  401. # To avoid any implicit rule to kick in, define an empty command
  402. $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ;
  403. # If .config is newer than include/config/auto.conf, someone tinkered
  404. # with it and forgot to run make oldconfig.
  405. # if auto.conf.cmd is missing then we are probably in a cleaned tree so
  406. # we execute the config step to be sure to catch updated Kconfig files
  407. include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
  408. $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
  409. @# If the following part fails, include/config/auto.conf should be
  410. @# deleted so "make silentoldconfig" will be re-run on the next build.
  411. $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.autoconf || \
  412. { rm -f include/config/auto.conf; false; }
  413. @# include/config.h has been updated after "make silentoldconfig".
  414. @# We need to touch include/config/auto.conf so it gets newer
  415. @# than include/config.h.
  416. @# Otherwise, 'make silentoldconfig' would be invoked twice.
  417. $(Q)touch include/config/auto.conf
  418. -include include/autoconf.mk
  419. -include include/autoconf.mk.dep
  420. # We want to include arch/$(ARCH)/config.mk only when include/config/auto.conf
  421. # is up-to-date. When we switch to a different board configuration, old CONFIG
  422. # macros are still remaining in include/config/auto.conf. Without the following
  423. # gimmick, wrong config.mk would be included leading nasty warnings/errors.
  424. ifneq ($(wildcard $(KCONFIG_CONFIG)),)
  425. ifneq ($(wildcard include/config/auto.conf),)
  426. autoconf_is_old := $(shell find . -path ./$(KCONFIG_CONFIG) -newer \
  427. include/config/auto.conf)
  428. ifeq ($(autoconf_is_old),)
  429. include $(srctree)/config.mk
  430. include $(srctree)/arch/$(ARCH)/Makefile
  431. endif
  432. endif
  433. endif
  434. # If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use
  435. # that (or fail if absent). Otherwise, search for a linker script in a
  436. # standard location.
  437. ifndef LDSCRIPT
  438. #LDSCRIPT := $(srctree)/board/$(BOARDDIR)/u-boot.lds.debug
  439. ifdef CONFIG_SYS_LDSCRIPT
  440. # need to strip off double quotes
  441. LDSCRIPT := $(srctree)/$(CONFIG_SYS_LDSCRIPT:"%"=%)
  442. endif
  443. endif
  444. # If there is no specified link script, we look in a number of places for it
  445. ifndef LDSCRIPT
  446. ifeq ($(wildcard $(LDSCRIPT)),)
  447. LDSCRIPT := $(srctree)/board/$(BOARDDIR)/u-boot.lds
  448. endif
  449. ifeq ($(wildcard $(LDSCRIPT)),)
  450. LDSCRIPT := $(srctree)/$(CPUDIR)/u-boot.lds
  451. endif
  452. ifeq ($(wildcard $(LDSCRIPT)),)
  453. LDSCRIPT := $(srctree)/arch/$(ARCH)/cpu/u-boot.lds
  454. endif
  455. endif
  456. else
  457. # Dummy target needed, because used as prerequisite
  458. include/config/auto.conf: ;
  459. endif # $(dot-config)
  460. ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
  461. KBUILD_CFLAGS += -Os
  462. else
  463. KBUILD_CFLAGS += -O2
  464. endif
  465. ifdef BUILD_TAG
  466. KBUILD_CFLAGS += -DBUILD_TAG='"$(BUILD_TAG)"'
  467. endif
  468. KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
  469. KBUILD_CFLAGS += -g
  470. # $(KBUILD_AFLAGS) sets -g, which causes gcc to pass a suitable -g<format>
  471. # option to the assembler.
  472. KBUILD_AFLAGS += -g
  473. # Report stack usage if supported
  474. ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-stack-usage.sh $(CC)),y)
  475. KBUILD_CFLAGS += -fstack-usage
  476. endif
  477. KBUILD_CFLAGS += $(call cc-option,-Wno-format-nonliteral)
  478. # turn jbsr into jsr for m68k
  479. ifeq ($(ARCH),m68k)
  480. ifeq ($(findstring 3.4,$(shell $(CC) --version)),3.4)
  481. KBUILD_AFLAGS += -Wa,-gstabs,-S
  482. endif
  483. endif
  484. # Prohibit date/time macros, which would make the build non-deterministic
  485. KBUILD_CFLAGS += $(call cc-option,-Werror=date-time)
  486. ifneq ($(CONFIG_SYS_TEXT_BASE),)
  487. KBUILD_CPPFLAGS += -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE)
  488. endif
  489. export CONFIG_SYS_TEXT_BASE
  490. include $(srctree)/scripts/Makefile.extrawarn
  491. # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
  492. KBUILD_CPPFLAGS += $(KCPPFLAGS)
  493. KBUILD_AFLAGS += $(KAFLAGS)
  494. KBUILD_CFLAGS += $(KCFLAGS)
  495. # Use UBOOTINCLUDE when you must reference the include/ directory.
  496. # Needed to be compatible with the O= option
  497. UBOOTINCLUDE := \
  498. -Iinclude \
  499. $(if $(KBUILD_SRC), -I$(srctree)/include) \
  500. -I$(srctree)/arch/$(ARCH)/include \
  501. -include $(srctree)/include/linux/kconfig.h
  502. NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
  503. CHECKFLAGS += $(NOSTDINC_FLAGS)
  504. # FIX ME
  505. cpp_flags := $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) $(UBOOTINCLUDE) \
  506. $(NOSTDINC_FLAGS)
  507. c_flags := $(KBUILD_CFLAGS) $(cpp_flags)
  508. #########################################################################
  509. # U-Boot objects....order is important (i.e. start must be first)
  510. HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makefile),y,n)
  511. libs-y += lib/
  512. libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/
  513. libs-$(CONFIG_OF_EMBED) += dts/
  514. libs-y += fs/
  515. libs-y += net/
  516. libs-y += disk/
  517. libs-y += drivers/
  518. libs-y += drivers/dma/
  519. libs-y += drivers/gpio/
  520. libs-y += drivers/i2c/
  521. libs-y += drivers/mmc/
  522. libs-y += drivers/mtd/
  523. libs-$(CONFIG_CMD_NAND) += drivers/mtd/nand/
  524. libs-y += drivers/mtd/onenand/
  525. libs-$(CONFIG_CMD_UBI) += drivers/mtd/ubi/
  526. libs-y += drivers/mtd/spi/
  527. libs-y += drivers/net/
  528. libs-y += drivers/net/phy/
  529. libs-y += drivers/pci/
  530. libs-y += drivers/power/ \
  531. drivers/power/fuel_gauge/ \
  532. drivers/power/mfd/ \
  533. drivers/power/pmic/ \
  534. drivers/power/battery/
  535. libs-y += drivers/spi/
  536. libs-$(CONFIG_FMAN_ENET) += drivers/net/fm/
  537. libs-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/
  538. libs-y += drivers/serial/
  539. libs-y += drivers/usb/dwc3/
  540. libs-y += drivers/usb/emul/
  541. libs-y += drivers/usb/eth/
  542. libs-y += drivers/usb/gadget/
  543. libs-y += drivers/usb/gadget/udc/
  544. libs-y += drivers/usb/host/
  545. libs-y += drivers/usb/musb/
  546. libs-y += drivers/usb/musb-new/
  547. libs-y += drivers/usb/phy/
  548. libs-y += drivers/usb/ulpi/
  549. libs-y += common/
  550. libs-$(CONFIG_API) += api/
  551. libs-$(CONFIG_HAS_POST) += post/
  552. libs-y += test/
  553. libs-y += test/dm/
  554. libs-y += $(if $(BOARDDIR),board/$(BOARDDIR)/)
  555. libs-y := $(sort $(libs-y))
  556. u-boot-dirs := $(patsubst %/,%,$(filter %/, $(libs-y))) tools examples
  557. u-boot-alldirs := $(sort $(u-boot-dirs) $(patsubst %/,%,$(filter %/, $(libs-))))
  558. libs-y := $(patsubst %/, %/built-in.o, $(libs-y))
  559. u-boot-init := $(head-y)
  560. u-boot-main := $(libs-y)
  561. # Add GCC lib
  562. ifeq ($(CONFIG_USE_PRIVATE_LIBGCC),y)
  563. PLATFORM_LIBGCC = arch/$(ARCH)/lib/lib.a
  564. else
  565. PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(c_flags) -print-libgcc-file-name`) -lgcc
  566. endif
  567. PLATFORM_LIBS += $(PLATFORM_LIBGCC)
  568. export PLATFORM_LIBS
  569. export PLATFORM_LIBGCC
  570. # Special flags for CPP when processing the linker script.
  571. # Pass the version down so we can handle backwards compatibility
  572. # on the fly.
  573. LDPPFLAGS += \
  574. -include $(srctree)/include/u-boot/u-boot.lds.h \
  575. -DCPUDIR=$(CPUDIR) \
  576. $(shell $(LD) --version | \
  577. sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p')
  578. #########################################################################
  579. #########################################################################
  580. ifneq ($(CONFIG_BOARD_SIZE_LIMIT),)
  581. BOARD_SIZE_CHECK = \
  582. @actual=`wc -c $@ | awk '{print $$1}'`; \
  583. limit=`printf "%d" $(CONFIG_BOARD_SIZE_LIMIT)`; \
  584. if test $$actual -gt $$limit; then \
  585. echo "$@ exceeds file size limit:" >&2 ; \
  586. echo " limit: $$limit bytes" >&2 ; \
  587. echo " actual: $$actual bytes" >&2 ; \
  588. echo " excess: $$((actual - limit)) bytes" >&2; \
  589. exit 1; \
  590. fi
  591. else
  592. BOARD_SIZE_CHECK =
  593. endif
  594. # Statically apply RELA-style relocations (currently arm64 only)
  595. ifneq ($(CONFIG_STATIC_RELA),)
  596. # $(1) is u-boot ELF, $(2) is u-boot bin, $(3) is text base
  597. DO_STATIC_RELA = \
  598. start=$$($(NM) $(1) | grep __rel_dyn_start | cut -f 1 -d ' '); \
  599. end=$$($(NM) $(1) | grep __rel_dyn_end | cut -f 1 -d ' '); \
  600. tools/relocate-rela $(2) $(3) $$start $$end
  601. else
  602. DO_STATIC_RELA =
  603. endif
  604. # Always append ALL so that arch config.mk's can add custom ones
  605. ALL-y += u-boot.srec u-boot.bin System.map u-boot.cfg binary_size_check
  606. ALL-$(CONFIG_ONENAND_U_BOOT) += u-boot-onenand.bin
  607. ifeq ($(CONFIG_SPL_FSL_PBL),y)
  608. ALL-$(CONFIG_RAMBOOT_PBL) += u-boot-with-spl-pbl.bin
  609. else
  610. ALL-$(CONFIG_RAMBOOT_PBL) += u-boot.pbl
  611. endif
  612. ALL-$(CONFIG_SPL) += spl/u-boot-spl.bin
  613. ALL-$(CONFIG_SPL_FRAMEWORK) += u-boot.img
  614. ALL-$(CONFIG_TPL) += tpl/u-boot-tpl.bin
  615. ALL-$(CONFIG_OF_SEPARATE) += u-boot.dtb u-boot-dtb.bin
  616. ifeq ($(CONFIG_SPL_FRAMEWORK),y)
  617. ALL-$(CONFIG_OF_SEPARATE) += u-boot-dtb.img
  618. endif
  619. ALL-$(CONFIG_OF_HOSTFILE) += u-boot.dtb
  620. ifneq ($(CONFIG_SPL_TARGET),)
  621. ALL-$(CONFIG_SPL) += $(CONFIG_SPL_TARGET:"%"=%)
  622. endif
  623. ALL-$(CONFIG_REMAKE_ELF) += u-boot.elf
  624. ifneq ($(BUILD_ROM),)
  625. ALL-$(CONFIG_X86_RESET_VECTOR) += u-boot.rom
  626. endif
  627. # enable combined SPL/u-boot/dtb rules for tegra
  628. ifneq ($(CONFIG_TEGRA),)
  629. ifeq ($(CONFIG_SPL),y)
  630. ifeq ($(CONFIG_OF_SEPARATE),y)
  631. ALL-y += u-boot-dtb-tegra.bin
  632. else
  633. ALL-y += u-boot-nodtb-tegra.bin
  634. endif
  635. endif
  636. endif
  637. # Add optional build target if defined in board/cpu/soc headers
  638. ifneq ($(CONFIG_BUILD_TARGET),)
  639. ALL-y += $(CONFIG_BUILD_TARGET:"%"=%)
  640. endif
  641. LDFLAGS_u-boot += $(LDFLAGS_FINAL)
  642. ifneq ($(CONFIG_SYS_TEXT_BASE),)
  643. LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE)
  644. endif
  645. quiet_cmd_objcopy = OBJCOPY $@
  646. cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@
  647. quiet_cmd_mkimage = MKIMAGE $@
  648. cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $< $@ \
  649. $(if $(KBUILD_VERBOSE:1=), >/dev/null)
  650. quiet_cmd_cat = CAT $@
  651. cmd_cat = cat $(filter-out $(PHONY), $^) > $@
  652. append = cat $(filter-out $< $(PHONY), $^) >> $@
  653. quiet_cmd_pad_cat = CAT $@
  654. cmd_pad_cat = $(cmd_objcopy) && $(append) || rm -f $@
  655. all: $(ALL-y)
  656. ifneq ($(CONFIG_SYS_GENERIC_BOARD),y)
  657. @echo "===================== WARNING ======================"
  658. @echo "Please convert this board to generic board."
  659. @echo "Otherwise it will be removed by the end of 2014."
  660. @echo "See doc/README.generic-board for further information"
  661. @echo "===================================================="
  662. endif
  663. ifeq ($(CONFIG_DM_I2C_COMPAT),y)
  664. @echo "===================== WARNING ======================"
  665. @echo "This board uses CONFIG_DM_I2C_COMPAT. Please remove"
  666. @echo "(possibly in a subsequent patch in your series)"
  667. @echo "before sending patches to the mailing list."
  668. @echo "===================================================="
  669. endif
  670. PHONY += dtbs
  671. dtbs dts/dt.dtb: checkdtc u-boot
  672. $(Q)$(MAKE) $(build)=dts dtbs
  673. u-boot-dtb.bin: u-boot.bin dts/dt.dtb FORCE
  674. $(call if_changed,cat)
  675. %.imx: %.bin
  676. $(Q)$(MAKE) $(build)=arch/arm/imx-common $@
  677. quiet_cmd_copy = COPY $@
  678. cmd_copy = cp $< $@
  679. u-boot.dtb: dts/dt.dtb
  680. $(call cmd,copy)
  681. OBJCOPYFLAGS_u-boot.hex := -O ihex
  682. OBJCOPYFLAGS_u-boot.srec := -O srec
  683. u-boot.hex u-boot.srec: u-boot FORCE
  684. $(call if_changed,objcopy)
  685. OBJCOPYFLAGS_u-boot.bin := -O binary \
  686. $(if $(CONFIG_X86_RESET_VECTOR),-R .start16 -R .resetvec)
  687. binary_size_check: u-boot.bin FORCE
  688. @file_size=$(shell wc -c u-boot.bin | awk '{print $$1}') ; \
  689. map_size=$(shell cat u-boot.map | \
  690. awk '/_image_copy_start/ {start = $$1} /_image_binary_end/ {end = $$1} END {if (start != "" && end != "") print "ibase=16; " toupper(end) " - " toupper(start)}' \
  691. | sed 's/0X//g' \
  692. | bc); \
  693. if [ "" != "$$map_size" ]; then \
  694. if test $$map_size -ne $$file_size; then \
  695. echo "u-boot.map shows a binary size of $$map_size" >&2 ; \
  696. echo " but u-boot.bin shows $$file_size" >&2 ; \
  697. exit 1; \
  698. fi \
  699. fi
  700. u-boot.bin: u-boot FORCE
  701. $(call if_changed,objcopy)
  702. $(call DO_STATIC_RELA,$<,$@,$(CONFIG_SYS_TEXT_BASE))
  703. $(BOARD_SIZE_CHECK)
  704. u-boot.ldr: u-boot
  705. $(CREATE_LDR_ENV)
  706. $(LDR) -T $(CONFIG_CPU) -c $@ $< $(LDR_FLAGS)
  707. $(BOARD_SIZE_CHECK)
  708. OBJCOPYFLAGS_u-boot.ldr.hex := -I binary -O ihex
  709. OBJCOPYFLAGS_u-boot.ldr.srec := -I binary -O srec
  710. u-boot.ldr.hex u-boot.ldr.srec: u-boot.ldr FORCE
  711. $(call if_changed,objcopy)
  712. #
  713. # U-Boot entry point, needed for booting of full-blown U-Boot
  714. # from the SPL U-Boot version.
  715. #
  716. ifndef CONFIG_SYS_UBOOT_START
  717. CONFIG_SYS_UBOOT_START := 0
  718. endif
  719. # Create a file containing the configuration options the image was built with
  720. quiet_cmd_cpp_cfg = CFG $@
  721. cmd_cpp_cfg = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) -ansi \
  722. -D__ASSEMBLY__ -x assembler-with-cpp -P -dM -E -o $@ $<
  723. MKIMAGEFLAGS_u-boot.img = -A $(ARCH) -T firmware -C none -O u-boot \
  724. -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
  725. -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board"
  726. MKIMAGEFLAGS_u-boot.kwb = -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \
  727. -T kwbimage -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE)
  728. MKIMAGEFLAGS_u-boot-spl.kwb = -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \
  729. -T kwbimage -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE)
  730. MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \
  731. -R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage
  732. u-boot.img u-boot.kwb u-boot.pbl: u-boot.bin FORCE
  733. $(call if_changed,mkimage)
  734. u-boot-spl.kwb: u-boot.img spl/u-boot-spl.bin FORCE
  735. $(call if_changed,mkimage)
  736. MKIMAGEFLAGS_u-boot-dtb.img = $(MKIMAGEFLAGS_u-boot.img)
  737. u-boot-dtb.img: u-boot-dtb.bin FORCE
  738. $(call if_changed,mkimage)
  739. u-boot.sha1: u-boot.bin
  740. tools/ubsha1 u-boot.bin
  741. u-boot.dis: u-boot
  742. $(OBJDUMP) -d $< > $@
  743. u-boot.cfg: include/config.h
  744. $(call if_changed,cpp_cfg)
  745. ifdef CONFIG_TPL
  746. SPL_PAYLOAD := tpl/u-boot-with-tpl.bin
  747. else
  748. SPL_PAYLOAD := u-boot.bin
  749. endif
  750. OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \
  751. --pad-to=$(CONFIG_SPL_PAD_TO)
  752. u-boot-with-spl.bin: spl/u-boot-spl.bin $(SPL_PAYLOAD) FORCE
  753. $(call if_changed,pad_cat)
  754. MKIMAGEFLAGS_lpc32xx-spl.img = -T lpc32xximage -a $(CONFIG_SPL_TEXT_BASE)
  755. lpc32xx-spl.img: spl/u-boot-spl.bin FORCE
  756. $(call if_changed,mkimage)
  757. OBJCOPYFLAGS_lpc32xx-boot-0.bin = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO)
  758. lpc32xx-boot-0.bin: lpc32xx-spl.img
  759. $(call if_changed,objcopy)
  760. OBJCOPYFLAGS_lpc32xx-boot-1.bin = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO)
  761. lpc32xx-boot-1.bin: lpc32xx-spl.img
  762. $(call if_changed,objcopy)
  763. lpc32xx-full.bin: lpc32xx-boot-0.bin lpc32xx-boot-1.bin u-boot.img
  764. $(call if_changed,cat)
  765. CLEAN_FILES += lpc32xx-*
  766. OBJCOPYFLAGS_u-boot-with-tpl.bin = -I binary -O binary \
  767. --pad-to=$(CONFIG_TPL_PAD_TO)
  768. tpl/u-boot-with-tpl.bin: tpl/u-boot-tpl.bin u-boot.bin FORCE
  769. $(call if_changed,pad_cat)
  770. SPL: spl/u-boot-spl.bin FORCE
  771. $(Q)$(MAKE) $(build)=arch/arm/imx-common $@
  772. u-boot-with-spl.imx u-boot-with-nand-spl.imx: SPL u-boot.bin FORCE
  773. $(Q)$(MAKE) $(build)=arch/arm/imx-common $@
  774. MKIMAGEFLAGS_u-boot.ubl = -n $(UBL_CONFIG) -T ublimage -e $(CONFIG_SYS_TEXT_BASE)
  775. u-boot.ubl: u-boot-with-spl.bin FORCE
  776. $(call if_changed,mkimage)
  777. MKIMAGEFLAGS_u-boot-spl.ais = -s -n $(if $(CONFIG_AIS_CONFIG_FILE), \
  778. $(srctree)/$(CONFIG_AIS_CONFIG_FILE:"%"=%),"/dev/null") \
  779. -T aisimage -e $(CONFIG_SPL_TEXT_BASE)
  780. spl/u-boot-spl.ais: spl/u-boot-spl.bin FORCE
  781. $(call if_changed,mkimage)
  782. OBJCOPYFLAGS_u-boot.ais = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO)
  783. u-boot.ais: spl/u-boot-spl.ais u-boot.img FORCE
  784. $(call if_changed,pad_cat)
  785. u-boot-signed.sb: u-boot.bin spl/u-boot-spl.bin
  786. $(Q)$(MAKE) $(build)=arch/arm/cpu/arm926ejs/mxs u-boot-signed.sb
  787. u-boot.sb: u-boot.bin spl/u-boot-spl.bin
  788. $(Q)$(MAKE) $(build)=arch/arm/cpu/arm926ejs/mxs u-boot.sb
  789. # On x600 (SPEAr600) U-Boot is appended to U-Boot SPL.
  790. # Both images are created using mkimage (crc etc), so that the ROM
  791. # bootloader can check its integrity. Padding needs to be done to the
  792. # SPL image (with mkimage header) and not the binary. Otherwise the resulting image
  793. # which is loaded/copied by the ROM bootloader to SRAM doesn't fit.
  794. # The resulting image containing both U-Boot images is called u-boot.spr
  795. MKIMAGEFLAGS_u-boot-spl.img = -A $(ARCH) -T firmware -C none \
  796. -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n XLOADER
  797. spl/u-boot-spl.img: spl/u-boot-spl.bin FORCE
  798. $(call if_changed,mkimage)
  799. OBJCOPYFLAGS_u-boot.spr = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \
  800. --gap-fill=0xff
  801. u-boot.spr: spl/u-boot-spl.img u-boot.img FORCE
  802. $(call if_changed,pad_cat)
  803. MKIMAGEFLAGS_u-boot-spl.gph = -A $(ARCH) -T gpimage -C none \
  804. -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n SPL
  805. spl/u-boot-spl.gph: spl/u-boot-spl.bin FORCE
  806. $(call if_changed,mkimage)
  807. OBJCOPYFLAGS_u-boot-spi.gph = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \
  808. --gap-fill=0
  809. u-boot-spi.gph: spl/u-boot-spl.gph u-boot.img FORCE
  810. $(call if_changed,pad_cat)
  811. MKIMAGEFLAGS_u-boot-nand.gph = -A $(ARCH) -T gpimage -C none \
  812. -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) -n U-Boot
  813. u-boot-nand.gph: u-boot.bin FORCE
  814. $(call if_changed,mkimage)
  815. @dd if=/dev/zero bs=8 count=1 2>/dev/null >> $@
  816. # x86 uses a large ROM. We fill it with 0xff, put the 16-bit stuff (including
  817. # reset vector) at the top, Intel ME descriptor at the bottom, and U-Boot in
  818. # the middle.
  819. ifneq ($(CONFIG_X86_RESET_VECTOR),)
  820. rom: u-boot.rom FORCE
  821. IFDTOOL=$(objtree)/tools/ifdtool
  822. IFDTOOL_FLAGS = -f 0:$(objtree)/u-boot.dtb
  823. IFDTOOL_FLAGS += -m 0x$(shell $(NM) u-boot |grep _dt_ucode_base_size |cut -d' ' -f1)
  824. IFDTOOL_FLAGS += -U $(CONFIG_SYS_TEXT_BASE):$(objtree)/u-boot.bin
  825. IFDTOOL_FLAGS += -w $(CONFIG_SYS_X86_START16):$(objtree)/u-boot-x86-16bit.bin
  826. ifneq ($(CONFIG_HAVE_INTEL_ME),)
  827. IFDTOOL_ME_FLAGS = -D $(srctree)/board/$(BOARDDIR)/descriptor.bin
  828. IFDTOOL_ME_FLAGS += -i ME:$(srctree)/board/$(BOARDDIR)/me.bin
  829. endif
  830. ifneq ($(CONFIG_HAVE_MRC),)
  831. IFDTOOL_FLAGS += -w $(CONFIG_X86_MRC_ADDR):$(srctree)/board/$(BOARDDIR)/mrc.bin
  832. endif
  833. ifneq ($(CONFIG_HAVE_FSP),)
  834. IFDTOOL_FLAGS += -w $(CONFIG_FSP_ADDR):$(srctree)/board/$(BOARDDIR)/$(CONFIG_FSP_FILE)
  835. endif
  836. ifneq ($(CONFIG_HAVE_CMC),)
  837. IFDTOOL_FLAGS += -w $(CONFIG_CMC_ADDR):$(srctree)/board/$(BOARDDIR)/$(CONFIG_CMC_FILE)
  838. endif
  839. ifneq ($(CONFIG_X86_OPTION_ROM_ADDR),)
  840. IFDTOOL_FLAGS += -w $(CONFIG_X86_OPTION_ROM_ADDR):$(srctree)/board/$(BOARDDIR)/$(CONFIG_X86_OPTION_ROM_FILE)
  841. endif
  842. quiet_cmd_ifdtool = IFDTOOL $@
  843. cmd_ifdtool = $(IFDTOOL) -c -r $(CONFIG_ROM_SIZE) u-boot.tmp;
  844. ifneq ($(CONFIG_HAVE_INTEL_ME),)
  845. cmd_ifdtool += $(IFDTOOL) $(IFDTOOL_ME_FLAGS) u-boot.tmp;
  846. endif
  847. cmd_ifdtool += $(IFDTOOL) $(IFDTOOL_FLAGS) u-boot.tmp;
  848. cmd_ifdtool += mv u-boot.tmp $@
  849. u-boot.rom: u-boot-x86-16bit.bin u-boot-dtb.bin
  850. $(call if_changed,ifdtool)
  851. OBJCOPYFLAGS_u-boot-x86-16bit.bin := -O binary -j .start16 -j .resetvec
  852. u-boot-x86-16bit.bin: u-boot FORCE
  853. $(call if_changed,objcopy)
  854. endif
  855. ifneq ($(CONFIG_SUNXI),)
  856. OBJCOPYFLAGS_u-boot-sunxi-with-spl.bin = -I binary -O binary \
  857. --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff
  858. u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin \
  859. u-boot$(if $(CONFIG_OF_CONTROL),-dtb,).img FORCE
  860. $(call if_changed,pad_cat)
  861. endif
  862. ifneq ($(CONFIG_TEGRA),)
  863. OBJCOPYFLAGS_u-boot-nodtb-tegra.bin = -O binary --pad-to=$(CONFIG_SYS_TEXT_BASE)
  864. u-boot-nodtb-tegra.bin: spl/u-boot-spl u-boot.bin FORCE
  865. $(call if_changed,pad_cat)
  866. ifeq ($(CONFIG_OF_SEPARATE),y)
  867. u-boot-dtb-tegra.bin: u-boot-nodtb-tegra.bin dts/dt.dtb FORCE
  868. $(call if_changed,cat)
  869. endif
  870. endif
  871. u-boot-img.bin: spl/u-boot-spl.bin u-boot.img FORCE
  872. $(call if_changed,cat)
  873. #Add a target to create boot binary having SPL binary in PBI format
  874. #concatenated with u-boot binary. It is need by PowerPC SoC having
  875. #internal SRAM <= 512KB.
  876. MKIMAGEFLAGS_u-boot-spl.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \
  877. -R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage \
  878. -A $(ARCH) -a $(CONFIG_SPL_TEXT_BASE)
  879. spl/u-boot-spl.pbl: spl/u-boot-spl.bin FORCE
  880. $(call if_changed,mkimage)
  881. ifeq ($(ARCH),arm)
  882. UBOOT_BINLOAD := u-boot.img
  883. else
  884. UBOOT_BINLOAD := u-boot.bin
  885. endif
  886. OBJCOPYFLAGS_u-boot-with-spl-pbl.bin = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \
  887. --gap-fill=0xff
  888. u-boot-with-spl-pbl.bin: spl/u-boot-spl.pbl $(UBOOT_BINLOAD) FORCE
  889. $(call if_changed,pad_cat)
  890. # PPC4xx needs the SPL at the end of the image, since the reset vector
  891. # is located at 0xfffffffc. So we can't use the "u-boot-img.bin" target
  892. # and need to introduce a new build target with the full blown U-Boot
  893. # at the start padded up to the start of the SPL image. And then concat
  894. # the SPL image to the end.
  895. OBJCOPYFLAGS_u-boot-img-spl-at-end.bin := -I binary -O binary \
  896. --pad-to=$(CONFIG_UBOOT_PAD_TO) --gap-fill=0xff
  897. u-boot-img-spl-at-end.bin: u-boot.img spl/u-boot-spl.bin FORCE
  898. $(call if_changed,pad_cat)
  899. # Create a new ELF from a raw binary file. This is useful for arm64
  900. # where static relocation needs to be performed on the raw binary,
  901. # but certain simulators only accept an ELF file (but don't do the
  902. # relocation).
  903. # FIXME refactor dts/Makefile to share target/arch detection
  904. u-boot.elf: u-boot.bin
  905. @$(OBJCOPY) -B aarch64 -I binary -O elf64-littleaarch64 \
  906. $< u-boot-elf.o
  907. @$(LD) u-boot-elf.o -o $@ \
  908. --defsym=_start=$(CONFIG_SYS_TEXT_BASE) \
  909. -Ttext=$(CONFIG_SYS_TEXT_BASE)
  910. # Rule to link u-boot
  911. # May be overridden by arch/$(ARCH)/config.mk
  912. quiet_cmd_u-boot__ ?= LD $@
  913. cmd_u-boot__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_u-boot) -o $@ \
  914. -T u-boot.lds $(u-boot-init) \
  915. --start-group $(u-boot-main) --end-group \
  916. $(PLATFORM_LIBS) -Map u-boot.map
  917. quiet_cmd_smap = GEN common/system_map.o
  918. cmd_smap = \
  919. smap=`$(call SYSTEM_MAP,u-boot) | \
  920. awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 "\\\\000"}'` ; \
  921. $(CC) $(c_flags) -DSYSTEM_MAP="\"$${smap}\"" \
  922. -c $(srctree)/common/system_map.c -o common/system_map.o
  923. u-boot: $(u-boot-init) $(u-boot-main) u-boot.lds
  924. $(call if_changed,u-boot__)
  925. ifeq ($(CONFIG_KALLSYMS),y)
  926. $(call cmd,smap)
  927. $(call cmd,u-boot__) common/system_map.o
  928. endif
  929. # The actual objects are generated when descending,
  930. # make sure no implicit rule kicks in
  931. $(sort $(u-boot-init) $(u-boot-main)): $(u-boot-dirs) ;
  932. # Handle descending into subdirectories listed in $(vmlinux-dirs)
  933. # Preset locale variables to speed up the build process. Limit locale
  934. # tweaks to this spot to avoid wrong language settings when running
  935. # make menuconfig etc.
  936. # Error messages still appears in the original language
  937. PHONY += $(u-boot-dirs)
  938. $(u-boot-dirs): prepare scripts
  939. $(Q)$(MAKE) $(build)=$@
  940. tools: prepare
  941. # The "tools" are needed early
  942. $(filter-out tools, $(u-boot-dirs)): tools
  943. # The "examples" conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC
  944. # is "yes"), so compile examples after U-Boot is compiled.
  945. examples: $(filter-out examples, $(u-boot-dirs))
  946. define filechk_uboot.release
  947. echo "$(UBOOTVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))"
  948. endef
  949. # Store (new) UBOOTRELEASE string in include/config/uboot.release
  950. include/config/uboot.release: include/config/auto.conf FORCE
  951. $(call filechk,uboot.release)
  952. # Things we need to do before we recursively start building the kernel
  953. # or the modules are listed in "prepare".
  954. # A multi level approach is used. prepareN is processed before prepareN-1.
  955. # archprepare is used in arch Makefiles and when processed asm symlink,
  956. # version.h and scripts_basic is processed / created.
  957. # Listed in dependency order
  958. PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3
  959. # prepare3 is used to check if we are building in a separate output directory,
  960. # and if so do:
  961. # 1) Check that make has not been executed in the kernel src $(srctree)
  962. prepare3: include/config/uboot.release
  963. ifneq ($(KBUILD_SRC),)
  964. @$(kecho) ' Using $(srctree) as source for U-Boot'
  965. $(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \
  966. echo >&2 " $(srctree) is not clean, please run 'make mrproper'"; \
  967. echo >&2 " in the '$(srctree)' directory.";\
  968. /bin/false; \
  969. fi;
  970. endif
  971. # prepare2 creates a makefile if using a separate output directory
  972. prepare2: prepare3 outputmakefile
  973. prepare1: prepare2 $(version_h) $(timestamp_h) \
  974. include/config/auto.conf
  975. ifeq ($(CONFIG_HAVE_GENERIC_BOARD),)
  976. ifeq ($(CONFIG_SYS_GENERIC_BOARD),y)
  977. @echo >&2 " Your architecture does not support generic board."
  978. @echo >&2 " Please undefine CONFIG_SYS_GENERIC_BOARD in your board config file."
  979. @/bin/false
  980. endif
  981. endif
  982. ifeq ($(wildcard $(LDSCRIPT)),)
  983. @echo >&2 " Could not find linker script."
  984. @/bin/false
  985. endif
  986. archprepare: prepare1 scripts_basic
  987. prepare0: archprepare FORCE
  988. $(Q)$(MAKE) $(build)=.
  989. # All the preparing..
  990. prepare: prepare0
  991. # Generate some files
  992. # ---------------------------------------------------------------------------
  993. define filechk_version.h
  994. (echo \#define PLAIN_VERSION \"$(UBOOTRELEASE)\"; \
  995. echo \#define U_BOOT_VERSION \"U-Boot \" PLAIN_VERSION; \
  996. echo \#define CC_VERSION_STRING \"$$($(CC) --version | head -n 1)\"; \
  997. echo \#define LD_VERSION_STRING \"$$($(LD) --version | head -n 1)\"; )
  998. endef
  999. define filechk_timestamp.h
  1000. (LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"'; \
  1001. LC_ALL=C date +'#define U_BOOT_TIME "%T"')
  1002. endef
  1003. $(version_h): include/config/uboot.release FORCE
  1004. $(call filechk,version.h)
  1005. $(timestamp_h): $(srctree)/Makefile FORCE
  1006. $(call filechk,timestamp.h)
  1007. # ---------------------------------------------------------------------------
  1008. PHONY += depend dep
  1009. depend dep:
  1010. @echo '*** Warning: make $@ is unnecessary now.'
  1011. # ---------------------------------------------------------------------------
  1012. quiet_cmd_cpp_lds = LDS $@
  1013. cmd_cpp_lds = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) -ansi \
  1014. -D__ASSEMBLY__ -x assembler-with-cpp -P -o $@ $<
  1015. u-boot.lds: $(LDSCRIPT) prepare FORCE
  1016. $(call if_changed_dep,cpp_lds)
  1017. spl/u-boot-spl.bin: spl/u-boot-spl
  1018. @:
  1019. spl/u-boot-spl: tools prepare
  1020. $(Q)$(MAKE) obj=spl -f $(srctree)/scripts/Makefile.spl all
  1021. spl/sunxi-spl.bin: spl/u-boot-spl
  1022. @:
  1023. tpl/u-boot-tpl.bin: tools prepare
  1024. $(Q)$(MAKE) obj=tpl -f $(srctree)/scripts/Makefile.spl all
  1025. TAG_SUBDIRS := $(patsubst %,$(srctree)/%,$(u-boot-dirs) include)
  1026. FIND := find
  1027. FINDFLAGS := -L
  1028. tags ctags:
  1029. ctags -w -o ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
  1030. -name '*.[chS]' -print`
  1031. etags:
  1032. etags -a -o etags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
  1033. -name '*.[chS]' -print`
  1034. cscope:
  1035. $(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) -name '*.[chS]' -print > \
  1036. cscope.files
  1037. cscope -b -q -k
  1038. SYSTEM_MAP = \
  1039. $(NM) $1 | \
  1040. grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
  1041. LC_ALL=C sort
  1042. System.map: u-boot
  1043. @$(call SYSTEM_MAP,$<) > $@
  1044. checkdtc:
  1045. @if test $(call dtc-version) -lt 0104; then \
  1046. echo '*** Your dtc is too old, please upgrade to dtc 1.4 or newer'; \
  1047. false; \
  1048. fi
  1049. #########################################################################
  1050. # ARM relocations should all be R_ARM_RELATIVE (32-bit) or
  1051. # R_AARCH64_RELATIVE (64-bit).
  1052. checkarmreloc: u-boot
  1053. @RELOC="`$(CROSS_COMPILE)readelf -r -W $< | cut -d ' ' -f 4 | \
  1054. grep R_A | sort -u`"; \
  1055. if test "$$RELOC" != "R_ARM_RELATIVE" -a \
  1056. "$$RELOC" != "R_AARCH64_RELATIVE"; then \
  1057. echo "$< contains unexpected relocations: $$RELOC"; \
  1058. false; \
  1059. fi
  1060. env: scripts_basic
  1061. $(Q)$(MAKE) $(build)=tools/$@
  1062. tools-only: scripts_basic $(version_h) $(timestamp_h)
  1063. $(Q)$(MAKE) $(build)=tools
  1064. tools-all: export HOST_TOOLS_ALL=y
  1065. tools-all: env tools ;
  1066. cross_tools: export CROSS_BUILD_TOOLS=y
  1067. cross_tools: tools ;
  1068. .PHONY : CHANGELOG
  1069. CHANGELOG:
  1070. git log --no-merges U-Boot-1_1_5.. | \
  1071. unexpand -a | sed -e 's/\s\s*$$//' > $@
  1072. include/license.h: tools/bin2header COPYING
  1073. cat COPYING | gzip -9 -c | ./tools/bin2header license_gzip > include/license.h
  1074. #########################################################################
  1075. ###
  1076. # Cleaning is done on three levels.
  1077. # make clean Delete most generated files
  1078. # Leave enough to build external modules
  1079. # make mrproper Delete the current configuration, and all generated files
  1080. # make distclean Remove editor backup files, patch leftover files and the like
  1081. # Directories & files removed with 'make clean'
  1082. CLEAN_DIRS += $(MODVERDIR) \
  1083. $(foreach d, spl tpl, $(patsubst %,$d/%, \
  1084. $(filter-out include, $(shell ls -1 $d 2>/dev/null))))
  1085. CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h \
  1086. boot* u-boot* MLO* SPL System.map
  1087. # Directories & files removed with 'make mrproper'
  1088. MRPROPER_DIRS += include/config include/generated spl tpl \
  1089. .tmp_objdiff
  1090. MRPROPER_FILES += .config .config.old include/autoconf.mk* include/config.h \
  1091. ctags etags TAGS cscope* GPATH GTAGS GRTAGS GSYMS
  1092. # clean - Delete most, but leave enough to build external modules
  1093. #
  1094. clean: rm-dirs := $(CLEAN_DIRS)
  1095. clean: rm-files := $(CLEAN_FILES)
  1096. clean-dirs := $(foreach f,$(u-boot-alldirs),$(if $(wildcard $(srctree)/$f/Makefile),$f))
  1097. clean-dirs := $(addprefix _clean_, $(clean-dirs) doc/DocBook)
  1098. PHONY += $(clean-dirs) clean archclean
  1099. $(clean-dirs):
  1100. $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
  1101. # TODO: Do not use *.cfgtmp
  1102. clean: $(clean-dirs)
  1103. $(call cmd,rmdirs)
  1104. $(call cmd,rmfiles)
  1105. @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
  1106. \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
  1107. -o -name '*.ko.*' -o -name '*.su' -o -name '*.cfgtmp' \
  1108. -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
  1109. -o -name '*.symtypes' -o -name 'modules.order' \
  1110. -o -name modules.builtin -o -name '.tmp_*.o.*' \
  1111. -o -name '*.gcno' \) -type f -print | xargs rm -f
  1112. # mrproper - Delete all generated files, including .config
  1113. #
  1114. mrproper: rm-dirs := $(wildcard $(MRPROPER_DIRS))
  1115. mrproper: rm-files := $(wildcard $(MRPROPER_FILES))
  1116. mrproper-dirs := $(addprefix _mrproper_,scripts)
  1117. PHONY += $(mrproper-dirs) mrproper archmrproper
  1118. $(mrproper-dirs):
  1119. $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)
  1120. mrproper: clean $(mrproper-dirs)
  1121. $(call cmd,rmdirs)
  1122. $(call cmd,rmfiles)
  1123. @rm -f arch/*/include/asm/arch
  1124. # distclean
  1125. #
  1126. PHONY += distclean
  1127. distclean: mrproper
  1128. @find $(srctree) $(RCS_FIND_IGNORE) \
  1129. \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
  1130. -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
  1131. -o -name '.*.rej' -o -name '*%' -o -name 'core' \
  1132. -o -name '*.pyc' \) \
  1133. -type f -print | xargs rm -f
  1134. @rm -f boards.cfg
  1135. backup:
  1136. F=`basename $(srctree)` ; cd .. ; \
  1137. gtar --force-local -zcvf `LC_ALL=C date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F
  1138. help:
  1139. @echo 'Cleaning targets:'
  1140. @echo ' clean - Remove most generated files but keep the config'
  1141. @echo ' mrproper - Remove all generated files + config + various backup files'
  1142. @echo ' distclean - mrproper + remove editor backup and patch files'
  1143. @echo ''
  1144. @echo 'Configuration targets:'
  1145. @$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help
  1146. @echo ''
  1147. @echo 'Other generic targets:'
  1148. @echo ' all - Build all necessary images depending on configuration'
  1149. @echo '* u-boot - Build the bare u-boot'
  1150. @echo ' dir/ - Build all files in dir and below'
  1151. @echo ' dir/file.[oisS] - Build specified target only'
  1152. @echo ' dir/file.lst - Build specified mixed source/assembly target only'
  1153. @echo ' (requires a recent binutils and recent build (System.map))'
  1154. @echo ' tags/ctags - Generate ctags file for editors'
  1155. @echo ' etags - Generate etags file for editors'
  1156. @echo ' cscope - Generate cscope index'
  1157. @echo ' ubootrelease - Output the release version string (use with make -s)'
  1158. @echo ' ubootversion - Output the version stored in Makefile (use with make -s)'
  1159. @echo ''
  1160. @echo 'Static analysers'
  1161. @echo ' checkstack - Generate a list of stack hogs'
  1162. @echo ''
  1163. @echo 'Documentation targets:'
  1164. @$(MAKE) -f $(srctree)/doc/DocBook/Makefile dochelp
  1165. @echo ''
  1166. @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
  1167. @echo ' make V=2 [targets] 2 => give reason for rebuild of target'
  1168. @echo ' make O=dir [targets] Locate all output files in "dir", including .config'
  1169. @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse by default)'
  1170. @echo ' make C=2 [targets] Force check of all c source with $$CHECK'
  1171. @echo ' make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections'
  1172. @echo ' make W=n [targets] Enable extra gcc checks, n=1,2,3 where'
  1173. @echo ' 1: warnings which may be relevant and do not occur too often'
  1174. @echo ' 2: warnings which occur quite often but may still be relevant'
  1175. @echo ' 3: more obscure warnings, can most likely be ignored'
  1176. @echo ' Multiple levels can be combined with W=12 or W=123'
  1177. @echo ''
  1178. @echo 'Execute "make" or "make all" to build all targets marked with [*] '
  1179. @echo 'For further info see the ./README file'
  1180. # Documentation targets
  1181. # ---------------------------------------------------------------------------
  1182. %docs: scripts_basic FORCE
  1183. $(Q)$(MAKE) $(build)=scripts build_docproc
  1184. $(Q)$(MAKE) $(build)=doc/DocBook $@
  1185. # Dummies...
  1186. PHONY += prepare scripts
  1187. prepare: ;
  1188. scripts: ;
  1189. endif #ifeq ($(config-targets),1)
  1190. endif #ifeq ($(mixed-targets),1)
  1191. PHONY += checkstack ubootrelease ubootversion
  1192. checkstack:
  1193. $(OBJDUMP) -d u-boot $$(find . -name u-boot-spl) | \
  1194. $(PERL) $(src)/scripts/checkstack.pl $(ARCH)
  1195. ubootrelease:
  1196. @echo "$(UBOOTVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))"
  1197. ubootversion:
  1198. @echo $(UBOOTVERSION)
  1199. # Single targets
  1200. # ---------------------------------------------------------------------------
  1201. # Single targets are compatible with:
  1202. # - build with mixed source and output
  1203. # - build with separate output dir 'make O=...'
  1204. # - external modules
  1205. #
  1206. # target-dir => where to store outputfile
  1207. # build-dir => directory in kernel source tree to use
  1208. ifeq ($(KBUILD_EXTMOD),)
  1209. build-dir = $(patsubst %/,%,$(dir $@))
  1210. target-dir = $(dir $@)
  1211. else
  1212. zap-slash=$(filter-out .,$(patsubst %/,%,$(dir $@)))
  1213. build-dir = $(KBUILD_EXTMOD)$(if $(zap-slash),/$(zap-slash))
  1214. target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@))
  1215. endif
  1216. %.s: %.c prepare scripts FORCE
  1217. $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
  1218. %.i: %.c prepare scripts FORCE
  1219. $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
  1220. %.o: %.c prepare scripts FORCE
  1221. $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
  1222. %.lst: %.c prepare scripts FORCE
  1223. $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
  1224. %.s: %.S prepare scripts FORCE
  1225. $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
  1226. %.o: %.S prepare scripts FORCE
  1227. $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
  1228. %.symtypes: %.c prepare scripts FORCE
  1229. $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
  1230. # Modules
  1231. /: prepare scripts FORCE
  1232. $(cmd_crmodverdir)
  1233. $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
  1234. $(build)=$(build-dir)
  1235. %/: prepare scripts FORCE
  1236. $(cmd_crmodverdir)
  1237. $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
  1238. $(build)=$(build-dir)
  1239. %.ko: prepare scripts FORCE
  1240. $(cmd_crmodverdir)
  1241. $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
  1242. $(build)=$(build-dir) $(@:.ko=.o)
  1243. $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
  1244. # FIXME Should go into a make.lib or something
  1245. # ===========================================================================
  1246. quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs)))
  1247. cmd_rmdirs = rm -rf $(rm-dirs)
  1248. quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)))
  1249. cmd_rmfiles = rm -f $(rm-files)
  1250. # read all saved command lines
  1251. targets := $(wildcard $(sort $(targets)))
  1252. cmd_files := $(wildcard .*.cmd $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
  1253. ifneq ($(cmd_files),)
  1254. $(cmd_files): ; # Do not try to update included dependency files
  1255. include $(cmd_files)
  1256. endif
  1257. # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir
  1258. # Usage:
  1259. # $(Q)$(MAKE) $(clean)=dir
  1260. clean := -f $(srctree)/scripts/Makefile.clean obj
  1261. endif # skip-makefile
  1262. PHONY += FORCE
  1263. FORCE:
  1264. # Declare the contents of the .PHONY variable as phony. We keep that
  1265. # information in a variable so we can use it in if_changed and friends.
  1266. .PHONY: $(PHONY)