Makefile 47 KB

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