Makefile 37 KB

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