Makefile 37 KB

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