Makefile 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004
  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-2015 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.02-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 := $(shell pwd)
  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
  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 CXX
  304. unexport CPP
  305. unexport RANLIB
  306. unexport CFLAGS
  307. unexport CXXFLAGS
  308. unexport GREP_OPTIONS
  309. unexport TAR_OPTIONS
  310. unexport CONFIG_SITE
  311. unexport QMAKESPEC
  312. unexport TERMINFO
  313. unexport MACHINE
  314. unexport O
  315. GNU_HOST_NAME := $(shell support/gnuconfig/config.guess)
  316. PACKAGES :=
  317. PACKAGES_ALL :=
  318. # silent mode requested?
  319. QUIET := $(if $(findstring s,$(filter-out --%,$(MAKEFLAGS))),-q)
  320. # Strip off the annoying quoting
  321. ARCH := $(call qstrip,$(BR2_ARCH))
  322. KERNEL_ARCH := $(shell echo "$(ARCH)" | sed -e "s/-.*//" \
  323. -e s/i.86/i386/ -e s/sun4u/sparc64/ \
  324. -e s/arcle/arc/ \
  325. -e s/arceb/arc/ \
  326. -e s/arm.*/arm/ -e s/sa110/arm/ \
  327. -e s/aarch64.*/arm64/ \
  328. -e s/bfin/blackfin/ \
  329. -e s/parisc64/parisc/ \
  330. -e s/powerpc64.*/powerpc/ \
  331. -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
  332. -e s/sh.*/sh/ \
  333. -e s/microblazeel/microblaze/)
  334. ZCAT := $(call qstrip,$(BR2_ZCAT))
  335. BZCAT := $(call qstrip,$(BR2_BZCAT))
  336. XZCAT := $(call qstrip,$(BR2_XZCAT))
  337. TAR_OPTIONS = $(call qstrip,$(BR2_TAR_OPTIONS)) -xf
  338. # packages compiled for the host go here
  339. HOST_DIR := $(call qstrip,$(BR2_HOST_DIR))
  340. # Quotes are needed for spaces and all in the original PATH content.
  341. BR_PATH = "$(HOST_DIR)/bin:$(HOST_DIR)/sbin:$(HOST_DIR)/usr/bin:$(HOST_DIR)/usr/sbin:$(PATH)"
  342. # Location of a file giving a big fat warning that output/target
  343. # should not be used as the root filesystem.
  344. TARGET_DIR_WARNING_FILE = $(TARGET_DIR)/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
  345. ifeq ($(BR2_CCACHE),y)
  346. CCACHE := $(HOST_DIR)/usr/bin/ccache
  347. BR_CACHE_DIR ?= $(call qstrip,$(BR2_CCACHE_DIR))
  348. export BR_CACHE_DIR
  349. HOSTCC := $(CCACHE) $(HOSTCC)
  350. HOSTCXX := $(CCACHE) $(HOSTCXX)
  351. else
  352. export BR_NO_CCACHE
  353. endif
  354. # Scripts in support/ or post-build scripts may need to reference
  355. # these locations, so export them so it is easier to use
  356. export BR2_CONFIG
  357. export TARGET_DIR
  358. export STAGING_DIR
  359. export HOST_DIR
  360. export BINARIES_DIR
  361. export BASE_DIR
  362. ################################################################################
  363. #
  364. # You should probably leave this stuff alone unless you know
  365. # what you are doing.
  366. #
  367. ################################################################################
  368. all: world
  369. # Include legacy before the other things, because package .mk files
  370. # may rely on it.
  371. ifneq ($(BR2_DEPRECATED),y)
  372. include Makefile.legacy
  373. endif
  374. include package/Makefile.in
  375. include support/dependencies/dependencies.mk
  376. include toolchain/*.mk
  377. include toolchain/*/*.mk
  378. # Include the package override file if one has been provided in the
  379. # configuration.
  380. PACKAGE_OVERRIDE_FILE = $(call qstrip,$(BR2_PACKAGE_OVERRIDE_FILE))
  381. ifneq ($(PACKAGE_OVERRIDE_FILE),)
  382. -include $(PACKAGE_OVERRIDE_FILE)
  383. endif
  384. include $(sort $(wildcard package/*/*.mk))
  385. include boot/common.mk
  386. include linux/linux.mk
  387. include fs/common.mk
  388. include $(BR2_EXTERNAL)/external.mk
  389. # Now we are sure we have all the packages scanned and defined. We now
  390. # check for each package in the list of enabled packages, that all its
  391. # dependencies are indeed enabled.
  392. #
  393. # Only trigger the check for default builds. If the user forces building
  394. # a package, even if not enabled in the configuration, we want to accept
  395. # it.
  396. #
  397. ifeq ($(MAKECMDGOALS),)
  398. define CHECK_ONE_DEPENDENCY
  399. ifeq ($$($(2)_TYPE),target)
  400. ifeq ($$($(2)_IS_VIRTUAL),)
  401. ifneq ($$($$($(2)_KCONFIG_VAR)),y)
  402. $$(error $$($(2)_NAME) is in the dependency chain of $$($(1)_NAME) that \
  403. has added it to its _DEPENDENCIES variable without selecting it or \
  404. depending on it from Config.in)
  405. endif
  406. endif
  407. endif
  408. endef
  409. $(foreach pkg,$(call UPPERCASE,$(PACKAGES)),\
  410. $(foreach dep,$(call UPPERCASE,$($(pkg)_FINAL_ALL_DEPENDENCIES)),\
  411. $(eval $(call CHECK_ONE_DEPENDENCY,$(pkg),$(dep))$(sep))))
  412. endif
  413. dirs: $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
  414. $(HOST_DIR) $(BINARIES_DIR)
  415. $(BUILD_DIR)/buildroot-config/auto.conf: $(BR2_CONFIG)
  416. $(MAKE1) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig
  417. prepare: $(BUILD_DIR)/buildroot-config/auto.conf
  418. world: target-post-image
  419. .PHONY: all world toolchain dirs clean distclean source outputmakefile \
  420. legal-info legal-info-prepare legal-info-clean printvars help \
  421. list-defconfigs target-finalize target-post-image source-check
  422. ################################################################################
  423. #
  424. # staging and target directories do NOT list these as
  425. # dependencies anywhere else
  426. #
  427. ################################################################################
  428. $(BUILD_DIR) $(TARGET_DIR) $(HOST_DIR) $(BINARIES_DIR) $(LEGAL_INFO_DIR) $(REDIST_SOURCES_DIR_TARGET) $(REDIST_SOURCES_DIR_HOST):
  429. @mkdir -p $@
  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. grep -qx $${langdir##*/} $(LOCALE_WHITELIST) || rm -rf $$langdir; \
  503. done; \
  504. done
  505. if [ -d $(TARGET_DIR)/usr/share/X11/locale ]; \
  506. then \
  507. for lang in $(LOCALE_NOPURGE); \
  508. do \
  509. if [ -f $(TARGET_DIR)/usr/share/X11/locale/$$lang/XLC_LOCALE ]; \
  510. then \
  511. echo "$$lang/XLC_LOCALE: $$lang"; \
  512. fi \
  513. done > $(TARGET_DIR)/usr/share/X11/locale/locale.dir; \
  514. fi
  515. endef
  516. TARGET_FINALIZE_HOOKS += PURGE_LOCALES
  517. endif
  518. $(TARGETS_ROOTFS): target-finalize
  519. target-finalize: $(PACKAGES)
  520. @$(call MESSAGE,"Finalizing target directory")
  521. $(foreach hook,$(TARGET_FINALIZE_HOOKS),$($(hook))$(sep))
  522. rm -rf $(TARGET_DIR)/usr/include $(TARGET_DIR)/usr/share/aclocal \
  523. $(TARGET_DIR)/usr/lib/pkgconfig $(TARGET_DIR)/usr/share/pkgconfig \
  524. $(TARGET_DIR)/usr/lib/cmake $(TARGET_DIR)/usr/share/cmake
  525. find $(TARGET_DIR)/usr/{lib,share}/ -name '*.cmake' -print0 | xargs -0 rm -f
  526. find $(TARGET_DIR)/lib $(TARGET_DIR)/usr/lib $(TARGET_DIR)/usr/libexec \
  527. \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
  528. ifneq ($(BR2_PACKAGE_GDB),y)
  529. rm -rf $(TARGET_DIR)/usr/share/gdb
  530. endif
  531. ifneq ($(BR2_PACKAGE_BASH),y)
  532. rm -rf $(TARGET_DIR)/usr/share/bash-completion
  533. endif
  534. ifneq ($(BR2_PACKAGE_ZSH),y)
  535. rm -rf $(TARGET_DIR)/usr/share/zsh
  536. endif
  537. rm -rf $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/man
  538. rm -rf $(TARGET_DIR)/usr/info $(TARGET_DIR)/usr/share/info
  539. rm -rf $(TARGET_DIR)/usr/doc $(TARGET_DIR)/usr/share/doc
  540. rm -rf $(TARGET_DIR)/usr/share/gtk-doc
  541. -rmdir $(TARGET_DIR)/usr/share 2>/dev/null
  542. $(STRIP_FIND_CMD) | xargs -0 $(STRIPCMD) 2>/dev/null || true
  543. if test -d $(TARGET_DIR)/lib/modules; then \
  544. find $(TARGET_DIR)/lib/modules -type f -name '*.ko' -print0 | \
  545. xargs -0 -r $(KSTRIPCMD); fi
  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 $(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. @echo "Legal info produced in $(LEGAL_INFO_DIR)"
  605. @rm -f $(LEGAL_WARNINGS)
  606. show-targets:
  607. @echo $(PACKAGES) $(TARGETS_ROOTFS)
  608. graph-build: $(O)/build/build-time.log
  609. @install -d $(GRAPHS_DIR)
  610. $(foreach o,name build duration,./support/scripts/graph-build-time \
  611. --type=histogram --order=$(o) --input=$(<) \
  612. --output=$(GRAPHS_DIR)/build.hist-$(o).$(BR_GRAPH_OUT) \
  613. $(if $(BR2_GRAPH_ALT),--alternate-colors)$(sep))
  614. $(foreach t,packages steps,./support/scripts/graph-build-time \
  615. --type=pie-$(t) --input=$(<) \
  616. --output=$(GRAPHS_DIR)/build.pie-$(t).$(BR_GRAPH_OUT) \
  617. $(if $(BR2_GRAPH_ALT),--alternate-colors)$(sep))
  618. graph-depends-requirements:
  619. @dot -? >/dev/null 2>&1 || \
  620. { echo "ERROR: The 'dot' program from Graphviz is needed for graph-depends" >&2; exit 1; }
  621. graph-depends: graph-depends-requirements
  622. @$(INSTALL) -d $(GRAPHS_DIR)
  623. @cd "$(CONFIG_DIR)"; \
  624. $(TOPDIR)/support/scripts/graph-depends $(BR2_GRAPH_DEPS_OPTS) \
  625. |tee $(GRAPHS_DIR)/$(@).dot \
  626. |dot $(BR2_GRAPH_DOT_OPTS) -T$(BR_GRAPH_OUT) -o $(GRAPHS_DIR)/$(@).$(BR_GRAPH_OUT)
  627. graph-size:
  628. $(Q)mkdir -p $(GRAPHS_DIR)
  629. $(Q)$(TOPDIR)/support/scripts/size-stats --builddir $(BASE_DIR) \
  630. --graph $(GRAPHS_DIR)/graph-size.$(BR_GRAPH_OUT) \
  631. --file-size-csv $(GRAPHS_DIR)/file-size-stats.csv \
  632. --package-size-csv $(GRAPHS_DIR)/package-size-stats.csv
  633. else # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
  634. all: menuconfig
  635. endif # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
  636. # configuration
  637. # ---------------------------------------------------------------------------
  638. HOSTCFLAGS = $(CFLAGS_FOR_BUILD)
  639. export HOSTCFLAGS
  640. $(BUILD_DIR)/buildroot-config/%onf:
  641. mkdir -p $(@D)/lxdialog
  642. PKG_CONFIG_PATH="$(HOST_PKG_CONFIG_PATH)" $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" \
  643. obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)
  644. DEFCONFIG = $(call qstrip,$(BR2_DEFCONFIG))
  645. # We don't want to fully expand BR2_DEFCONFIG here, so Kconfig will
  646. # recognize that if it's still at its default $(CONFIG_DIR)/defconfig
  647. COMMON_CONFIG_ENV = \
  648. BR2_DEFCONFIG='$(call qstrip,$(value BR2_DEFCONFIG))' \
  649. KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
  650. KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
  651. KCONFIG_TRISTATE=$(BUILD_DIR)/buildroot-config/tristate.config \
  652. BR2_CONFIG=$(BR2_CONFIG) \
  653. BR2_EXTERNAL=$(BR2_EXTERNAL) \
  654. HOST_GCC_VERSION="$(HOSTCC_VERSION)" \
  655. SKIP_LEGACY=
  656. xconfig: $(BUILD_DIR)/buildroot-config/qconf outputmakefile
  657. @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
  658. gconfig: $(BUILD_DIR)/buildroot-config/gconf outputmakefile
  659. @$(COMMON_CONFIG_ENV) srctree=$(TOPDIR) $< $(CONFIG_CONFIG_IN)
  660. menuconfig: $(BUILD_DIR)/buildroot-config/mconf outputmakefile
  661. @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
  662. nconfig: $(BUILD_DIR)/buildroot-config/nconf outputmakefile
  663. @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
  664. config: $(BUILD_DIR)/buildroot-config/conf outputmakefile
  665. @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
  666. # For the config targets that automatically select options, we pass
  667. # SKIP_LEGACY=y to disable the legacy options. However, in that case
  668. # no values are set for the legacy options so a subsequent oldconfig
  669. # will query them. Therefore, run an additional olddefconfig.
  670. oldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
  671. @$(COMMON_CONFIG_ENV) $< --oldconfig $(CONFIG_CONFIG_IN)
  672. randconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
  673. @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y $< --randconfig $(CONFIG_CONFIG_IN)
  674. @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
  675. allyesconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
  676. @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y $< --allyesconfig $(CONFIG_CONFIG_IN)
  677. @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
  678. allnoconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
  679. @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y $< --allnoconfig $(CONFIG_CONFIG_IN)
  680. @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
  681. randpackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
  682. @grep -v BR2_PACKAGE_ $(BR2_CONFIG) > $(CONFIG_DIR)/.config.nopkg
  683. @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y \
  684. KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
  685. $< --randconfig $(CONFIG_CONFIG_IN)
  686. @rm -f $(CONFIG_DIR)/.config.nopkg
  687. @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
  688. allyespackageconfig: $(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. $< --allyesconfig $(CONFIG_CONFIG_IN)
  693. @rm -f $(CONFIG_DIR)/.config.nopkg
  694. @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
  695. allnopackageconfig: $(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. $< --allnoconfig $(CONFIG_CONFIG_IN)
  700. @rm -f $(CONFIG_DIR)/.config.nopkg
  701. @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
  702. silentoldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
  703. $(COMMON_CONFIG_ENV) $< --silentoldconfig $(CONFIG_CONFIG_IN)
  704. olddefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
  705. $(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN)
  706. defconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
  707. @$(COMMON_CONFIG_ENV) $< --defconfig$(if $(DEFCONFIG),=$(DEFCONFIG)) $(CONFIG_CONFIG_IN)
  708. # Override the BR2_DEFCONFIG from COMMON_CONFIG_ENV with the new defconfig
  709. %_defconfig: $(BUILD_DIR)/buildroot-config/conf $(TOPDIR)/configs/%_defconfig outputmakefile
  710. @$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$(TOPDIR)/configs/$@ \
  711. $< --defconfig=$(TOPDIR)/configs/$@ $(CONFIG_CONFIG_IN)
  712. %_defconfig: $(BUILD_DIR)/buildroot-config/conf $(BR2_EXTERNAL)/configs/%_defconfig outputmakefile
  713. @$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$(BR2_EXTERNAL)/configs/$@ \
  714. $< --defconfig=$(BR2_EXTERNAL)/configs/$@ $(CONFIG_CONFIG_IN)
  715. savedefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
  716. @$(COMMON_CONFIG_ENV) $< \
  717. --savedefconfig=$(if $(DEFCONFIG),$(DEFCONFIG),$(CONFIG_DIR)/defconfig) \
  718. $(CONFIG_CONFIG_IN)
  719. @$(SED) '/BR2_DEFCONFIG=/d' $(if $(DEFCONFIG),$(DEFCONFIG),$(CONFIG_DIR)/defconfig)
  720. .PHONY: defconfig savedefconfig
  721. ################################################################################
  722. #
  723. # Cleanup and misc junk
  724. #
  725. ################################################################################
  726. # outputmakefile generates a Makefile in the output directory, if using a
  727. # separate output directory. This allows convenient use of make in the
  728. # output directory.
  729. outputmakefile:
  730. ifeq ($(NEED_WRAPPER),y)
  731. $(Q)$(TOPDIR)/support/scripts/mkmakefile $(TOPDIR) $(O)
  732. endif
  733. # printvars prints all the variables currently defined in our
  734. # Makefiles. Alternatively, if a non-empty VARS variable is passed,
  735. # only the variables matching the make pattern passed in VARS are
  736. # displayed.
  737. printvars:
  738. @$(foreach V, \
  739. $(sort $(if $(VARS),$(filter $(VARS),$(.VARIABLES)),$(.VARIABLES))), \
  740. $(if $(filter-out environment% default automatic, \
  741. $(origin $V)), \
  742. $(info $V=$($V) ($(value $V)))))
  743. clean:
  744. rm -rf $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
  745. $(BUILD_DIR) $(BASE_DIR)/staging \
  746. $(LEGAL_INFO_DIR) $(GRAPHS_DIR)
  747. distclean: clean
  748. ifeq ($(DL_DIR),$(TOPDIR)/dl)
  749. rm -rf $(DL_DIR)
  750. endif
  751. ifeq ($(O),output)
  752. rm -rf $(O)
  753. endif
  754. rm -rf $(BR2_CONFIG) $(CONFIG_DIR)/.config.old $(CONFIG_DIR)/..config.tmp \
  755. $(CONFIG_DIR)/.auto.deps $(BR2_EXTERNAL_FILE)
  756. help:
  757. @echo 'Cleaning:'
  758. @echo ' clean - delete all files created by build'
  759. @echo ' distclean - delete all non-source files (including .config)'
  760. @echo
  761. @echo 'Build:'
  762. @echo ' all - make world'
  763. @echo ' toolchain - build toolchain'
  764. @echo
  765. @echo 'Configuration:'
  766. @echo ' menuconfig - interactive curses-based configurator'
  767. @echo ' nconfig - interactive ncurses-based configurator'
  768. @echo ' xconfig - interactive Qt-based configurator'
  769. @echo ' gconfig - interactive GTK-based configurator'
  770. @echo ' oldconfig - resolve any unresolved symbols in .config'
  771. @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps'
  772. @echo ' olddefconfig - Same as silentoldconfig but sets new symbols to their default value'
  773. @echo ' randconfig - New config with random answer to all options'
  774. @echo ' defconfig - New config with default answer to all options'
  775. @echo ' BR2_DEFCONFIG, if set, is used as input'
  776. @echo ' savedefconfig - Save current config to BR2_DEFCONFIG (minimal config)'
  777. @echo ' allyesconfig - New config where all options are accepted with yes'
  778. @echo ' allnoconfig - New config where all options are answered with no'
  779. @echo ' randpackageconfig - New config with random answer to package options'
  780. @echo ' allyespackageconfig - New config where pkg options are accepted with yes'
  781. @echo ' allnopackageconfig - New config where package options are answered with no'
  782. @echo
  783. @echo 'Package-specific:'
  784. @echo ' <pkg> - Build and install <pkg> and all its dependencies'
  785. @echo ' <pkg>-source - Only download the source files for <pkg>'
  786. @echo ' <pkg>-extract - Extract <pkg> sources'
  787. @echo ' <pkg>-patch - Apply patches to <pkg>'
  788. @echo ' <pkg>-depends - Build <pkg>'\''s dependencies'
  789. @echo ' <pkg>-configure - Build <pkg> up to the configure step'
  790. @echo ' <pkg>-build - Build <pkg> up to the build step'
  791. @echo ' <pkg>-graph-depends - Generate a graph of <pkg>'\''s dependencies'
  792. @echo ' <pkg>-dirclean - Remove <pkg> build directory'
  793. @echo ' <pkg>-reconfigure - Restart the build from the configure step'
  794. @echo ' <pkg>-rebuild - Restart the build from the build step'
  795. ifeq ($(BR2_PACKAGE_BUSYBOX),y)
  796. @echo ' busybox-menuconfig - Run BusyBox menuconfig'
  797. endif
  798. ifeq ($(BR2_LINUX_KERNEL),y)
  799. @echo ' linux-menuconfig - Run Linux kernel menuconfig'
  800. @echo ' linux-savedefconfig - Run Linux kernel savedefconfig'
  801. @echo ' linux-update-defconfig - Save the Linux configuration to the path specified'
  802. @echo ' by BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE'
  803. endif
  804. ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
  805. @echo ' uclibc-menuconfig - Run uClibc menuconfig'
  806. endif
  807. ifeq ($(BR2_TARGET_BAREBOX),y)
  808. @echo ' barebox-menuconfig - Run barebox menuconfig'
  809. @echo ' barebox-savedefconfig - Run barebox savedefconfig'
  810. endif
  811. @echo
  812. @echo 'Documentation:'
  813. @echo ' manual - build manual in all formats'
  814. @echo ' manual-html - build manual in HTML'
  815. @echo ' manual-split-html - build manual in split HTML'
  816. @echo ' manual-pdf - build manual in PDF'
  817. @echo ' manual-text - build manual in text'
  818. @echo ' manual-epub - build manual in ePub'
  819. @echo ' graph-build - generate graphs of the build times'
  820. @echo ' graph-depends - generate graph of the dependency tree'
  821. @echo ' graph-size - generate stats of the filesystem size'
  822. @echo ' list-defconfigs - list all defconfigs (pre-configured minimal systems)'
  823. @echo
  824. @echo 'Miscellaneous:'
  825. @echo ' source - download all sources needed for offline-build'
  826. @echo ' source-check - check selected packages for valid download URLs'
  827. @echo ' external-deps - list external packages used'
  828. @echo ' legal-info - generate info about license compliance'
  829. @echo
  830. @echo ' make V=0|1 - 0 => quiet build (default), 1 => verbose build'
  831. @echo ' make O=dir - Locate all output files in "dir", including .config'
  832. @echo
  833. @echo 'For further details, see README, generate the Buildroot manual, or consult'
  834. @echo 'it on-line at http://buildroot.org/docs.html'
  835. @echo
  836. list-defconfigs:
  837. @echo 'Built-in configs:'
  838. @$(foreach b, $(sort $(notdir $(wildcard $(TOPDIR)/configs/*_defconfig))), \
  839. printf " %-35s - Build for %s\\n" $(b) $(b:_defconfig=);)
  840. ifneq ($(wildcard $(BR2_EXTERNAL)/configs/*_defconfig),)
  841. @echo
  842. @echo 'User-provided configs:'
  843. @$(foreach b, $(sort $(notdir $(wildcard $(BR2_EXTERNAL)/configs/*_defconfig))), \
  844. printf " %-35s - Build for %s\\n" $(b) $(b:_defconfig=);)
  845. endif
  846. @echo
  847. release: OUT = buildroot-$(BR2_VERSION)
  848. # Create release tarballs. We need to fiddle a bit to add the generated
  849. # documentation to the git output
  850. release:
  851. git archive --format=tar --prefix=$(OUT)/ HEAD > $(OUT).tar
  852. $(MAKE) O=$(OUT) manual-html manual-text manual-pdf
  853. $(MAKE) O=$(OUT) manual-clean
  854. tar rf $(OUT).tar $(OUT)
  855. gzip -9 -c < $(OUT).tar > $(OUT).tar.gz
  856. bzip2 -9 -c < $(OUT).tar > $(OUT).tar.bz2
  857. rm -rf $(OUT) $(OUT).tar
  858. print-version:
  859. @echo $(BR2_VERSION_FULL)
  860. include docs/manual/manual.mk
  861. -include $(BR2_EXTERNAL)/docs/*/*.mk
  862. .PHONY: $(noconfig_targets)
  863. endif #umask