Makefile 48 KB

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