Makefile 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009
  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_WARNINGS = $(LEGAL_INFO_DIR)/.warnings
  174. LEGAL_REPORT = $(LEGAL_INFO_DIR)/README
  175. ################################################################################
  176. #
  177. # staging and target directories do NOT list these as
  178. # dependencies anywhere else
  179. #
  180. ################################################################################
  181. $(BUILD_DIR) $(TARGET_DIR) $(HOST_DIR) $(BINARIES_DIR) $(LEGAL_INFO_DIR) $(REDIST_SOURCES_DIR_TARGET) $(REDIST_SOURCES_DIR_HOST):
  182. @mkdir -p $@
  183. BR2_CONFIG = $(CONFIG_DIR)/.config
  184. # Pull in the user's configuration file
  185. ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
  186. -include $(BR2_CONFIG)
  187. endif
  188. # timezone and locale may affect build output
  189. ifeq ($(BR2_REPRODUCIBLE),y)
  190. export TZ=UTC
  191. export LANG=C
  192. export LC_ALL=C
  193. endif
  194. # To put more focus on warnings, be less verbose as default
  195. # Use 'make V=1' to see the full commands
  196. ifeq ("$(origin V)", "command line")
  197. KBUILD_VERBOSE = $(V)
  198. endif
  199. ifndef KBUILD_VERBOSE
  200. KBUILD_VERBOSE = 0
  201. endif
  202. ifeq ($(KBUILD_VERBOSE),1)
  203. Q =
  204. ifndef VERBOSE
  205. VERBOSE = 1
  206. endif
  207. export VERBOSE
  208. else
  209. Q = @
  210. endif
  211. # kconfig uses CONFIG_SHELL
  212. CONFIG_SHELL := $(SHELL)
  213. export SHELL CONFIG_SHELL Q KBUILD_VERBOSE
  214. ifndef HOSTAR
  215. HOSTAR := ar
  216. endif
  217. ifndef HOSTAS
  218. HOSTAS := as
  219. endif
  220. ifndef HOSTCC
  221. HOSTCC := gcc
  222. HOSTCC := $(shell which $(HOSTCC) || type -p $(HOSTCC) || echo gcc)
  223. endif
  224. HOSTCC_NOCCACHE := $(HOSTCC)
  225. ifndef HOSTCXX
  226. HOSTCXX := g++
  227. HOSTCXX := $(shell which $(HOSTCXX) || type -p $(HOSTCXX) || echo g++)
  228. endif
  229. HOSTCXX_NOCCACHE := $(HOSTCXX)
  230. ifndef HOSTCPP
  231. HOSTCPP := cpp
  232. endif
  233. ifndef HOSTLD
  234. HOSTLD := ld
  235. endif
  236. ifndef HOSTLN
  237. HOSTLN := ln
  238. endif
  239. ifndef HOSTNM
  240. HOSTNM := nm
  241. endif
  242. ifndef HOSTOBJCOPY
  243. HOSTOBJCOPY := objcopy
  244. endif
  245. ifndef HOSTRANLIB
  246. HOSTRANLIB := ranlib
  247. endif
  248. HOSTAR := $(shell which $(HOSTAR) || type -p $(HOSTAR) || echo ar)
  249. HOSTAS := $(shell which $(HOSTAS) || type -p $(HOSTAS) || echo as)
  250. HOSTCPP := $(shell which $(HOSTCPP) || type -p $(HOSTCPP) || echo cpp)
  251. HOSTLD := $(shell which $(HOSTLD) || type -p $(HOSTLD) || echo ld)
  252. HOSTLN := $(shell which $(HOSTLN) || type -p $(HOSTLN) || echo ln)
  253. HOSTNM := $(shell which $(HOSTNM) || type -p $(HOSTNM) || echo nm)
  254. HOSTOBJCOPY := $(shell which $(HOSTOBJCOPY) || type -p $(HOSTOBJCOPY) || echo objcopy)
  255. HOSTRANLIB := $(shell which $(HOSTRANLIB) || type -p $(HOSTRANLIB) || echo ranlib)
  256. export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTLD
  257. export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE
  258. # Determine the userland we are running on.
  259. #
  260. # Note that, despite its name, we are not interested in the actual
  261. # architecture name. This is mostly used to determine whether some
  262. # of the binary tools (e.g. pre-built external toolchains) can run
  263. # on the current host. So we need to know if the userland we're
  264. # running on can actually run those toolchains.
  265. #
  266. # For example, a 64-bit prebuilt toolchain will not run on a 64-bit
  267. # kernel if the userland is 32-bit (e.g. in a chroot for example).
  268. #
  269. # So, we extract the first part of the tuple the host gcc was
  270. # configured to generate code for; we assume this is our userland.
  271. #
  272. export HOSTARCH := $(shell LC_ALL=C $(HOSTCC_NOCCACHE) -v 2>&1 | \
  273. sed -e '/^Target: \([^-]*\).*/!d' \
  274. -e 's//\1/' \
  275. -e 's/i.86/x86/' \
  276. -e 's/sun4u/sparc64/' \
  277. -e 's/arm.*/arm/' \
  278. -e 's/sa110/arm/' \
  279. -e 's/ppc64/powerpc64/' \
  280. -e 's/ppc/powerpc/' \
  281. -e 's/macppc/powerpc/' \
  282. -e 's/sh.*/sh/' )
  283. HOSTCC_VERSION := $(shell $(HOSTCC_NOCCACHE) --version | \
  284. sed -n -r 's/^.* ([0-9]*)\.([0-9]*)\.([0-9]*)[ ]*.*/\1 \2/p')
  285. # For gcc >= 5.x, we only need the major version.
  286. ifneq ($(firstword $(HOSTCC_VERSION)),4)
  287. HOSTCC_VERSION := $(firstword $(HOSTCC_VERSION))
  288. endif
  289. # Make sure pkg-config doesn't look outside the buildroot tree
  290. HOST_PKG_CONFIG_PATH := $(PKG_CONFIG_PATH)
  291. unexport PKG_CONFIG_PATH
  292. unexport PKG_CONFIG_SYSROOT_DIR
  293. unexport PKG_CONFIG_LIBDIR
  294. # Having DESTDIR set in the environment confuses the installation
  295. # steps of some packages.
  296. unexport DESTDIR
  297. # Causes breakage with packages that needs host-ruby
  298. unexport RUBYOPT
  299. include package/pkg-utils.mk
  300. include package/doc-asciidoc.mk
  301. ifeq ($(BR2_HAVE_DOT_CONFIG),y)
  302. ################################################################################
  303. #
  304. # Hide troublesome environment variables from sub processes
  305. #
  306. ################################################################################
  307. unexport CROSS_COMPILE
  308. unexport ARCH
  309. unexport CC
  310. unexport LD
  311. unexport AR
  312. unexport CXX
  313. unexport CPP
  314. unexport RANLIB
  315. unexport CFLAGS
  316. unexport CXXFLAGS
  317. unexport GREP_OPTIONS
  318. unexport TAR_OPTIONS
  319. unexport CONFIG_SITE
  320. unexport QMAKESPEC
  321. unexport TERMINFO
  322. unexport MACHINE
  323. unexport O
  324. GNU_HOST_NAME := $(shell support/gnuconfig/config.guess)
  325. PACKAGES :=
  326. PACKAGES_ALL :=
  327. # silent mode requested?
  328. QUIET := $(if $(findstring s,$(filter-out --%,$(MAKEFLAGS))),-q)
  329. # Strip off the annoying quoting
  330. ARCH := $(call qstrip,$(BR2_ARCH))
  331. KERNEL_ARCH := $(shell echo "$(ARCH)" | sed -e "s/-.*//" \
  332. -e s/i.86/i386/ -e s/sun4u/sparc64/ \
  333. -e s/arcle/arc/ \
  334. -e s/arceb/arc/ \
  335. -e s/arm.*/arm/ -e s/sa110/arm/ \
  336. -e s/aarch64.*/arm64/ \
  337. -e s/bfin/blackfin/ \
  338. -e s/parisc64/parisc/ \
  339. -e s/powerpc64.*/powerpc/ \
  340. -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
  341. -e s/sh.*/sh/ \
  342. -e s/microblazeel/microblaze/)
  343. ZCAT := $(call qstrip,$(BR2_ZCAT))
  344. BZCAT := $(call qstrip,$(BR2_BZCAT))
  345. XZCAT := $(call qstrip,$(BR2_XZCAT))
  346. TAR_OPTIONS = $(call qstrip,$(BR2_TAR_OPTIONS)) -xf
  347. # packages compiled for the host go here
  348. HOST_DIR := $(call qstrip,$(BR2_HOST_DIR))
  349. # Quotes are needed for spaces and all in the original PATH content.
  350. BR_PATH = "$(HOST_DIR)/bin:$(HOST_DIR)/sbin:$(HOST_DIR)/usr/bin:$(HOST_DIR)/usr/sbin:$(PATH)"
  351. # Location of a file giving a big fat warning that output/target
  352. # should not be used as the root filesystem.
  353. TARGET_DIR_WARNING_FILE = $(TARGET_DIR)/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
  354. ifeq ($(BR2_CCACHE),y)
  355. CCACHE := $(HOST_DIR)/usr/bin/ccache
  356. BR_CACHE_DIR ?= $(call qstrip,$(BR2_CCACHE_DIR))
  357. export BR_CACHE_DIR
  358. HOSTCC := $(CCACHE) $(HOSTCC)
  359. HOSTCXX := $(CCACHE) $(HOSTCXX)
  360. else
  361. export BR_NO_CCACHE
  362. endif
  363. # Scripts in support/ or post-build scripts may need to reference
  364. # these locations, so export them so it is easier to use
  365. export BR2_CONFIG
  366. export BR2_REPRODUCIBLE
  367. export TARGET_DIR
  368. export STAGING_DIR
  369. export HOST_DIR
  370. export BINARIES_DIR
  371. export BASE_DIR
  372. ################################################################################
  373. #
  374. # You should probably leave this stuff alone unless you know
  375. # what you are doing.
  376. #
  377. ################################################################################
  378. all: world
  379. # Include legacy before the other things, because package .mk files
  380. # may rely on it.
  381. include Makefile.legacy
  382. include package/Makefile.in
  383. include support/dependencies/dependencies.mk
  384. include toolchain/*.mk
  385. include toolchain/*/*.mk
  386. # Include the package override file if one has been provided in the
  387. # configuration.
  388. PACKAGE_OVERRIDE_FILE = $(call qstrip,$(BR2_PACKAGE_OVERRIDE_FILE))
  389. ifneq ($(PACKAGE_OVERRIDE_FILE),)
  390. -include $(PACKAGE_OVERRIDE_FILE)
  391. endif
  392. include $(sort $(wildcard package/*/*.mk))
  393. include boot/common.mk
  394. include linux/linux.mk
  395. include fs/common.mk
  396. include $(BR2_EXTERNAL)/external.mk
  397. # Now we are sure we have all the packages scanned and defined. We now
  398. # check for each package in the list of enabled packages, that all its
  399. # dependencies are indeed enabled.
  400. #
  401. # Only trigger the check for default builds. If the user forces building
  402. # a package, even if not enabled in the configuration, we want to accept
  403. # it.
  404. #
  405. ifeq ($(MAKECMDGOALS),)
  406. define CHECK_ONE_DEPENDENCY
  407. ifeq ($$($(2)_TYPE),target)
  408. ifeq ($$($(2)_IS_VIRTUAL),)
  409. ifneq ($$($$($(2)_KCONFIG_VAR)),y)
  410. $$(error $$($(2)_NAME) is in the dependency chain of $$($(1)_NAME) that \
  411. has added it to its _DEPENDENCIES variable without selecting it or \
  412. depending on it from Config.in)
  413. endif
  414. endif
  415. endif
  416. endef
  417. $(foreach pkg,$(call UPPERCASE,$(PACKAGES)),\
  418. $(foreach dep,$(call UPPERCASE,$($(pkg)_FINAL_ALL_DEPENDENCIES)),\
  419. $(eval $(call CHECK_ONE_DEPENDENCY,$(pkg),$(dep))$(sep))))
  420. endif
  421. dirs: $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
  422. $(HOST_DIR) $(BINARIES_DIR)
  423. $(BUILD_DIR)/buildroot-config/auto.conf: $(BR2_CONFIG)
  424. $(MAKE1) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig
  425. prepare: $(BUILD_DIR)/buildroot-config/auto.conf
  426. world: target-post-image
  427. .PHONY: all world toolchain dirs clean distclean source outputmakefile \
  428. legal-info legal-info-prepare legal-info-clean printvars help \
  429. list-defconfigs target-finalize target-post-image source-check
  430. # Populating the staging with the base directories is handled by the skeleton package
  431. $(STAGING_DIR):
  432. @mkdir -p $(STAGING_DIR)
  433. @ln -snf $(STAGING_DIR) $(BASE_DIR)/staging
  434. RSYNC_VCS_EXCLUSIONS = \
  435. --exclude .svn --exclude .git --exclude .hg --exclude .bzr \
  436. --exclude CVS
  437. STRIP_FIND_CMD = find $(TARGET_DIR)
  438. ifneq (,$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS)))
  439. STRIP_FIND_CMD += \( $(call finddirclauses,$(TARGET_DIR),$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS))) \) -prune -o
  440. endif
  441. STRIP_FIND_CMD += -type f \( -perm /111 -o -name '*.so*' \)
  442. # file exclusions:
  443. # - libpthread.so: a non-stripped libpthread shared library is needed for
  444. # proper debugging of pthread programs using gdb.
  445. # - ld.so: a non-stripped dynamic linker library is needed for valgrind
  446. # - kernel modules (*.ko): do not function properly when stripped like normal
  447. # applications and libraries. Normally kernel modules are already excluded
  448. # by the executable permission check above, so the explicit exclusion is only
  449. # done for kernel modules with incorrect permissions.
  450. STRIP_FIND_CMD += -not \( $(call findfileclauses,libpthread*.so* ld-*.so* *.ko $(call qstrip,$(BR2_STRIP_EXCLUDE_FILES))) \) -print0
  451. ifeq ($(BR2_ECLIPSE_REGISTER),y)
  452. define TOOLCHAIN_ECLIPSE_REGISTER
  453. ./support/scripts/eclipse-register-toolchain `readlink -f $(O)` \
  454. $(notdir $(TARGET_CROSS)) $(BR2_ARCH)
  455. endef
  456. TARGET_FINALIZE_HOOKS += TOOLCHAIN_ECLIPSE_REGISTER
  457. endif
  458. # Generate locale data. Basically, we call the localedef program
  459. # (built by the host-localedef package) for each locale. The input
  460. # data comes preferably from the toolchain, or if the toolchain does
  461. # not have them (Linaro toolchains), we use the ones available on the
  462. # host machine.
  463. ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),y)
  464. GLIBC_GENERATE_LOCALES = $(call qstrip,$(BR2_GENERATE_LOCALE))
  465. ifneq ($(GLIBC_GENERATE_LOCALES),)
  466. PACKAGES += host-localedef
  467. define GENERATE_GLIBC_LOCALES
  468. $(Q)mkdir -p $(TARGET_DIR)/usr/lib/locale/
  469. $(Q)for locale in $(GLIBC_GENERATE_LOCALES) ; do \
  470. inputfile=`echo $${locale} | cut -f1 -d'.'` ; \
  471. charmap=`echo $${locale} | cut -f2 -d'.' -s` ; \
  472. if test -z "$${charmap}" ; then \
  473. charmap="UTF-8" ; \
  474. fi ; \
  475. echo "Generating locale $${inputfile}.$${charmap}" ; \
  476. I18NPATH=$(STAGING_DIR)/usr/share/i18n:/usr/share/i18n \
  477. $(HOST_DIR)/usr/bin/localedef \
  478. --prefix=$(TARGET_DIR) \
  479. --$(call LOWERCASE,$(BR2_ENDIAN))-endian \
  480. -i $${inputfile} -f $${charmap} \
  481. $${locale} ; \
  482. done
  483. endef
  484. TARGET_FINALIZE_HOOKS += GENERATE_GLIBC_LOCALES
  485. endif
  486. endif
  487. ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
  488. LOCALE_WHITELIST = $(BUILD_DIR)/locales.nopurge
  489. LOCALE_NOPURGE = $(call qstrip,$(BR2_ENABLE_LOCALE_WHITELIST))
  490. # This piece of junk does the following:
  491. # First collect the whitelist in a file.
  492. # Then go over all the locale dirs and for each subdir, check if it exists
  493. # in the whitelist file. If it doesn't, kill it.
  494. # Finally, specifically for X11, regenerate locale.dir from the whitelist.
  495. define PURGE_LOCALES
  496. rm -f $(LOCALE_WHITELIST)
  497. for i in $(LOCALE_NOPURGE) locale-archive; do echo $$i >> $(LOCALE_WHITELIST); done
  498. for dir in $(wildcard $(addprefix $(TARGET_DIR),/usr/share/locale /usr/share/X11/locale /usr/lib/locale)); \
  499. do \
  500. for langdir in $$dir/*; \
  501. do \
  502. if [ -e "$${langdir}" ]; \
  503. then \
  504. grep -qx "$${langdir##*/}" $(LOCALE_WHITELIST) || rm -rf $$langdir; \
  505. fi \
  506. done; \
  507. done
  508. if [ -d $(TARGET_DIR)/usr/share/X11/locale ]; \
  509. then \
  510. for lang in $(LOCALE_NOPURGE); \
  511. do \
  512. if [ -f $(TARGET_DIR)/usr/share/X11/locale/$$lang/XLC_LOCALE ]; \
  513. then \
  514. echo "$$lang/XLC_LOCALE: $$lang"; \
  515. fi \
  516. done > $(TARGET_DIR)/usr/share/X11/locale/locale.dir; \
  517. fi
  518. endef
  519. TARGET_FINALIZE_HOOKS += PURGE_LOCALES
  520. endif
  521. $(TARGETS_ROOTFS): target-finalize
  522. target-finalize: $(PACKAGES)
  523. @$(call MESSAGE,"Finalizing target directory")
  524. $(foreach hook,$(TARGET_FINALIZE_HOOKS),$($(hook))$(sep))
  525. rm -rf $(TARGET_DIR)/usr/include $(TARGET_DIR)/usr/share/aclocal \
  526. $(TARGET_DIR)/usr/lib/pkgconfig $(TARGET_DIR)/usr/share/pkgconfig \
  527. $(TARGET_DIR)/usr/lib/cmake $(TARGET_DIR)/usr/share/cmake
  528. find $(TARGET_DIR)/usr/{lib,share}/ -name '*.cmake' -print0 | xargs -0 rm -f
  529. find $(TARGET_DIR)/lib $(TARGET_DIR)/usr/lib $(TARGET_DIR)/usr/libexec \
  530. \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
  531. ifneq ($(BR2_PACKAGE_GDB),y)
  532. rm -rf $(TARGET_DIR)/usr/share/gdb
  533. endif
  534. ifneq ($(BR2_PACKAGE_BASH),y)
  535. rm -rf $(TARGET_DIR)/usr/share/bash-completion
  536. endif
  537. ifneq ($(BR2_PACKAGE_ZSH),y)
  538. rm -rf $(TARGET_DIR)/usr/share/zsh
  539. endif
  540. rm -rf $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/man
  541. rm -rf $(TARGET_DIR)/usr/info $(TARGET_DIR)/usr/share/info
  542. rm -rf $(TARGET_DIR)/usr/doc $(TARGET_DIR)/usr/share/doc
  543. rm -rf $(TARGET_DIR)/usr/share/gtk-doc
  544. -rmdir $(TARGET_DIR)/usr/share 2>/dev/null
  545. $(STRIP_FIND_CMD) | xargs -0 $(STRIPCMD) 2>/dev/null || true
  546. # See http://sourceware.org/gdb/wiki/FAQ, "GDB does not see any threads
  547. # besides the one in which crash occurred; or SIGTRAP kills my program when
  548. # I set a breakpoint"
  549. ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
  550. find $(TARGET_DIR)/lib -type f -name 'libpthread*.so*' | \
  551. xargs -r $(STRIPCMD) $(STRIP_STRIP_DEBUG)
  552. endif
  553. # Valgrind needs ld.so with enough information, so only strip
  554. # debugging symbols.
  555. find $(TARGET_DIR)/lib -type f -name 'ld-*.so*' | \
  556. xargs -r $(STRIPCMD) $(STRIP_STRIP_DEBUG)
  557. test -f $(TARGET_DIR)/etc/ld.so.conf && \
  558. { echo "ERROR: we shouldn't have a /etc/ld.so.conf file"; exit 1; } || true
  559. test -d $(TARGET_DIR)/etc/ld.so.conf.d && \
  560. { echo "ERROR: we shouldn't have a /etc/ld.so.conf.d directory"; exit 1; } || true
  561. mkdir -p $(TARGET_DIR)/etc
  562. ( \
  563. echo "NAME=Buildroot"; \
  564. echo "VERSION=$(BR2_VERSION_FULL)"; \
  565. echo "ID=buildroot"; \
  566. echo "VERSION_ID=$(BR2_VERSION)"; \
  567. echo "PRETTY_NAME=\"Buildroot $(BR2_VERSION)\"" \
  568. ) > $(TARGET_DIR)/etc/os-release
  569. @$(foreach d, $(call qstrip,$(BR2_ROOTFS_OVERLAY)), \
  570. $(call MESSAGE,"Copying overlay $(d)"); \
  571. rsync -a --ignore-times --keep-dirlinks $(RSYNC_VCS_EXCLUSIONS) \
  572. --chmod=u=rwX,go=rX --exclude .empty --exclude '*~' \
  573. $(d)/ $(TARGET_DIR)$(sep))
  574. @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_BUILD_SCRIPT)), \
  575. $(call MESSAGE,"Executing post-build script $(s)"); \
  576. $(EXTRA_ENV) $(s) $(TARGET_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
  577. target-post-image: $(TARGETS_ROOTFS) target-finalize
  578. @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_IMAGE_SCRIPT)), \
  579. $(call MESSAGE,"Executing post-image script $(s)"); \
  580. $(EXTRA_ENV) $(s) $(BINARIES_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
  581. source: $(foreach p,$(PACKAGES),$(p)-all-source)
  582. _external-deps: $(foreach p,$(PACKAGES),$(p)-all-external-deps)
  583. external-deps:
  584. @$(MAKE1) -Bs $(EXTRAMAKEARGS) _external-deps | sort -u
  585. # check if download URLs are outdated
  586. source-check: $(foreach p,$(PACKAGES),$(p)-all-source-check)
  587. legal-info-clean:
  588. @rm -fr $(LEGAL_INFO_DIR)
  589. legal-info-prepare: $(LEGAL_INFO_DIR)
  590. @$(call MESSAGE,"Collecting legal info")
  591. @$(call legal-license-file,buildroot,COPYING,COPYING,HOST)
  592. @$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE,SOURCE SITE,TARGET)
  593. @$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE,SOURCE SITE,HOST)
  594. @$(call legal-manifest,buildroot,$(BR2_VERSION_FULL),GPLv2+,COPYING,not saved,not saved,HOST)
  595. @$(call legal-warning,the Buildroot source code has not been saved)
  596. @cp $(BR2_CONFIG) $(LEGAL_INFO_DIR)/buildroot.config
  597. legal-info: dirs legal-info-clean legal-info-prepare $(foreach p,$(PACKAGES),$(p)-all-legal-info) \
  598. $(REDIST_SOURCES_DIR_TARGET) $(REDIST_SOURCES_DIR_HOST)
  599. @cat support/legal-info/README.header >>$(LEGAL_REPORT)
  600. @if [ -r $(LEGAL_WARNINGS) ]; then \
  601. cat support/legal-info/README.warnings-header \
  602. $(LEGAL_WARNINGS) >>$(LEGAL_REPORT); \
  603. cat $(LEGAL_WARNINGS); fi
  604. @rm -f $(LEGAL_WARNINGS)
  605. @(cd $(LEGAL_INFO_DIR); \
  606. find * -type f -exec sha256sum {} + | LC_ALL=C sort -k2 \
  607. >.legal-info.sha256; \
  608. mv .legal-info.sha256 legal-info.sha256)
  609. @echo "Legal info produced in $(LEGAL_INFO_DIR)"
  610. show-targets:
  611. @echo $(PACKAGES) $(TARGETS_ROOTFS)
  612. graph-build: $(O)/build/build-time.log
  613. @install -d $(GRAPHS_DIR)
  614. $(foreach o,name build duration,./support/scripts/graph-build-time \
  615. --type=histogram --order=$(o) --input=$(<) \
  616. --output=$(GRAPHS_DIR)/build.hist-$(o).$(BR_GRAPH_OUT) \
  617. $(if $(BR2_GRAPH_ALT),--alternate-colors)$(sep))
  618. $(foreach t,packages steps,./support/scripts/graph-build-time \
  619. --type=pie-$(t) --input=$(<) \
  620. --output=$(GRAPHS_DIR)/build.pie-$(t).$(BR_GRAPH_OUT) \
  621. $(if $(BR2_GRAPH_ALT),--alternate-colors)$(sep))
  622. graph-depends-requirements:
  623. @dot -? >/dev/null 2>&1 || \
  624. { echo "ERROR: The 'dot' program from Graphviz is needed for graph-depends" >&2; exit 1; }
  625. graph-depends: graph-depends-requirements
  626. @$(INSTALL) -d $(GRAPHS_DIR)
  627. @cd "$(CONFIG_DIR)"; \
  628. $(TOPDIR)/support/scripts/graph-depends $(BR2_GRAPH_DEPS_OPTS) \
  629. -o $(GRAPHS_DIR)/$(@).dot
  630. dot $(BR2_GRAPH_DOT_OPTS) -T$(BR_GRAPH_OUT) \
  631. -o $(GRAPHS_DIR)/$(@).$(BR_GRAPH_OUT) \
  632. $(GRAPHS_DIR)/$(@).dot
  633. graph-size:
  634. $(Q)mkdir -p $(GRAPHS_DIR)
  635. $(Q)$(TOPDIR)/support/scripts/size-stats --builddir $(BASE_DIR) \
  636. --graph $(GRAPHS_DIR)/graph-size.$(BR_GRAPH_OUT) \
  637. --file-size-csv $(GRAPHS_DIR)/file-size-stats.csv \
  638. --package-size-csv $(GRAPHS_DIR)/package-size-stats.csv
  639. check-dependencies:
  640. @cd "$(CONFIG_DIR)"; \
  641. $(TOPDIR)/support/scripts/graph-depends -C
  642. else # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
  643. all: menuconfig
  644. endif # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
  645. # configuration
  646. # ---------------------------------------------------------------------------
  647. HOSTCFLAGS = $(CFLAGS_FOR_BUILD)
  648. export HOSTCFLAGS
  649. .PHONY: prepare-kconfig
  650. prepare-kconfig: outputmakefile $(BUILD_DIR)/.br2-external.in
  651. $(BUILD_DIR)/buildroot-config/%onf:
  652. mkdir -p $(@D)/lxdialog
  653. PKG_CONFIG_PATH="$(HOST_PKG_CONFIG_PATH)" $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" \
  654. obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)
  655. DEFCONFIG = $(call qstrip,$(BR2_DEFCONFIG))
  656. # We don't want to fully expand BR2_DEFCONFIG here, so Kconfig will
  657. # recognize that if it's still at its default $(CONFIG_DIR)/defconfig
  658. COMMON_CONFIG_ENV = \
  659. BR2_DEFCONFIG='$(call qstrip,$(value BR2_DEFCONFIG))' \
  660. KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
  661. KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
  662. KCONFIG_TRISTATE=$(BUILD_DIR)/buildroot-config/tristate.config \
  663. BR2_CONFIG=$(BR2_CONFIG) \
  664. BR2_EXTERNAL=$(BR2_EXTERNAL) \
  665. HOST_GCC_VERSION="$(HOSTCC_VERSION)" \
  666. BUILD_DIR=$(BUILD_DIR) \
  667. SKIP_LEGACY=
  668. xconfig: $(BUILD_DIR)/buildroot-config/qconf prepare-kconfig
  669. @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
  670. gconfig: $(BUILD_DIR)/buildroot-config/gconf prepare-kconfig
  671. @$(COMMON_CONFIG_ENV) srctree=$(TOPDIR) $< $(CONFIG_CONFIG_IN)
  672. menuconfig: $(BUILD_DIR)/buildroot-config/mconf prepare-kconfig
  673. @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
  674. nconfig: $(BUILD_DIR)/buildroot-config/nconf prepare-kconfig
  675. @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
  676. config: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
  677. @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
  678. # For the config targets that automatically select options, we pass
  679. # SKIP_LEGACY=y to disable the legacy options. However, in that case
  680. # no values are set for the legacy options so a subsequent oldconfig
  681. # will query them. Therefore, run an additional olddefconfig.
  682. oldconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
  683. @$(COMMON_CONFIG_ENV) $< --oldconfig $(CONFIG_CONFIG_IN)
  684. randconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
  685. @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y $< --randconfig $(CONFIG_CONFIG_IN)
  686. @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
  687. allyesconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
  688. @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y $< --allyesconfig $(CONFIG_CONFIG_IN)
  689. @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
  690. allnoconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
  691. @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y $< --allnoconfig $(CONFIG_CONFIG_IN)
  692. @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
  693. randpackageconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
  694. @grep -v BR2_PACKAGE_ $(BR2_CONFIG) > $(CONFIG_DIR)/.config.nopkg
  695. @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y \
  696. KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
  697. $< --randconfig $(CONFIG_CONFIG_IN)
  698. @rm -f $(CONFIG_DIR)/.config.nopkg
  699. @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
  700. allyespackageconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
  701. @grep -v BR2_PACKAGE_ $(BR2_CONFIG) > $(CONFIG_DIR)/.config.nopkg
  702. @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y \
  703. KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
  704. $< --allyesconfig $(CONFIG_CONFIG_IN)
  705. @rm -f $(CONFIG_DIR)/.config.nopkg
  706. @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
  707. allnopackageconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
  708. @grep -v BR2_PACKAGE_ $(BR2_CONFIG) > $(CONFIG_DIR)/.config.nopkg
  709. @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y \
  710. KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
  711. $< --allnoconfig $(CONFIG_CONFIG_IN)
  712. @rm -f $(CONFIG_DIR)/.config.nopkg
  713. @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
  714. silentoldconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
  715. $(COMMON_CONFIG_ENV) $< --silentoldconfig $(CONFIG_CONFIG_IN)
  716. olddefconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
  717. $(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN)
  718. defconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
  719. @$(COMMON_CONFIG_ENV) $< --defconfig$(if $(DEFCONFIG),=$(DEFCONFIG)) $(CONFIG_CONFIG_IN)
  720. define percent_defconfig
  721. # Override the BR2_DEFCONFIG from COMMON_CONFIG_ENV with the new defconfig
  722. %_defconfig: $(BUILD_DIR)/buildroot-config/conf $(1)/configs/%_defconfig prepare-kconfig
  723. @$$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$(1)/configs/$$@ \
  724. $$< --defconfig=$(1)/configs/$$@ $$(CONFIG_CONFIG_IN)
  725. endef
  726. $(eval $(foreach d,$(TOPDIR) $(BR2_EXTERNAL),$(call percent_defconfig,$(d))$(sep)))
  727. savedefconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
  728. @$(COMMON_CONFIG_ENV) $< \
  729. --savedefconfig=$(if $(DEFCONFIG),$(DEFCONFIG),$(CONFIG_DIR)/defconfig) \
  730. $(CONFIG_CONFIG_IN)
  731. @$(SED) '/BR2_DEFCONFIG=/d' $(if $(DEFCONFIG),$(DEFCONFIG),$(CONFIG_DIR)/defconfig)
  732. .PHONY: defconfig savedefconfig
  733. ################################################################################
  734. #
  735. # Cleanup and misc junk
  736. #
  737. ################################################################################
  738. # outputmakefile generates a Makefile in the output directory, if using a
  739. # separate output directory. This allows convenient use of make in the
  740. # output directory.
  741. outputmakefile:
  742. ifeq ($(NEED_WRAPPER),y)
  743. $(Q)$(TOPDIR)/support/scripts/mkmakefile $(TOPDIR) $(O)
  744. endif
  745. # Even though the target is a real file, we mark it as PHONY as we
  746. # want it to be re-generated each time make is invoked, in case the
  747. # value of BR2_EXTERNAL is changed.
  748. .PHONY: $(BUILD_DIR)/.br2-external.in
  749. $(BUILD_DIR)/.br2-external.in: $(BUILD_DIR)
  750. @touch $@
  751. # printvars prints all the variables currently defined in our
  752. # Makefiles. Alternatively, if a non-empty VARS variable is passed,
  753. # only the variables matching the make pattern passed in VARS are
  754. # displayed.
  755. printvars:
  756. @$(foreach V, \
  757. $(sort $(if $(VARS),$(filter $(VARS),$(.VARIABLES)),$(.VARIABLES))), \
  758. $(if $(filter-out environment% default automatic, \
  759. $(origin $V)), \
  760. $(info $V=$($V) ($(value $V)))))
  761. clean:
  762. rm -rf $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
  763. $(BUILD_DIR) $(BASE_DIR)/staging \
  764. $(LEGAL_INFO_DIR) $(GRAPHS_DIR)
  765. distclean: clean
  766. ifeq ($(O),output)
  767. rm -rf $(O)
  768. endif
  769. rm -rf $(TOPDIR)/dl $(BR2_CONFIG) $(CONFIG_DIR)/.config.old $(CONFIG_DIR)/..config.tmp \
  770. $(CONFIG_DIR)/.auto.deps $(BR2_EXTERNAL_FILE)
  771. help:
  772. @echo 'Cleaning:'
  773. @echo ' clean - delete all files created by build'
  774. @echo ' distclean - delete all non-source files (including .config)'
  775. @echo
  776. @echo 'Build:'
  777. @echo ' all - make world'
  778. @echo ' toolchain - build toolchain'
  779. @echo
  780. @echo 'Configuration:'
  781. @echo ' menuconfig - interactive curses-based configurator'
  782. @echo ' nconfig - interactive ncurses-based configurator'
  783. @echo ' xconfig - interactive Qt-based configurator'
  784. @echo ' gconfig - interactive GTK-based configurator'
  785. @echo ' oldconfig - resolve any unresolved symbols in .config'
  786. @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps'
  787. @echo ' olddefconfig - Same as silentoldconfig but sets new symbols to their default value'
  788. @echo ' randconfig - New config with random answer to all options'
  789. @echo ' defconfig - New config with default answer to all options'
  790. @echo ' BR2_DEFCONFIG, if set, is used as input'
  791. @echo ' savedefconfig - Save current config to BR2_DEFCONFIG (minimal config)'
  792. @echo ' allyesconfig - New config where all options are accepted with yes'
  793. @echo ' allnoconfig - New config where all options are answered with no'
  794. @echo ' randpackageconfig - New config with random answer to package options'
  795. @echo ' allyespackageconfig - New config where pkg options are accepted with yes'
  796. @echo ' allnopackageconfig - New config where package options are answered with no'
  797. @echo
  798. @echo 'Package-specific:'
  799. @echo ' <pkg> - Build and install <pkg> and all its dependencies'
  800. @echo ' <pkg>-source - Only download the source files for <pkg>'
  801. @echo ' <pkg>-extract - Extract <pkg> sources'
  802. @echo ' <pkg>-patch - Apply patches to <pkg>'
  803. @echo ' <pkg>-depends - Build <pkg>'\''s dependencies'
  804. @echo ' <pkg>-configure - Build <pkg> up to the configure step'
  805. @echo ' <pkg>-build - Build <pkg> up to the build step'
  806. @echo ' <pkg>-graph-depends - Generate a graph of <pkg>'\''s dependencies'
  807. @echo ' <pkg>-dirclean - Remove <pkg> build directory'
  808. @echo ' <pkg>-reconfigure - Restart the build from the configure step'
  809. @echo ' <pkg>-rebuild - Restart the build from the build step'
  810. $(foreach p,$(HELP_PACKAGES), \
  811. @echo $(sep) \
  812. @echo '$($(p)_NAME):' $(sep) \
  813. $($(p)_HELP_CMDS)$(sep))
  814. @echo
  815. @echo 'Documentation:'
  816. @echo ' manual - build manual in all formats'
  817. @echo ' manual-html - build manual in HTML'
  818. @echo ' manual-split-html - build manual in split HTML'
  819. @echo ' manual-pdf - build manual in PDF'
  820. @echo ' manual-text - build manual in text'
  821. @echo ' manual-epub - build manual in ePub'
  822. @echo ' graph-build - generate graphs of the build times'
  823. @echo ' graph-depends - generate graph of the dependency tree'
  824. @echo ' graph-size - generate stats of the filesystem size'
  825. @echo ' list-defconfigs - list all defconfigs (pre-configured minimal systems)'
  826. @echo
  827. @echo 'Miscellaneous:'
  828. @echo ' source - download all sources needed for offline-build'
  829. @echo ' source-check - check selected packages for valid download URLs'
  830. @echo ' external-deps - list external packages used'
  831. @echo ' legal-info - generate info about license compliance'
  832. @echo
  833. @echo ' make V=0|1 - 0 => quiet build (default), 1 => verbose build'
  834. @echo ' make O=dir - Locate all output files in "dir", including .config'
  835. @echo
  836. @echo 'For further details, see README, generate the Buildroot manual, or consult'
  837. @echo 'it on-line at http://buildroot.org/docs.html'
  838. @echo
  839. list-defconfigs:
  840. @echo 'Built-in configs:'
  841. @$(foreach b, $(sort $(notdir $(wildcard $(TOPDIR)/configs/*_defconfig))), \
  842. printf " %-35s - Build for %s\\n" $(b) $(b:_defconfig=);)
  843. ifneq ($(wildcard $(BR2_EXTERNAL)/configs/*_defconfig),)
  844. @echo
  845. @echo 'User-provided configs:'
  846. @$(foreach b, $(sort $(notdir $(wildcard $(BR2_EXTERNAL)/configs/*_defconfig))), \
  847. printf " %-35s - Build for %s\\n" $(b) $(b:_defconfig=);)
  848. endif
  849. @echo
  850. release: OUT = buildroot-$(BR2_VERSION)
  851. # Create release tarballs. We need to fiddle a bit to add the generated
  852. # documentation to the git output
  853. release:
  854. git archive --format=tar --prefix=$(OUT)/ HEAD > $(OUT).tar
  855. $(MAKE) O=$(OUT) manual-html manual-text manual-pdf
  856. $(MAKE) O=$(OUT) manual-clean
  857. tar rf $(OUT).tar $(OUT)
  858. gzip -9 -c < $(OUT).tar > $(OUT).tar.gz
  859. bzip2 -9 -c < $(OUT).tar > $(OUT).tar.bz2
  860. rm -rf $(OUT) $(OUT).tar
  861. print-version:
  862. @echo $(BR2_VERSION_FULL)
  863. include docs/manual/manual.mk
  864. -include $(BR2_EXTERNAL)/docs/*/*.mk
  865. .PHONY: $(noconfig_targets)
  866. endif #umask