Makefile 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013
  1. # Makefile for buildroot
  2. #
  3. # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
  4. # Copyright (C) 2006-2014 by the Buildroot developers <buildroot@uclibc.org>
  5. # Copyright (C) 2014-2016 by the Buildroot developers <buildroot@buildroot.org>
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. # General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. #
  21. #--------------------------------------------------------------
  22. # Just run 'make menuconfig', configure stuff, then run 'make'.
  23. # You shouldn't need to mess with anything beyond this point...
  24. #--------------------------------------------------------------
  25. # we want bash as shell
  26. SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
  27. else if [ -x /bin/bash ]; then echo /bin/bash; \
  28. else echo sh; fi; fi)
  29. # Trick for always running with a fixed umask
  30. UMASK = 0022
  31. ifneq ($(shell umask),$(UMASK))
  32. .PHONY: _all $(MAKECMDGOALS)
  33. $(MAKECMDGOALS): _all
  34. @:
  35. _all:
  36. @umask $(UMASK) && $(MAKE) --no-print-directory $(MAKECMDGOALS)
  37. else # umask
  38. # This is our default rule, so must come first
  39. all:
  40. # Set and export the version string
  41. export BR2_VERSION := 2016.11-git
  42. # Save running make version since it's clobbered by the make package
  43. RUNNING_MAKE_VERSION := $(MAKE_VERSION)
  44. # Check for minimal make version (note: this check will break at make 10.x)
  45. MIN_MAKE_VERSION = 3.81
  46. ifneq ($(firstword $(sort $(RUNNING_MAKE_VERSION) $(MIN_MAKE_VERSION))),$(MIN_MAKE_VERSION))
  47. $(error You have make '$(RUNNING_MAKE_VERSION)' installed. GNU make >= $(MIN_MAKE_VERSION) is required)
  48. endif
  49. # Parallel execution of this Makefile is disabled because it changes
  50. # the packages building order, that can be a problem for two reasons:
  51. # - If a package has an unspecified optional dependency and that
  52. # dependency is present when the package is built, it is used,
  53. # otherwise it isn't (but compilation happily proceeds) so the end
  54. # result will differ if the order is swapped due to parallel
  55. # building.
  56. # - Also changing the building order can be a problem if two packages
  57. # manipulate the same file in the target directory.
  58. #
  59. # Taking into account the above considerations, if you still want to execute
  60. # this top-level Makefile in parallel comment the ".NOTPARALLEL" line and
  61. # use the -j<jobs> option when building, e.g:
  62. # make -j$((`getconf _NPROCESSORS_ONLN`+1))
  63. .NOTPARALLEL:
  64. # absolute path
  65. TOPDIR := $(CURDIR)
  66. CONFIG_CONFIG_IN = Config.in
  67. CONFIG = support/kconfig
  68. DATE := $(shell date +%Y%m%d)
  69. # Compute the full local version string so packages can use it as-is
  70. # Need to export it, so it can be got from environment in children (eg. mconf)
  71. export BR2_VERSION_FULL := $(BR2_VERSION)$(shell $(TOPDIR)/support/scripts/setlocalversion)
  72. noconfig_targets := menuconfig nconfig gconfig xconfig config oldconfig randconfig \
  73. defconfig %_defconfig allyesconfig allnoconfig silentoldconfig release \
  74. randpackageconfig allyespackageconfig allnopackageconfig \
  75. print-version olddefconfig distclean
  76. # Some global targets do not trigger a build, but are used to collect
  77. # metadata, or do various checks. When such targets are triggered,
  78. # some packages should not do their configuration sanity
  79. # checks. Provide them a BR_BUILDING variable set to 'y' when we're
  80. # actually building and they should do their sanity checks.
  81. #
  82. # We're building in two situations: when MAKECMDGOALS is empty
  83. # (default target is to build), or when MAKECMDGOALS contains
  84. # something else than one of the nobuild_targets.
  85. nobuild_targets := source source-check \
  86. legal-info external-deps _external-deps \
  87. clean distclean help
  88. ifeq ($(MAKECMDGOALS),)
  89. BR_BUILDING = y
  90. else ifneq ($(filter-out $(nobuild_targets),$(MAKECMDGOALS)),)
  91. BR_BUILDING = y
  92. endif
  93. # Include some helper macros and variables
  94. include support/misc/utils.mk
  95. ifneq ("$(origin O)", "command line")
  96. O := output
  97. CONFIG_DIR := $(TOPDIR)
  98. NEED_WRAPPER =
  99. else
  100. # other packages might also support Linux-style out of tree builds
  101. # with the O=<dir> syntax (E.G. BusyBox does). As make automatically
  102. # forwards command line variable definitions those packages get very
  103. # confused. Fix this by telling make to not do so
  104. MAKEOVERRIDES =
  105. # strangely enough O is still passed to submakes with MAKEOVERRIDES
  106. # (with make 3.81 atleast), the only thing that changes is the output
  107. # of the origin function (command line -> environment).
  108. # Unfortunately some packages don't look at origin (E.G. uClibc 0.9.31+)
  109. # To really make O go away, we have to override it.
  110. override O := $(O)
  111. CONFIG_DIR := $(O)
  112. # we need to pass O= everywhere we call back into the toplevel makefile
  113. EXTRAMAKEARGS = O=$(O)
  114. NEED_WRAPPER = y
  115. endif
  116. # bash prints the name of the directory on 'cd <dir>' if CDPATH is
  117. # set, so unset it here to not cause problems. Notice that the export
  118. # line doesn't affect the environment of $(shell ..) calls, so
  119. # explictly throw away any output from 'cd' here.
  120. export CDPATH :=
  121. BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && pwd)
  122. $(if $(BASE_DIR),, $(error output directory "$(O)" does not exist))
  123. # Handling of BR2_EXTERNAL.
  124. #
  125. # The value of BR2_EXTERNAL is stored in .br-external in the output directory.
  126. # On subsequent invocations of make, it is read in. It can still be overridden
  127. # on the command line, therefore the file is re-created every time make is run.
  128. #
  129. # When BR2_EXTERNAL is set to an empty value (e.g. explicitly in command
  130. # line), the .br-external file is removed and we point to
  131. # support/dummy-external. This makes sure we can unconditionally include the
  132. # Config.in and external.mk from the BR2_EXTERNAL directory. In this case,
  133. # override is necessary so the user can clear BR2_EXTERNAL from the command
  134. # line, but the dummy path is still used internally.
  135. BR2_EXTERNAL_FILE = $(BASE_DIR)/.br-external
  136. -include $(BR2_EXTERNAL_FILE)
  137. ifeq ($(BR2_EXTERNAL),)
  138. override BR2_EXTERNAL = support/dummy-external
  139. $(shell rm -f $(BR2_EXTERNAL_FILE))
  140. else
  141. _BR2_EXTERNAL = $(shell cd $(BR2_EXTERNAL) >/dev/null 2>&1 && pwd)
  142. ifeq ($(_BR2_EXTERNAL),)
  143. $(error BR2_EXTERNAL='$(BR2_EXTERNAL)' does not exist, relative to $(TOPDIR))
  144. endif
  145. override BR2_EXTERNAL := $(_BR2_EXTERNAL)
  146. $(shell echo BR2_EXTERNAL ?= $(BR2_EXTERNAL) > $(BR2_EXTERNAL_FILE))
  147. endif
  148. # To make sure that the environment variable overrides the .config option,
  149. # set this before including .config.
  150. ifneq ($(BR2_DL_DIR),)
  151. DL_DIR := $(BR2_DL_DIR)
  152. endif
  153. ifneq ($(BR2_CCACHE_DIR),)
  154. BR_CACHE_DIR := $(BR2_CCACHE_DIR)
  155. endif
  156. # Need that early, before we scan packages
  157. # Avoids doing the $(or...) everytime
  158. BR_GRAPH_OUT := $(or $(BR2_GRAPH_OUT),pdf)
  159. BUILD_DIR := $(BASE_DIR)/build
  160. BINARIES_DIR := $(BASE_DIR)/images
  161. TARGET_DIR := $(BASE_DIR)/target
  162. # initial definition so that 'make clean' works for most users, even without
  163. # .config. HOST_DIR will be overwritten later when .config is included.
  164. HOST_DIR := $(BASE_DIR)/host
  165. GRAPHS_DIR := $(BASE_DIR)/graphs
  166. LEGAL_INFO_DIR = $(BASE_DIR)/legal-info
  167. REDIST_SOURCES_DIR_TARGET = $(LEGAL_INFO_DIR)/sources
  168. REDIST_SOURCES_DIR_HOST = $(LEGAL_INFO_DIR)/host-sources
  169. LICENSE_FILES_DIR_TARGET = $(LEGAL_INFO_DIR)/licenses
  170. LICENSE_FILES_DIR_HOST = $(LEGAL_INFO_DIR)/host-licenses
  171. LEGAL_MANIFEST_CSV_TARGET = $(LEGAL_INFO_DIR)/manifest.csv
  172. LEGAL_MANIFEST_CSV_HOST = $(LEGAL_INFO_DIR)/host-manifest.csv
  173. LEGAL_LICENSES_TXT_TARGET = $(LEGAL_INFO_DIR)/licenses.txt
  174. LEGAL_LICENSES_TXT_HOST = $(LEGAL_INFO_DIR)/host-licenses.txt
  175. LEGAL_WARNINGS = $(LEGAL_INFO_DIR)/.warnings
  176. LEGAL_REPORT = $(LEGAL_INFO_DIR)/README
  177. ################################################################################
  178. #
  179. # staging and target directories do NOT list these as
  180. # dependencies anywhere else
  181. #
  182. ################################################################################
  183. $(BUILD_DIR) $(TARGET_DIR) $(HOST_DIR) $(BINARIES_DIR) $(LEGAL_INFO_DIR) $(REDIST_SOURCES_DIR_TARGET) $(REDIST_SOURCES_DIR_HOST):
  184. @mkdir -p $@
  185. BR2_CONFIG = $(CONFIG_DIR)/.config
  186. # Pull in the user's configuration file
  187. ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
  188. -include $(BR2_CONFIG)
  189. endif
  190. # timezone and locale may affect build output
  191. ifeq ($(BR2_REPRODUCIBLE),y)
  192. export TZ=UTC
  193. export LANG=C
  194. export LC_ALL=C
  195. endif
  196. # To put more focus on warnings, be less verbose as default
  197. # Use 'make V=1' to see the full commands
  198. ifeq ("$(origin V)", "command line")
  199. KBUILD_VERBOSE = $(V)
  200. endif
  201. ifndef KBUILD_VERBOSE
  202. KBUILD_VERBOSE = 0
  203. endif
  204. ifeq ($(KBUILD_VERBOSE),1)
  205. Q =
  206. ifndef VERBOSE
  207. VERBOSE = 1
  208. endif
  209. export VERBOSE
  210. else
  211. Q = @
  212. endif
  213. # kconfig uses CONFIG_SHELL
  214. CONFIG_SHELL := $(SHELL)
  215. export SHELL CONFIG_SHELL Q KBUILD_VERBOSE
  216. ifndef HOSTAR
  217. HOSTAR := ar
  218. endif
  219. ifndef HOSTAS
  220. HOSTAS := as
  221. endif
  222. ifndef HOSTCC
  223. HOSTCC := gcc
  224. HOSTCC := $(shell which $(HOSTCC) || type -p $(HOSTCC) || echo gcc)
  225. endif
  226. HOSTCC_NOCCACHE := $(HOSTCC)
  227. ifndef HOSTCXX
  228. HOSTCXX := g++
  229. HOSTCXX := $(shell which $(HOSTCXX) || type -p $(HOSTCXX) || echo g++)
  230. endif
  231. HOSTCXX_NOCCACHE := $(HOSTCXX)
  232. ifndef HOSTCPP
  233. HOSTCPP := cpp
  234. endif
  235. ifndef HOSTLD
  236. HOSTLD := ld
  237. endif
  238. ifndef HOSTLN
  239. HOSTLN := ln
  240. endif
  241. ifndef HOSTNM
  242. HOSTNM := nm
  243. endif
  244. ifndef HOSTOBJCOPY
  245. HOSTOBJCOPY := objcopy
  246. endif
  247. ifndef HOSTRANLIB
  248. HOSTRANLIB := ranlib
  249. endif
  250. HOSTAR := $(shell which $(HOSTAR) || type -p $(HOSTAR) || echo ar)
  251. HOSTAS := $(shell which $(HOSTAS) || type -p $(HOSTAS) || echo as)
  252. HOSTCPP := $(shell which $(HOSTCPP) || type -p $(HOSTCPP) || echo cpp)
  253. HOSTLD := $(shell which $(HOSTLD) || type -p $(HOSTLD) || echo ld)
  254. HOSTLN := $(shell which $(HOSTLN) || type -p $(HOSTLN) || echo ln)
  255. HOSTNM := $(shell which $(HOSTNM) || type -p $(HOSTNM) || echo nm)
  256. HOSTOBJCOPY := $(shell which $(HOSTOBJCOPY) || type -p $(HOSTOBJCOPY) || echo objcopy)
  257. HOSTRANLIB := $(shell which $(HOSTRANLIB) || type -p $(HOSTRANLIB) || echo ranlib)
  258. export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTLD
  259. export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE
  260. # Determine the userland we are running on.
  261. #
  262. # Note that, despite its name, we are not interested in the actual
  263. # architecture name. This is mostly used to determine whether some
  264. # of the binary tools (e.g. pre-built external toolchains) can run
  265. # on the current host. So we need to know if the userland we're
  266. # running on can actually run those toolchains.
  267. #
  268. # For example, a 64-bit prebuilt toolchain will not run on a 64-bit
  269. # kernel if the userland is 32-bit (e.g. in a chroot for example).
  270. #
  271. # So, we extract the first part of the tuple the host gcc was
  272. # configured to generate code for; we assume this is our userland.
  273. #
  274. export HOSTARCH := $(shell LC_ALL=C $(HOSTCC_NOCCACHE) -v 2>&1 | \
  275. sed -e '/^Target: \([^-]*\).*/!d' \
  276. -e 's//\1/' \
  277. -e 's/i.86/x86/' \
  278. -e 's/sun4u/sparc64/' \
  279. -e 's/arm.*/arm/' \
  280. -e 's/sa110/arm/' \
  281. -e 's/ppc64/powerpc64/' \
  282. -e 's/ppc/powerpc/' \
  283. -e 's/macppc/powerpc/' \
  284. -e 's/sh.*/sh/' )
  285. HOSTCC_VERSION := $(shell $(HOSTCC_NOCCACHE) --version | \
  286. sed -n -r 's/^.* ([0-9]*)\.([0-9]*)\.([0-9]*)[ ]*.*/\1 \2/p')
  287. # For gcc >= 5.x, we only need the major version.
  288. ifneq ($(firstword $(HOSTCC_VERSION)),4)
  289. HOSTCC_VERSION := $(firstword $(HOSTCC_VERSION))
  290. endif
  291. # Make sure pkg-config doesn't look outside the buildroot tree
  292. HOST_PKG_CONFIG_PATH := $(PKG_CONFIG_PATH)
  293. unexport PKG_CONFIG_PATH
  294. unexport PKG_CONFIG_SYSROOT_DIR
  295. unexport PKG_CONFIG_LIBDIR
  296. # Having DESTDIR set in the environment confuses the installation
  297. # steps of some packages.
  298. unexport DESTDIR
  299. # Causes breakage with packages that needs host-ruby
  300. unexport RUBYOPT
  301. include package/pkg-utils.mk
  302. include package/doc-asciidoc.mk
  303. ifeq ($(BR2_HAVE_DOT_CONFIG),y)
  304. ################################################################################
  305. #
  306. # Hide troublesome environment variables from sub processes
  307. #
  308. ################################################################################
  309. unexport CROSS_COMPILE
  310. unexport ARCH
  311. unexport CC
  312. unexport LD
  313. unexport AR
  314. unexport CXX
  315. unexport CPP
  316. unexport RANLIB
  317. unexport CFLAGS
  318. unexport CXXFLAGS
  319. unexport GREP_OPTIONS
  320. unexport TAR_OPTIONS
  321. unexport CONFIG_SITE
  322. unexport QMAKESPEC
  323. unexport TERMINFO
  324. unexport MACHINE
  325. unexport O
  326. GNU_HOST_NAME := $(shell support/gnuconfig/config.guess)
  327. PACKAGES :=
  328. PACKAGES_ALL :=
  329. # silent mode requested?
  330. QUIET := $(if $(findstring s,$(filter-out --%,$(MAKEFLAGS))),-q)
  331. # Strip off the annoying quoting
  332. ARCH := $(call qstrip,$(BR2_ARCH))
  333. KERNEL_ARCH := $(shell echo "$(ARCH)" | sed -e "s/-.*//" \
  334. -e s/i.86/i386/ -e s/sun4u/sparc64/ \
  335. -e s/arcle/arc/ \
  336. -e s/arceb/arc/ \
  337. -e s/arm.*/arm/ -e s/sa110/arm/ \
  338. -e s/aarch64.*/arm64/ \
  339. -e s/bfin/blackfin/ \
  340. -e s/parisc64/parisc/ \
  341. -e s/powerpc64.*/powerpc/ \
  342. -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
  343. -e s/sh.*/sh/ \
  344. -e s/microblazeel/microblaze/)
  345. ZCAT := $(call qstrip,$(BR2_ZCAT))
  346. BZCAT := $(call qstrip,$(BR2_BZCAT))
  347. XZCAT := $(call qstrip,$(BR2_XZCAT))
  348. TAR_OPTIONS = $(call qstrip,$(BR2_TAR_OPTIONS)) -xf
  349. # packages compiled for the host go here
  350. HOST_DIR := $(call qstrip,$(BR2_HOST_DIR))
  351. # Quotes are needed for spaces and all in the original PATH content.
  352. BR_PATH = "$(HOST_DIR)/bin:$(HOST_DIR)/sbin:$(HOST_DIR)/usr/bin:$(HOST_DIR)/usr/sbin:$(PATH)"
  353. # Location of a file giving a big fat warning that output/target
  354. # should not be used as the root filesystem.
  355. TARGET_DIR_WARNING_FILE = $(TARGET_DIR)/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
  356. ifeq ($(BR2_CCACHE),y)
  357. CCACHE := $(HOST_DIR)/usr/bin/ccache
  358. BR_CACHE_DIR ?= $(call qstrip,$(BR2_CCACHE_DIR))
  359. export BR_CACHE_DIR
  360. HOSTCC := $(CCACHE) $(HOSTCC)
  361. HOSTCXX := $(CCACHE) $(HOSTCXX)
  362. else
  363. export BR_NO_CCACHE
  364. endif
  365. # Scripts in support/ or post-build scripts may need to reference
  366. # these locations, so export them so it is easier to use
  367. export BR2_CONFIG
  368. export BR2_REPRODUCIBLE
  369. export TARGET_DIR
  370. export STAGING_DIR
  371. export HOST_DIR
  372. export BINARIES_DIR
  373. export BASE_DIR
  374. ################################################################################
  375. #
  376. # You should probably leave this stuff alone unless you know
  377. # what you are doing.
  378. #
  379. ################################################################################
  380. all: world
  381. # Include legacy before the other things, because package .mk files
  382. # may rely on it.
  383. ifneq ($(BR2_DEPRECATED),y)
  384. include Makefile.legacy
  385. endif
  386. include package/Makefile.in
  387. include support/dependencies/dependencies.mk
  388. include toolchain/*.mk
  389. include toolchain/*/*.mk
  390. # Include the package override file if one has been provided in the
  391. # configuration.
  392. PACKAGE_OVERRIDE_FILE = $(call qstrip,$(BR2_PACKAGE_OVERRIDE_FILE))
  393. ifneq ($(PACKAGE_OVERRIDE_FILE),)
  394. -include $(PACKAGE_OVERRIDE_FILE)
  395. endif
  396. include $(sort $(wildcard package/*/*.mk))
  397. include boot/common.mk
  398. include linux/linux.mk
  399. include fs/common.mk
  400. include $(BR2_EXTERNAL)/external.mk
  401. # Now we are sure we have all the packages scanned and defined. We now
  402. # check for each package in the list of enabled packages, that all its
  403. # dependencies are indeed enabled.
  404. #
  405. # Only trigger the check for default builds. If the user forces building
  406. # a package, even if not enabled in the configuration, we want to accept
  407. # it.
  408. #
  409. ifeq ($(MAKECMDGOALS),)
  410. define CHECK_ONE_DEPENDENCY
  411. ifeq ($$($(2)_TYPE),target)
  412. ifeq ($$($(2)_IS_VIRTUAL),)
  413. ifneq ($$($$($(2)_KCONFIG_VAR)),y)
  414. $$(error $$($(2)_NAME) is in the dependency chain of $$($(1)_NAME) that \
  415. has added it to its _DEPENDENCIES variable without selecting it or \
  416. depending on it from Config.in)
  417. endif
  418. endif
  419. endif
  420. endef
  421. $(foreach pkg,$(call UPPERCASE,$(PACKAGES)),\
  422. $(foreach dep,$(call UPPERCASE,$($(pkg)_FINAL_ALL_DEPENDENCIES)),\
  423. $(eval $(call CHECK_ONE_DEPENDENCY,$(pkg),$(dep))$(sep))))
  424. endif
  425. dirs: $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
  426. $(HOST_DIR) $(BINARIES_DIR)
  427. $(BUILD_DIR)/buildroot-config/auto.conf: $(BR2_CONFIG)
  428. $(MAKE1) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig
  429. prepare: $(BUILD_DIR)/buildroot-config/auto.conf
  430. world: target-post-image
  431. .PHONY: all world toolchain dirs clean distclean source outputmakefile \
  432. legal-info legal-info-prepare legal-info-clean printvars help \
  433. list-defconfigs target-finalize target-post-image source-check
  434. # Populating the staging with the base directories is handled by the skeleton package
  435. $(STAGING_DIR):
  436. @mkdir -p $(STAGING_DIR)
  437. @ln -snf $(STAGING_DIR) $(BASE_DIR)/staging
  438. RSYNC_VCS_EXCLUSIONS = \
  439. --exclude .svn --exclude .git --exclude .hg --exclude .bzr \
  440. --exclude CVS
  441. STRIP_FIND_CMD = find $(TARGET_DIR)
  442. ifneq (,$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS)))
  443. STRIP_FIND_CMD += \( $(call finddirclauses,$(TARGET_DIR),$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS))) \) -prune -o
  444. endif
  445. STRIP_FIND_CMD += -type f \( -perm /111 -o -name '*.so*' \)
  446. # file exclusions:
  447. # - libpthread.so: a non-stripped libpthread shared library is needed for
  448. # proper debugging of pthread programs using gdb.
  449. # - ld.so: a non-stripped dynamic linker library is needed for valgrind
  450. # - kernel modules (*.ko): do not function properly when stripped like normal
  451. # applications and libraries. Normally kernel modules are already excluded
  452. # by the executable permission check above, so the explicit exclusion is only
  453. # done for kernel modules with incorrect permissions.
  454. STRIP_FIND_CMD += -not \( $(call findfileclauses,libpthread*.so* ld-*.so* *.ko $(call qstrip,$(BR2_STRIP_EXCLUDE_FILES))) \) -print0
  455. ifeq ($(BR2_ECLIPSE_REGISTER),y)
  456. define TOOLCHAIN_ECLIPSE_REGISTER
  457. ./support/scripts/eclipse-register-toolchain `readlink -f $(O)` \
  458. $(notdir $(TARGET_CROSS)) $(BR2_ARCH)
  459. endef
  460. TARGET_FINALIZE_HOOKS += TOOLCHAIN_ECLIPSE_REGISTER
  461. endif
  462. # Generate locale data. Basically, we call the localedef program
  463. # (built by the host-localedef package) for each locale. The input
  464. # data comes preferably from the toolchain, or if the toolchain does
  465. # not have them (Linaro toolchains), we use the ones available on the
  466. # host machine.
  467. ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),y)
  468. GLIBC_GENERATE_LOCALES = $(call qstrip,$(BR2_GENERATE_LOCALE))
  469. ifneq ($(GLIBC_GENERATE_LOCALES),)
  470. PACKAGES += host-localedef
  471. define GENERATE_GLIBC_LOCALES
  472. $(Q)mkdir -p $(TARGET_DIR)/usr/lib/locale/
  473. $(Q)for locale in $(GLIBC_GENERATE_LOCALES) ; do \
  474. inputfile=`echo $${locale} | cut -f1 -d'.'` ; \
  475. charmap=`echo $${locale} | cut -f2 -d'.' -s` ; \
  476. if test -z "$${charmap}" ; then \
  477. charmap="UTF-8" ; \
  478. fi ; \
  479. echo "Generating locale $${inputfile}.$${charmap}" ; \
  480. I18NPATH=$(STAGING_DIR)/usr/share/i18n:/usr/share/i18n \
  481. $(HOST_DIR)/usr/bin/localedef \
  482. --prefix=$(TARGET_DIR) \
  483. --$(call LOWERCASE,$(BR2_ENDIAN))-endian \
  484. -i $${inputfile} -f $${charmap} \
  485. $${locale} ; \
  486. done
  487. endef
  488. TARGET_FINALIZE_HOOKS += GENERATE_GLIBC_LOCALES
  489. endif
  490. endif
  491. ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
  492. LOCALE_WHITELIST = $(BUILD_DIR)/locales.nopurge
  493. LOCALE_NOPURGE = $(call qstrip,$(BR2_ENABLE_LOCALE_WHITELIST))
  494. # This piece of junk does the following:
  495. # First collect the whitelist in a file.
  496. # Then go over all the locale dirs and for each subdir, check if it exists
  497. # in the whitelist file. If it doesn't, kill it.
  498. # Finally, specifically for X11, regenerate locale.dir from the whitelist.
  499. define PURGE_LOCALES
  500. rm -f $(LOCALE_WHITELIST)
  501. for i in $(LOCALE_NOPURGE) locale-archive; do echo $$i >> $(LOCALE_WHITELIST); done
  502. for dir in $(wildcard $(addprefix $(TARGET_DIR),/usr/share/locale /usr/share/X11/locale /usr/lib/locale)); \
  503. do \
  504. for langdir in $$dir/*; \
  505. do \
  506. if [ -e "$${langdir}" ]; \
  507. then \
  508. grep -qx "$${langdir##*/}" $(LOCALE_WHITELIST) || rm -rf $$langdir; \
  509. fi \
  510. done; \
  511. done
  512. if [ -d $(TARGET_DIR)/usr/share/X11/locale ]; \
  513. then \
  514. for lang in $(LOCALE_NOPURGE); \
  515. do \
  516. if [ -f $(TARGET_DIR)/usr/share/X11/locale/$$lang/XLC_LOCALE ]; \
  517. then \
  518. echo "$$lang/XLC_LOCALE: $$lang"; \
  519. fi \
  520. done > $(TARGET_DIR)/usr/share/X11/locale/locale.dir; \
  521. fi
  522. endef
  523. TARGET_FINALIZE_HOOKS += PURGE_LOCALES
  524. endif
  525. $(TARGETS_ROOTFS): target-finalize
  526. target-finalize: $(PACKAGES)
  527. @$(call MESSAGE,"Finalizing target directory")
  528. $(foreach hook,$(TARGET_FINALIZE_HOOKS),$($(hook))$(sep))
  529. rm -rf $(TARGET_DIR)/usr/include $(TARGET_DIR)/usr/share/aclocal \
  530. $(TARGET_DIR)/usr/lib/pkgconfig $(TARGET_DIR)/usr/share/pkgconfig \
  531. $(TARGET_DIR)/usr/lib/cmake $(TARGET_DIR)/usr/share/cmake
  532. find $(TARGET_DIR)/usr/{lib,share}/ -name '*.cmake' -print0 | xargs -0 rm -f
  533. find $(TARGET_DIR)/lib $(TARGET_DIR)/usr/lib $(TARGET_DIR)/usr/libexec \
  534. \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
  535. ifneq ($(BR2_PACKAGE_GDB),y)
  536. rm -rf $(TARGET_DIR)/usr/share/gdb
  537. endif
  538. ifneq ($(BR2_PACKAGE_BASH),y)
  539. rm -rf $(TARGET_DIR)/usr/share/bash-completion
  540. endif
  541. ifneq ($(BR2_PACKAGE_ZSH),y)
  542. rm -rf $(TARGET_DIR)/usr/share/zsh
  543. endif
  544. rm -rf $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/man
  545. rm -rf $(TARGET_DIR)/usr/info $(TARGET_DIR)/usr/share/info
  546. rm -rf $(TARGET_DIR)/usr/doc $(TARGET_DIR)/usr/share/doc
  547. rm -rf $(TARGET_DIR)/usr/share/gtk-doc
  548. -rmdir $(TARGET_DIR)/usr/share 2>/dev/null
  549. $(STRIP_FIND_CMD) | xargs -0 $(STRIPCMD) 2>/dev/null || true
  550. # See http://sourceware.org/gdb/wiki/FAQ, "GDB does not see any threads
  551. # besides the one in which crash occurred; or SIGTRAP kills my program when
  552. # I set a breakpoint"
  553. ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
  554. find $(TARGET_DIR)/lib -type f -name 'libpthread*.so*' | \
  555. xargs -r $(STRIPCMD) $(STRIP_STRIP_DEBUG)
  556. endif
  557. # Valgrind needs ld.so with enough information, so only strip
  558. # debugging symbols.
  559. find $(TARGET_DIR)/lib -type f -name 'ld-*.so*' | \
  560. xargs -r $(STRIPCMD) $(STRIP_STRIP_DEBUG)
  561. test -f $(TARGET_DIR)/etc/ld.so.conf && \
  562. { echo "ERROR: we shouldn't have a /etc/ld.so.conf file"; exit 1; } || true
  563. test -d $(TARGET_DIR)/etc/ld.so.conf.d && \
  564. { echo "ERROR: we shouldn't have a /etc/ld.so.conf.d directory"; exit 1; } || true
  565. mkdir -p $(TARGET_DIR)/etc
  566. ( \
  567. echo "NAME=Buildroot"; \
  568. echo "VERSION=$(BR2_VERSION_FULL)"; \
  569. echo "ID=buildroot"; \
  570. echo "VERSION_ID=$(BR2_VERSION)"; \
  571. echo "PRETTY_NAME=\"Buildroot $(BR2_VERSION)\"" \
  572. ) > $(TARGET_DIR)/etc/os-release
  573. @$(foreach d, $(call qstrip,$(BR2_ROOTFS_OVERLAY)), \
  574. $(call MESSAGE,"Copying overlay $(d)"); \
  575. rsync -a --ignore-times --keep-dirlinks $(RSYNC_VCS_EXCLUSIONS) \
  576. --chmod=u=rwX,go=rX --exclude .empty --exclude '*~' \
  577. $(d)/ $(TARGET_DIR)$(sep))
  578. @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_BUILD_SCRIPT)), \
  579. $(call MESSAGE,"Executing post-build script $(s)"); \
  580. $(EXTRA_ENV) $(s) $(TARGET_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
  581. target-post-image: $(TARGETS_ROOTFS) target-finalize
  582. @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_IMAGE_SCRIPT)), \
  583. $(call MESSAGE,"Executing post-image script $(s)"); \
  584. $(EXTRA_ENV) $(s) $(BINARIES_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
  585. source: $(foreach p,$(PACKAGES),$(p)-all-source)
  586. _external-deps: $(foreach p,$(PACKAGES),$(p)-all-external-deps)
  587. external-deps:
  588. @$(MAKE1) -Bs $(EXTRAMAKEARGS) _external-deps | sort -u
  589. # check if download URLs are outdated
  590. source-check: $(foreach p,$(PACKAGES),$(p)-all-source-check)
  591. legal-info-clean:
  592. @rm -fr $(LEGAL_INFO_DIR)
  593. legal-info-prepare: $(LEGAL_INFO_DIR)
  594. @$(call MESSAGE,"Collecting legal info")
  595. @$(call legal-license-file,buildroot,COPYING,COPYING,HOST)
  596. @$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE,SOURCE SITE,TARGET)
  597. @$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE,SOURCE SITE,HOST)
  598. @$(call legal-manifest,buildroot,$(BR2_VERSION_FULL),GPLv2+,COPYING,not saved,not saved,HOST)
  599. @$(call legal-warning,the Buildroot source code has not been saved)
  600. @cp $(BR2_CONFIG) $(LEGAL_INFO_DIR)/buildroot.config
  601. legal-info: dirs legal-info-clean legal-info-prepare $(foreach p,$(PACKAGES),$(p)-all-legal-info) \
  602. $(REDIST_SOURCES_DIR_TARGET) $(REDIST_SOURCES_DIR_HOST)
  603. @cat support/legal-info/README.header >>$(LEGAL_REPORT)
  604. @if [ -r $(LEGAL_WARNINGS) ]; then \
  605. cat support/legal-info/README.warnings-header \
  606. $(LEGAL_WARNINGS) >>$(LEGAL_REPORT); \
  607. cat $(LEGAL_WARNINGS); fi
  608. @rm -f $(LEGAL_WARNINGS)
  609. @(cd $(LEGAL_INFO_DIR); \
  610. find * -type f -exec sha256sum {} + | LC_ALL=C sort -k2 \
  611. >.legal-info.sha256; \
  612. mv .legal-info.sha256 legal-info.sha256)
  613. @echo "Legal info produced in $(LEGAL_INFO_DIR)"
  614. show-targets:
  615. @echo $(PACKAGES) $(TARGETS_ROOTFS)
  616. graph-build: $(O)/build/build-time.log
  617. @install -d $(GRAPHS_DIR)
  618. $(foreach o,name build duration,./support/scripts/graph-build-time \
  619. --type=histogram --order=$(o) --input=$(<) \
  620. --output=$(GRAPHS_DIR)/build.hist-$(o).$(BR_GRAPH_OUT) \
  621. $(if $(BR2_GRAPH_ALT),--alternate-colors)$(sep))
  622. $(foreach t,packages steps,./support/scripts/graph-build-time \
  623. --type=pie-$(t) --input=$(<) \
  624. --output=$(GRAPHS_DIR)/build.pie-$(t).$(BR_GRAPH_OUT) \
  625. $(if $(BR2_GRAPH_ALT),--alternate-colors)$(sep))
  626. graph-depends-requirements:
  627. @dot -? >/dev/null 2>&1 || \
  628. { echo "ERROR: The 'dot' program from Graphviz is needed for graph-depends" >&2; exit 1; }
  629. graph-depends: graph-depends-requirements
  630. @$(INSTALL) -d $(GRAPHS_DIR)
  631. @cd "$(CONFIG_DIR)"; \
  632. $(TOPDIR)/support/scripts/graph-depends $(BR2_GRAPH_DEPS_OPTS) \
  633. -o $(GRAPHS_DIR)/$(@).dot
  634. dot $(BR2_GRAPH_DOT_OPTS) -T$(BR_GRAPH_OUT) \
  635. -o $(GRAPHS_DIR)/$(@).$(BR_GRAPH_OUT) \
  636. $(GRAPHS_DIR)/$(@).dot
  637. graph-size:
  638. $(Q)mkdir -p $(GRAPHS_DIR)
  639. $(Q)$(TOPDIR)/support/scripts/size-stats --builddir $(BASE_DIR) \
  640. --graph $(GRAPHS_DIR)/graph-size.$(BR_GRAPH_OUT) \
  641. --file-size-csv $(GRAPHS_DIR)/file-size-stats.csv \
  642. --package-size-csv $(GRAPHS_DIR)/package-size-stats.csv
  643. check-dependencies:
  644. @cd "$(CONFIG_DIR)"; \
  645. $(TOPDIR)/support/scripts/graph-depends -C
  646. else # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
  647. all: menuconfig
  648. endif # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
  649. # configuration
  650. # ---------------------------------------------------------------------------
  651. HOSTCFLAGS = $(CFLAGS_FOR_BUILD)
  652. export HOSTCFLAGS
  653. .PHONY: prepare-kconfig
  654. prepare-kconfig: outputmakefile $(BUILD_DIR)/.br2-external.in
  655. $(BUILD_DIR)/buildroot-config/%onf:
  656. mkdir -p $(@D)/lxdialog
  657. PKG_CONFIG_PATH="$(HOST_PKG_CONFIG_PATH)" $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" \
  658. obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)
  659. DEFCONFIG = $(call qstrip,$(BR2_DEFCONFIG))
  660. # We don't want to fully expand BR2_DEFCONFIG here, so Kconfig will
  661. # recognize that if it's still at its default $(CONFIG_DIR)/defconfig
  662. COMMON_CONFIG_ENV = \
  663. BR2_DEFCONFIG='$(call qstrip,$(value BR2_DEFCONFIG))' \
  664. KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
  665. KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
  666. KCONFIG_TRISTATE=$(BUILD_DIR)/buildroot-config/tristate.config \
  667. BR2_CONFIG=$(BR2_CONFIG) \
  668. BR2_EXTERNAL=$(BR2_EXTERNAL) \
  669. HOST_GCC_VERSION="$(HOSTCC_VERSION)" \
  670. BUILD_DIR=$(BUILD_DIR) \
  671. SKIP_LEGACY=
  672. xconfig: $(BUILD_DIR)/buildroot-config/qconf prepare-kconfig
  673. @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
  674. gconfig: $(BUILD_DIR)/buildroot-config/gconf prepare-kconfig
  675. @$(COMMON_CONFIG_ENV) srctree=$(TOPDIR) $< $(CONFIG_CONFIG_IN)
  676. menuconfig: $(BUILD_DIR)/buildroot-config/mconf prepare-kconfig
  677. @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
  678. nconfig: $(BUILD_DIR)/buildroot-config/nconf prepare-kconfig
  679. @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
  680. config: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
  681. @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
  682. # For the config targets that automatically select options, we pass
  683. # SKIP_LEGACY=y to disable the legacy options. However, in that case
  684. # no values are set for the legacy options so a subsequent oldconfig
  685. # will query them. Therefore, run an additional olddefconfig.
  686. oldconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
  687. @$(COMMON_CONFIG_ENV) $< --oldconfig $(CONFIG_CONFIG_IN)
  688. randconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
  689. @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y $< --randconfig $(CONFIG_CONFIG_IN)
  690. @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
  691. allyesconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
  692. @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y $< --allyesconfig $(CONFIG_CONFIG_IN)
  693. @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
  694. allnoconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
  695. @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y $< --allnoconfig $(CONFIG_CONFIG_IN)
  696. @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
  697. randpackageconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
  698. @grep -v BR2_PACKAGE_ $(BR2_CONFIG) > $(CONFIG_DIR)/.config.nopkg
  699. @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y \
  700. KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
  701. $< --randconfig $(CONFIG_CONFIG_IN)
  702. @rm -f $(CONFIG_DIR)/.config.nopkg
  703. @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
  704. allyespackageconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
  705. @grep -v BR2_PACKAGE_ $(BR2_CONFIG) > $(CONFIG_DIR)/.config.nopkg
  706. @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y \
  707. KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
  708. $< --allyesconfig $(CONFIG_CONFIG_IN)
  709. @rm -f $(CONFIG_DIR)/.config.nopkg
  710. @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
  711. allnopackageconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
  712. @grep -v BR2_PACKAGE_ $(BR2_CONFIG) > $(CONFIG_DIR)/.config.nopkg
  713. @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y \
  714. KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
  715. $< --allnoconfig $(CONFIG_CONFIG_IN)
  716. @rm -f $(CONFIG_DIR)/.config.nopkg
  717. @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
  718. silentoldconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
  719. $(COMMON_CONFIG_ENV) $< --silentoldconfig $(CONFIG_CONFIG_IN)
  720. olddefconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
  721. $(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN)
  722. defconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
  723. @$(COMMON_CONFIG_ENV) $< --defconfig$(if $(DEFCONFIG),=$(DEFCONFIG)) $(CONFIG_CONFIG_IN)
  724. define percent_defconfig
  725. # Override the BR2_DEFCONFIG from COMMON_CONFIG_ENV with the new defconfig
  726. %_defconfig: $(BUILD_DIR)/buildroot-config/conf $(1)/configs/%_defconfig prepare-kconfig
  727. @$$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$(1)/configs/$$@ \
  728. $$< --defconfig=$(1)/configs/$$@ $$(CONFIG_CONFIG_IN)
  729. endef
  730. $(eval $(foreach d,$(TOPDIR) $(BR2_EXTERNAL),$(call percent_defconfig,$(d))$(sep)))
  731. savedefconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
  732. @$(COMMON_CONFIG_ENV) $< \
  733. --savedefconfig=$(if $(DEFCONFIG),$(DEFCONFIG),$(CONFIG_DIR)/defconfig) \
  734. $(CONFIG_CONFIG_IN)
  735. @$(SED) '/BR2_DEFCONFIG=/d' $(if $(DEFCONFIG),$(DEFCONFIG),$(CONFIG_DIR)/defconfig)
  736. .PHONY: defconfig savedefconfig
  737. ################################################################################
  738. #
  739. # Cleanup and misc junk
  740. #
  741. ################################################################################
  742. # outputmakefile generates a Makefile in the output directory, if using a
  743. # separate output directory. This allows convenient use of make in the
  744. # output directory.
  745. outputmakefile:
  746. ifeq ($(NEED_WRAPPER),y)
  747. $(Q)$(TOPDIR)/support/scripts/mkmakefile $(TOPDIR) $(O)
  748. endif
  749. # Even though the target is a real file, we mark it as PHONY as we
  750. # want it to be re-generated each time make is invoked, in case the
  751. # value of BR2_EXTERNAL is changed.
  752. .PHONY: $(BUILD_DIR)/.br2-external.in
  753. $(BUILD_DIR)/.br2-external.in: $(BUILD_DIR)
  754. @touch $@
  755. # printvars prints all the variables currently defined in our
  756. # Makefiles. Alternatively, if a non-empty VARS variable is passed,
  757. # only the variables matching the make pattern passed in VARS are
  758. # displayed.
  759. printvars:
  760. @$(foreach V, \
  761. $(sort $(if $(VARS),$(filter $(VARS),$(.VARIABLES)),$(.VARIABLES))), \
  762. $(if $(filter-out environment% default automatic, \
  763. $(origin $V)), \
  764. $(info $V=$($V) ($(value $V)))))
  765. clean:
  766. rm -rf $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
  767. $(BUILD_DIR) $(BASE_DIR)/staging \
  768. $(LEGAL_INFO_DIR) $(GRAPHS_DIR)
  769. distclean: clean
  770. ifeq ($(O),output)
  771. rm -rf $(O)
  772. endif
  773. rm -rf $(TOPDIR)/dl $(BR2_CONFIG) $(CONFIG_DIR)/.config.old $(CONFIG_DIR)/..config.tmp \
  774. $(CONFIG_DIR)/.auto.deps $(BR2_EXTERNAL_FILE)
  775. help:
  776. @echo 'Cleaning:'
  777. @echo ' clean - delete all files created by build'
  778. @echo ' distclean - delete all non-source files (including .config)'
  779. @echo
  780. @echo 'Build:'
  781. @echo ' all - make world'
  782. @echo ' toolchain - build toolchain'
  783. @echo
  784. @echo 'Configuration:'
  785. @echo ' menuconfig - interactive curses-based configurator'
  786. @echo ' nconfig - interactive ncurses-based configurator'
  787. @echo ' xconfig - interactive Qt-based configurator'
  788. @echo ' gconfig - interactive GTK-based configurator'
  789. @echo ' oldconfig - resolve any unresolved symbols in .config'
  790. @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps'
  791. @echo ' olddefconfig - Same as silentoldconfig but sets new symbols to their default value'
  792. @echo ' randconfig - New config with random answer to all options'
  793. @echo ' defconfig - New config with default answer to all options'
  794. @echo ' BR2_DEFCONFIG, if set, is used as input'
  795. @echo ' savedefconfig - Save current config to BR2_DEFCONFIG (minimal config)'
  796. @echo ' allyesconfig - New config where all options are accepted with yes'
  797. @echo ' allnoconfig - New config where all options are answered with no'
  798. @echo ' randpackageconfig - New config with random answer to package options'
  799. @echo ' allyespackageconfig - New config where pkg options are accepted with yes'
  800. @echo ' allnopackageconfig - New config where package options are answered with no'
  801. @echo
  802. @echo 'Package-specific:'
  803. @echo ' <pkg> - Build and install <pkg> and all its dependencies'
  804. @echo ' <pkg>-source - Only download the source files for <pkg>'
  805. @echo ' <pkg>-extract - Extract <pkg> sources'
  806. @echo ' <pkg>-patch - Apply patches to <pkg>'
  807. @echo ' <pkg>-depends - Build <pkg>'\''s dependencies'
  808. @echo ' <pkg>-configure - Build <pkg> up to the configure step'
  809. @echo ' <pkg>-build - Build <pkg> up to the build step'
  810. @echo ' <pkg>-graph-depends - Generate a graph of <pkg>'\''s dependencies'
  811. @echo ' <pkg>-dirclean - Remove <pkg> build directory'
  812. @echo ' <pkg>-reconfigure - Restart the build from the configure step'
  813. @echo ' <pkg>-rebuild - Restart the build from the build step'
  814. $(foreach p,$(HELP_PACKAGES), \
  815. @echo $(sep) \
  816. @echo '$($(p)_NAME):' $(sep) \
  817. $($(p)_HELP_CMDS)$(sep))
  818. @echo
  819. @echo 'Documentation:'
  820. @echo ' manual - build manual in all formats'
  821. @echo ' manual-html - build manual in HTML'
  822. @echo ' manual-split-html - build manual in split HTML'
  823. @echo ' manual-pdf - build manual in PDF'
  824. @echo ' manual-text - build manual in text'
  825. @echo ' manual-epub - build manual in ePub'
  826. @echo ' graph-build - generate graphs of the build times'
  827. @echo ' graph-depends - generate graph of the dependency tree'
  828. @echo ' graph-size - generate stats of the filesystem size'
  829. @echo ' list-defconfigs - list all defconfigs (pre-configured minimal systems)'
  830. @echo
  831. @echo 'Miscellaneous:'
  832. @echo ' source - download all sources needed for offline-build'
  833. @echo ' source-check - check selected packages for valid download URLs'
  834. @echo ' external-deps - list external packages used'
  835. @echo ' legal-info - generate info about license compliance'
  836. @echo
  837. @echo ' make V=0|1 - 0 => quiet build (default), 1 => verbose build'
  838. @echo ' make O=dir - Locate all output files in "dir", including .config'
  839. @echo
  840. @echo 'For further details, see README, generate the Buildroot manual, or consult'
  841. @echo 'it on-line at http://buildroot.org/docs.html'
  842. @echo
  843. list-defconfigs:
  844. @echo 'Built-in configs:'
  845. @$(foreach b, $(sort $(notdir $(wildcard $(TOPDIR)/configs/*_defconfig))), \
  846. printf " %-35s - Build for %s\\n" $(b) $(b:_defconfig=);)
  847. ifneq ($(wildcard $(BR2_EXTERNAL)/configs/*_defconfig),)
  848. @echo
  849. @echo 'User-provided configs:'
  850. @$(foreach b, $(sort $(notdir $(wildcard $(BR2_EXTERNAL)/configs/*_defconfig))), \
  851. printf " %-35s - Build for %s\\n" $(b) $(b:_defconfig=);)
  852. endif
  853. @echo
  854. release: OUT = buildroot-$(BR2_VERSION)
  855. # Create release tarballs. We need to fiddle a bit to add the generated
  856. # documentation to the git output
  857. release:
  858. git archive --format=tar --prefix=$(OUT)/ HEAD > $(OUT).tar
  859. $(MAKE) O=$(OUT) manual-html manual-text manual-pdf
  860. $(MAKE) O=$(OUT) manual-clean
  861. tar rf $(OUT).tar $(OUT)
  862. gzip -9 -c < $(OUT).tar > $(OUT).tar.gz
  863. bzip2 -9 -c < $(OUT).tar > $(OUT).tar.bz2
  864. rm -rf $(OUT) $(OUT).tar
  865. print-version:
  866. @echo $(BR2_VERSION_FULL)
  867. include docs/manual/manual.mk
  868. -include $(BR2_EXTERNAL)/docs/*/*.mk
  869. .PHONY: $(noconfig_targets)
  870. endif #umask