fs: use pseudo instead of fakeroot
[buildroot-gz.git] / Makefile
blobc00e2008d17f0f85e9f9ba666c7eebfab664581c
1 # Makefile for buildroot
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>
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.
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.
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
22 #--------------------------------------------------------------
23 # Just run 'make menuconfig', configure stuff, then run 'make'.
24 # You shouldn't need to mess with anything beyond this point...
25 #--------------------------------------------------------------
27 # we want bash as shell
28 SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
29 else if [ -x /bin/bash ]; then echo /bin/bash; \
30 else echo sh; fi; fi)
32 # Set O variable if not already done on the command line;
33 # or avoid confusing packages that can use the O=<dir> syntax for out-of-tree
34 # build by preventing it from being forwarded to sub-make calls.
35 ifneq ("$(origin O)", "command line")
36 O := $(CURDIR)/output
37 else
38 # Other packages might also support Linux-style out of tree builds
39 # with the O=<dir> syntax (E.G. BusyBox does). As make automatically
40 # forwards command line variable definitions those packages get very
41 # confused. Fix this by telling make to not do so.
42 MAKEOVERRIDES :=
43 # Strangely enough O is still passed to submakes with MAKEOVERRIDES
44 # (with make 3.81 atleast), the only thing that changes is the output
45 # of the origin function (command line -> environment).
46 # Unfortunately some packages don't look at origin (E.G. uClibc 0.9.31+)
47 # To really make O go away, we have to override it.
48 override O := $(O)
49 endif
51 # Check if the current Buildroot execution meets all the pre-requisites.
52 # If they are not met, Buildroot will actually do its job in a sub-make meeting
53 # its pre-requisites, which are:
54 # 1- Permissive enough umask:
55 # Wrong or too restrictive umask will prevent Buildroot and packages from
56 # creating files and directories.
57 # 2- Absolute canonical CWD (i.e. $(CURDIR)):
58 # Otherwise, some packages will use CWD as-is, others will compute its
59 # absolute canonical path. This makes harder tracking and fixing host
60 # machine path leaks.
61 # 3- Absolute canonical output location (i.e. $(O)):
62 # For the same reason as the one for CWD.
64 # Remove the trailing '/.' from $(O) as it can be added by the makefile wrapper
65 # installed in the $(O) directory.
66 # Also remove the trailing '/' the user can set when on the command line.
67 override O := $(patsubst %/,%,$(patsubst %.,%,$(O)))
68 # Make sure $(O) actually exists before calling realpath on it; this is to
69 # avoid empty CANONICAL_O in case on non-existing entry.
70 CANONICAL_O := $(shell mkdir -p $(O) >/dev/null 2>&1)$(realpath $(O))
72 CANONICAL_CURDIR = $(realpath $(CURDIR))
74 REQ_UMASK = 0022
76 # Make sure O= is passed (with its absolute canonical path) everywhere the
77 # toplevel makefile is called back.
78 EXTRAMAKEARGS := O=$(CANONICAL_O)
80 # Check Buildroot execution pre-requisites here.
81 ifneq ($(shell umask):$(CURDIR):$(O),$(REQ_UMASK):$(CANONICAL_CURDIR):$(CANONICAL_O))
82 .PHONY: _all $(MAKECMDGOALS)
84 $(MAKECMDGOALS): _all
87 _all:
88 @umask $(REQ_UMASK) && \
89 $(MAKE) -C $(CANONICAL_CURDIR) --no-print-directory \
90 $(MAKECMDGOALS) $(EXTRAMAKEARGS)
92 else # umask / $(CURDIR) / $(O)
94 # This is our default rule, so must come first
95 all:
97 # Set and export the version string
98 export BR2_VERSION := 2016.11-git
100 # Save running make version since it's clobbered by the make package
101 RUNNING_MAKE_VERSION := $(MAKE_VERSION)
103 # Check for minimal make version (note: this check will break at make 10.x)
104 MIN_MAKE_VERSION = 3.81
105 ifneq ($(firstword $(sort $(RUNNING_MAKE_VERSION) $(MIN_MAKE_VERSION))),$(MIN_MAKE_VERSION))
106 $(error You have make '$(RUNNING_MAKE_VERSION)' installed. GNU make >= $(MIN_MAKE_VERSION) is required)
107 endif
109 # Parallel execution of this Makefile is disabled because it changes
110 # the packages building order, that can be a problem for two reasons:
111 # - If a package has an unspecified optional dependency and that
112 # dependency is present when the package is built, it is used,
113 # otherwise it isn't (but compilation happily proceeds) so the end
114 # result will differ if the order is swapped due to parallel
115 # building.
116 # - Also changing the building order can be a problem if two packages
117 # manipulate the same file in the target directory.
119 # Taking into account the above considerations, if you still want to execute
120 # this top-level Makefile in parallel comment the ".NOTPARALLEL" line and
121 # use the -j<jobs> option when building, e.g:
122 # make -j$((`getconf _NPROCESSORS_ONLN`+1))
123 .NOTPARALLEL:
125 # absolute path
126 TOPDIR := $(CURDIR)
127 CONFIG_CONFIG_IN = Config.in
128 CONFIG = support/kconfig
129 DATE := $(shell date +%Y%m%d)
131 # Compute the full local version string so packages can use it as-is
132 # Need to export it, so it can be got from environment in children (eg. mconf)
133 export BR2_VERSION_FULL := $(BR2_VERSION)$(shell $(TOPDIR)/support/scripts/setlocalversion)
135 noconfig_targets := menuconfig nconfig gconfig xconfig config oldconfig randconfig \
136 defconfig %_defconfig allyesconfig allnoconfig silentoldconfig release \
137 randpackageconfig allyespackageconfig allnopackageconfig \
138 print-version olddefconfig distclean
140 # Some global targets do not trigger a build, but are used to collect
141 # metadata, or do various checks. When such targets are triggered,
142 # some packages should not do their configuration sanity
143 # checks. Provide them a BR_BUILDING variable set to 'y' when we're
144 # actually building and they should do their sanity checks.
146 # We're building in two situations: when MAKECMDGOALS is empty
147 # (default target is to build), or when MAKECMDGOALS contains
148 # something else than one of the nobuild_targets.
149 nobuild_targets := source source-check \
150 legal-info external-deps _external-deps \
151 clean distclean help
152 ifeq ($(MAKECMDGOALS),)
153 BR_BUILDING = y
154 else ifneq ($(filter-out $(nobuild_targets),$(MAKECMDGOALS)),)
155 BR_BUILDING = y
156 endif
158 # Include some helper macros and variables
159 include support/misc/utils.mk
161 # Set variables related to in-tree or out-of-tree build.
162 # Here, both $(O) and $(CURDIR) are absolute canonical paths.
163 ifeq ($(O),$(CURDIR)/output)
164 CONFIG_DIR := $(CURDIR)
165 NEED_WRAPPER =
166 else
167 CONFIG_DIR := $(O)
168 NEED_WRAPPER = y
169 endif
171 # bash prints the name of the directory on 'cd <dir>' if CDPATH is
172 # set, so unset it here to not cause problems. Notice that the export
173 # line doesn't affect the environment of $(shell ..) calls, so
174 # explictly throw away any output from 'cd' here.
175 export CDPATH :=
176 BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && pwd)
177 $(if $(BASE_DIR),, $(error output directory "$(O)" does not exist))
180 # Handling of BR2_EXTERNAL.
182 # The value of BR2_EXTERNAL is stored in .br-external in the output directory.
183 # The location of the external.mk makefile fragments is computed in that file.
184 # On subsequent invocations of make, this file is read in. BR2_EXTERNAL can
185 # still be overridden on the command line, therefore the file is re-created
186 # every time make is run.
188 BR2_EXTERNAL_FILE = $(BASE_DIR)/.br-external.mk
189 -include $(BR2_EXTERNAL_FILE)
190 $(shell support/scripts/br2-external \
191 -m -o '$(BR2_EXTERNAL_FILE)' $(BR2_EXTERNAL))
192 BR2_EXTERNAL_ERROR =
193 include $(BR2_EXTERNAL_FILE)
194 ifneq ($(BR2_EXTERNAL_ERROR),)
195 $(error $(BR2_EXTERNAL_ERROR))
196 endif
198 # To make sure that the environment variable overrides the .config option,
199 # set this before including .config.
200 ifneq ($(BR2_DL_DIR),)
201 DL_DIR := $(BR2_DL_DIR)
202 endif
203 ifneq ($(BR2_CCACHE_DIR),)
204 BR_CACHE_DIR := $(BR2_CCACHE_DIR)
205 endif
207 # Need that early, before we scan packages
208 # Avoids doing the $(or...) everytime
209 BR_GRAPH_OUT := $(or $(BR2_GRAPH_OUT),pdf)
211 BUILD_DIR := $(BASE_DIR)/build
212 BINARIES_DIR := $(BASE_DIR)/images
213 TARGET_DIR := $(BASE_DIR)/target
214 # initial definition so that 'make clean' works for most users, even without
215 # .config. HOST_DIR will be overwritten later when .config is included.
216 HOST_DIR := $(BASE_DIR)/host
217 GRAPHS_DIR := $(BASE_DIR)/graphs
219 LEGAL_INFO_DIR = $(BASE_DIR)/legal-info
220 REDIST_SOURCES_DIR_TARGET = $(LEGAL_INFO_DIR)/sources
221 REDIST_SOURCES_DIR_HOST = $(LEGAL_INFO_DIR)/host-sources
222 LICENSE_FILES_DIR_TARGET = $(LEGAL_INFO_DIR)/licenses
223 LICENSE_FILES_DIR_HOST = $(LEGAL_INFO_DIR)/host-licenses
224 LEGAL_MANIFEST_CSV_TARGET = $(LEGAL_INFO_DIR)/manifest.csv
225 LEGAL_MANIFEST_CSV_HOST = $(LEGAL_INFO_DIR)/host-manifest.csv
226 LEGAL_WARNINGS = $(LEGAL_INFO_DIR)/.warnings
227 LEGAL_REPORT = $(LEGAL_INFO_DIR)/README
229 ################################################################################
231 # staging and target directories do NOT list these as
232 # dependencies anywhere else
234 ################################################################################
235 $(BUILD_DIR) $(TARGET_DIR) $(HOST_DIR) $(BINARIES_DIR) $(LEGAL_INFO_DIR) $(REDIST_SOURCES_DIR_TARGET) $(REDIST_SOURCES_DIR_HOST):
236 @mkdir -p $@
238 BR2_CONFIG = $(CONFIG_DIR)/.config
240 # Pull in the user's configuration file
241 ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
242 -include $(BR2_CONFIG)
243 endif
245 # timezone and locale may affect build output
246 ifeq ($(BR2_REPRODUCIBLE),y)
247 export TZ=UTC
248 export LANG=C
249 export LC_ALL=C
250 endif
252 # To put more focus on warnings, be less verbose as default
253 # Use 'make V=1' to see the full commands
254 ifeq ("$(origin V)", "command line")
255 KBUILD_VERBOSE = $(V)
256 endif
257 ifndef KBUILD_VERBOSE
258 KBUILD_VERBOSE = 0
259 endif
261 ifeq ($(KBUILD_VERBOSE),1)
263 ifndef VERBOSE
264 VERBOSE = 1
265 endif
266 export VERBOSE
267 else
268 Q = @
269 endif
271 # kconfig uses CONFIG_SHELL
272 CONFIG_SHELL := $(SHELL)
274 export SHELL CONFIG_SHELL Q KBUILD_VERBOSE
276 ifndef HOSTAR
277 HOSTAR := ar
278 endif
279 ifndef HOSTAS
280 HOSTAS := as
281 endif
282 ifndef HOSTCC
283 HOSTCC := gcc
284 HOSTCC := $(shell which $(HOSTCC) || type -p $(HOSTCC) || echo gcc)
285 endif
286 HOSTCC_NOCCACHE := $(HOSTCC)
287 ifndef HOSTCXX
288 HOSTCXX := g++
289 HOSTCXX := $(shell which $(HOSTCXX) || type -p $(HOSTCXX) || echo g++)
290 endif
291 HOSTCXX_NOCCACHE := $(HOSTCXX)
292 ifndef HOSTCPP
293 HOSTCPP := cpp
294 endif
295 ifndef HOSTLD
296 HOSTLD := ld
297 endif
298 ifndef HOSTLN
299 HOSTLN := ln
300 endif
301 ifndef HOSTNM
302 HOSTNM := nm
303 endif
304 ifndef HOSTOBJCOPY
305 HOSTOBJCOPY := objcopy
306 endif
307 ifndef HOSTRANLIB
308 HOSTRANLIB := ranlib
309 endif
310 HOSTAR := $(shell which $(HOSTAR) || type -p $(HOSTAR) || echo ar)
311 HOSTAS := $(shell which $(HOSTAS) || type -p $(HOSTAS) || echo as)
312 HOSTCPP := $(shell which $(HOSTCPP) || type -p $(HOSTCPP) || echo cpp)
313 HOSTLD := $(shell which $(HOSTLD) || type -p $(HOSTLD) || echo ld)
314 HOSTLN := $(shell which $(HOSTLN) || type -p $(HOSTLN) || echo ln)
315 HOSTNM := $(shell which $(HOSTNM) || type -p $(HOSTNM) || echo nm)
316 HOSTOBJCOPY := $(shell which $(HOSTOBJCOPY) || type -p $(HOSTOBJCOPY) || echo objcopy)
317 HOSTRANLIB := $(shell which $(HOSTRANLIB) || type -p $(HOSTRANLIB) || echo ranlib)
319 export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTLD
320 export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE
322 # Determine the userland we are running on.
324 # Note that, despite its name, we are not interested in the actual
325 # architecture name. This is mostly used to determine whether some
326 # of the binary tools (e.g. pre-built external toolchains) can run
327 # on the current host. So we need to know if the userland we're
328 # running on can actually run those toolchains.
330 # For example, a 64-bit prebuilt toolchain will not run on a 64-bit
331 # kernel if the userland is 32-bit (e.g. in a chroot for example).
333 # So, we extract the first part of the tuple the host gcc was
334 # configured to generate code for; we assume this is our userland.
336 export HOSTARCH := $(shell LC_ALL=C $(HOSTCC_NOCCACHE) -v 2>&1 | \
337 sed -e '/^Target: \([^-]*\).*/!d' \
338 -e 's//\1/' \
339 -e 's/i.86/x86/' \
340 -e 's/sun4u/sparc64/' \
341 -e 's/arm.*/arm/' \
342 -e 's/sa110/arm/' \
343 -e 's/ppc64/powerpc64/' \
344 -e 's/ppc/powerpc/' \
345 -e 's/macppc/powerpc/' \
346 -e 's/sh.*/sh/' )
348 HOSTCC_VERSION := $(shell $(HOSTCC_NOCCACHE) --version | \
349 sed -n -r 's/^.* ([0-9]*)\.([0-9]*)\.([0-9]*)[ ]*.*/\1 \2/p')
351 # For gcc >= 5.x, we only need the major version.
352 ifneq ($(firstword $(HOSTCC_VERSION)),4)
353 HOSTCC_VERSION := $(firstword $(HOSTCC_VERSION))
354 endif
356 # Make sure pkg-config doesn't look outside the buildroot tree
357 HOST_PKG_CONFIG_PATH := $(PKG_CONFIG_PATH)
358 unexport PKG_CONFIG_PATH
359 unexport PKG_CONFIG_SYSROOT_DIR
360 unexport PKG_CONFIG_LIBDIR
362 # Having DESTDIR set in the environment confuses the installation
363 # steps of some packages.
364 unexport DESTDIR
366 # Causes breakage with packages that needs host-ruby
367 unexport RUBYOPT
369 include package/pkg-utils.mk
370 include package/doc-asciidoc.mk
372 ifeq ($(BR2_HAVE_DOT_CONFIG),y)
374 ################################################################################
376 # Hide troublesome environment variables from sub processes
378 ################################################################################
379 unexport CROSS_COMPILE
380 unexport ARCH
381 unexport CC
382 unexport LD
383 unexport AR
384 unexport CXX
385 unexport CPP
386 unexport RANLIB
387 unexport CFLAGS
388 unexport CXXFLAGS
389 unexport GREP_OPTIONS
390 unexport TAR_OPTIONS
391 unexport CONFIG_SITE
392 unexport QMAKESPEC
393 unexport TERMINFO
394 unexport MACHINE
395 unexport O
397 GNU_HOST_NAME := $(shell support/gnuconfig/config.guess)
399 PACKAGES :=
400 PACKAGES_ALL :=
402 # silent mode requested?
403 QUIET := $(if $(findstring s,$(filter-out --%,$(MAKEFLAGS))),-q)
405 # Strip off the annoying quoting
406 ARCH := $(call qstrip,$(BR2_ARCH))
408 KERNEL_ARCH := $(shell echo "$(ARCH)" | sed -e "s/-.*//" \
409 -e s/i.86/i386/ -e s/sun4u/sparc64/ \
410 -e s/arcle/arc/ \
411 -e s/arceb/arc/ \
412 -e s/arm.*/arm/ -e s/sa110/arm/ \
413 -e s/aarch64.*/arm64/ \
414 -e s/bfin/blackfin/ \
415 -e s/parisc64/parisc/ \
416 -e s/powerpc64.*/powerpc/ \
417 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
418 -e s/sh.*/sh/ \
419 -e s/microblazeel/microblaze/)
421 ZCAT := $(call qstrip,$(BR2_ZCAT))
422 BZCAT := $(call qstrip,$(BR2_BZCAT))
423 XZCAT := $(call qstrip,$(BR2_XZCAT))
424 TAR_OPTIONS = $(call qstrip,$(BR2_TAR_OPTIONS)) -xf
426 # packages compiled for the host go here
427 HOST_DIR := $(call qstrip,$(BR2_HOST_DIR))
429 # Quotes are needed for spaces and all in the original PATH content.
430 BR_PATH = "$(HOST_DIR)/bin:$(HOST_DIR)/sbin:$(HOST_DIR)/usr/bin:$(HOST_DIR)/usr/sbin:$(PATH)"
432 # Location of a file giving a big fat warning that output/target
433 # should not be used as the root filesystem.
434 TARGET_DIR_WARNING_FILE = $(TARGET_DIR)/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
436 ifeq ($(BR2_CCACHE),y)
437 CCACHE := $(HOST_DIR)/usr/bin/ccache
438 BR_CACHE_DIR ?= $(call qstrip,$(BR2_CCACHE_DIR))
439 export BR_CACHE_DIR
440 HOSTCC := $(CCACHE) $(HOSTCC)
441 HOSTCXX := $(CCACHE) $(HOSTCXX)
442 else
443 export BR_NO_CCACHE
444 endif
446 # Scripts in support/ or post-build scripts may need to reference
447 # these locations, so export them so it is easier to use
448 export BR2_CONFIG
449 export BR2_REPRODUCIBLE
450 export TARGET_DIR
451 export STAGING_DIR
452 export HOST_DIR
453 export BINARIES_DIR
454 export BASE_DIR
456 ################################################################################
458 # You should probably leave this stuff alone unless you know
459 # what you are doing.
461 ################################################################################
463 all: world
465 # Include legacy before the other things, because package .mk files
466 # may rely on it.
467 include Makefile.legacy
469 include package/Makefile.in
470 include support/dependencies/dependencies.mk
472 include toolchain/*.mk
473 include toolchain/*/*.mk
475 # Include the package override file if one has been provided in the
476 # configuration.
477 PACKAGE_OVERRIDE_FILE = $(call qstrip,$(BR2_PACKAGE_OVERRIDE_FILE))
478 ifneq ($(PACKAGE_OVERRIDE_FILE),)
479 -include $(PACKAGE_OVERRIDE_FILE)
480 endif
482 include $(sort $(wildcard package/*/*.mk))
484 include boot/common.mk
485 include linux/linux.mk
486 include fs/common.mk
488 # If using a br2-external tree, the BR2_EXTERNAL_$(NAME)_PATH variables
489 # are also present in the .config file. Since .config is included after
490 # we defined them in the Makefile, the values for those variables are
491 # quoted. We just include the generated Makefile fragment .br2-external.mk
492 # a third time, which will set those variables to the un-quoted values.
493 include $(BR2_EXTERNAL_FILE)
495 # Nothing to include if no BR2_EXTERNAL tree in use
496 include $(BR2_EXTERNAL_MKS)
498 # Now we are sure we have all the packages scanned and defined. We now
499 # check for each package in the list of enabled packages, that all its
500 # dependencies are indeed enabled.
502 # Only trigger the check for default builds. If the user forces building
503 # a package, even if not enabled in the configuration, we want to accept
504 # it.
506 ifeq ($(MAKECMDGOALS),)
508 define CHECK_ONE_DEPENDENCY
509 ifeq ($$($(2)_TYPE),target)
510 ifeq ($$($(2)_IS_VIRTUAL),)
511 ifneq ($$($$($(2)_KCONFIG_VAR)),y)
512 $$(error $$($(2)_NAME) is in the dependency chain of $$($(1)_NAME) that \
513 has added it to its _DEPENDENCIES variable without selecting it or \
514 depending on it from Config.in)
515 endif
516 endif
517 endif
518 endef
520 $(foreach pkg,$(call UPPERCASE,$(PACKAGES)),\
521 $(foreach dep,$(call UPPERCASE,$($(pkg)_FINAL_ALL_DEPENDENCIES)),\
522 $(eval $(call CHECK_ONE_DEPENDENCY,$(pkg),$(dep))$(sep))))
524 endif
526 dirs: $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
527 $(HOST_DIR) $(BINARIES_DIR)
529 $(BUILD_DIR)/buildroot-config/auto.conf: $(BR2_CONFIG)
530 $(MAKE1) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig
532 prepare: $(BUILD_DIR)/buildroot-config/auto.conf
534 world: target-post-image
536 .PHONY: all world toolchain dirs clean distclean source outputmakefile \
537 legal-info legal-info-prepare legal-info-clean printvars help \
538 list-defconfigs target-finalize target-post-image source-check
540 # Populating the staging with the base directories is handled by the skeleton package
541 $(STAGING_DIR):
542 @mkdir -p $(STAGING_DIR)
543 @ln -snf $(STAGING_DIR) $(BASE_DIR)/staging
545 RSYNC_VCS_EXCLUSIONS = \
546 --exclude .svn --exclude .git --exclude .hg --exclude .bzr \
547 --exclude CVS
549 STRIP_FIND_CMD = find $(TARGET_DIR)
550 ifneq (,$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS)))
551 STRIP_FIND_CMD += \( $(call finddirclauses,$(TARGET_DIR),$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS))) \) -prune -o
552 endif
553 STRIP_FIND_CMD += -type f \( -perm /111 -o -name '*.so*' \)
554 # file exclusions:
555 # - libpthread.so: a non-stripped libpthread shared library is needed for
556 # proper debugging of pthread programs using gdb.
557 # - ld.so: a non-stripped dynamic linker library is needed for valgrind
558 # - kernel modules (*.ko): do not function properly when stripped like normal
559 # applications and libraries. Normally kernel modules are already excluded
560 # by the executable permission check above, so the explicit exclusion is only
561 # done for kernel modules with incorrect permissions.
562 STRIP_FIND_CMD += -not \( $(call findfileclauses,libpthread*.so* ld-*.so* *.ko $(call qstrip,$(BR2_STRIP_EXCLUDE_FILES))) \) -print0
564 ifeq ($(BR2_ECLIPSE_REGISTER),y)
565 define TOOLCHAIN_ECLIPSE_REGISTER
566 ./support/scripts/eclipse-register-toolchain `readlink -f $(O)` \
567 $(notdir $(TARGET_CROSS)) $(BR2_ARCH)
568 endef
569 TARGET_FINALIZE_HOOKS += TOOLCHAIN_ECLIPSE_REGISTER
570 endif
572 # Generate locale data. Basically, we call the localedef program
573 # (built by the host-localedef package) for each locale. The input
574 # data comes preferably from the toolchain, or if the toolchain does
575 # not have them (Linaro toolchains), we use the ones available on the
576 # host machine.
577 ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),y)
578 GLIBC_GENERATE_LOCALES = $(call qstrip,$(BR2_GENERATE_LOCALE))
579 ifneq ($(GLIBC_GENERATE_LOCALES),)
580 PACKAGES += host-localedef
582 define GENERATE_GLIBC_LOCALES
583 $(Q)mkdir -p $(TARGET_DIR)/usr/lib/locale/
584 $(Q)for locale in $(GLIBC_GENERATE_LOCALES) ; do \
585 inputfile=`echo $${locale} | cut -f1 -d'.'` ; \
586 charmap=`echo $${locale} | cut -f2 -d'.' -s` ; \
587 if test -z "$${charmap}" ; then \
588 charmap="UTF-8" ; \
589 fi ; \
590 echo "Generating locale $${inputfile}.$${charmap}" ; \
591 I18NPATH=$(STAGING_DIR)/usr/share/i18n:/usr/share/i18n \
592 $(HOST_DIR)/usr/bin/localedef \
593 --prefix=$(TARGET_DIR) \
594 --$(call LOWERCASE,$(BR2_ENDIAN))-endian \
595 -i $${inputfile} -f $${charmap} \
596 $${locale} ; \
597 done
598 endef
599 TARGET_FINALIZE_HOOKS += GENERATE_GLIBC_LOCALES
600 endif
601 endif
603 ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
604 LOCALE_WHITELIST = $(BUILD_DIR)/locales.nopurge
605 LOCALE_NOPURGE = $(call qstrip,$(BR2_ENABLE_LOCALE_WHITELIST))
607 # This piece of junk does the following:
608 # First collect the whitelist in a file.
609 # Then go over all the locale dirs and for each subdir, check if it exists
610 # in the whitelist file. If it doesn't, kill it.
611 # Finally, specifically for X11, regenerate locale.dir from the whitelist.
612 define PURGE_LOCALES
613 rm -f $(LOCALE_WHITELIST)
614 for i in $(LOCALE_NOPURGE) locale-archive; do echo $$i >> $(LOCALE_WHITELIST); done
616 for dir in $(wildcard $(addprefix $(TARGET_DIR),/usr/share/locale /usr/share/X11/locale /usr/lib/locale)); \
617 do \
618 for langdir in $$dir/*; \
619 do \
620 if [ -e "$${langdir}" ]; \
621 then \
622 grep -qx "$${langdir##*/}" $(LOCALE_WHITELIST) || rm -rf $$langdir; \
623 fi \
624 done; \
625 done
626 if [ -d $(TARGET_DIR)/usr/share/X11/locale ]; \
627 then \
628 for lang in $(LOCALE_NOPURGE); \
629 do \
630 if [ -f $(TARGET_DIR)/usr/share/X11/locale/$$lang/XLC_LOCALE ]; \
631 then \
632 echo "$$lang/XLC_LOCALE: $$lang"; \
633 fi \
634 done > $(TARGET_DIR)/usr/share/X11/locale/locale.dir; \
636 endef
637 TARGET_FINALIZE_HOOKS += PURGE_LOCALES
638 endif
640 $(TARGETS_ROOTFS): target-finalize
642 target-finalize: $(PACKAGES)
643 @$(call MESSAGE,"Finalizing target directory")
644 $(foreach hook,$(TARGET_FINALIZE_HOOKS),$($(hook))$(sep))
645 rm -rf $(TARGET_DIR)/usr/include $(TARGET_DIR)/usr/share/aclocal \
646 $(TARGET_DIR)/usr/lib/pkgconfig $(TARGET_DIR)/usr/share/pkgconfig \
647 $(TARGET_DIR)/usr/lib/cmake $(TARGET_DIR)/usr/share/cmake
648 find $(TARGET_DIR)/usr/{lib,share}/ -name '*.cmake' -print0 | xargs -0 rm -f
649 find $(TARGET_DIR)/lib $(TARGET_DIR)/usr/lib $(TARGET_DIR)/usr/libexec \
650 \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
651 ifneq ($(BR2_PACKAGE_GDB),y)
652 rm -rf $(TARGET_DIR)/usr/share/gdb
653 endif
654 ifneq ($(BR2_PACKAGE_BASH),y)
655 rm -rf $(TARGET_DIR)/usr/share/bash-completion
656 endif
657 ifneq ($(BR2_PACKAGE_ZSH),y)
658 rm -rf $(TARGET_DIR)/usr/share/zsh
659 endif
660 rm -rf $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/man
661 rm -rf $(TARGET_DIR)/usr/info $(TARGET_DIR)/usr/share/info
662 rm -rf $(TARGET_DIR)/usr/doc $(TARGET_DIR)/usr/share/doc
663 rm -rf $(TARGET_DIR)/usr/share/gtk-doc
664 -rmdir $(TARGET_DIR)/usr/share 2>/dev/null
665 $(STRIP_FIND_CMD) | xargs -0 $(STRIPCMD) 2>/dev/null || true
667 # See http://sourceware.org/gdb/wiki/FAQ, "GDB does not see any threads
668 # besides the one in which crash occurred; or SIGTRAP kills my program when
669 # I set a breakpoint"
670 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
671 find $(TARGET_DIR)/lib -type f -name 'libpthread*.so*' | \
672 xargs -r $(STRIPCMD) $(STRIP_STRIP_DEBUG)
673 endif
675 # Valgrind needs ld.so with enough information, so only strip
676 # debugging symbols.
677 find $(TARGET_DIR)/lib -type f -name 'ld-*.so*' | \
678 xargs -r $(STRIPCMD) $(STRIP_STRIP_DEBUG)
679 test -f $(TARGET_DIR)/etc/ld.so.conf && \
680 { echo "ERROR: we shouldn't have a /etc/ld.so.conf file"; exit 1; } || true
681 test -d $(TARGET_DIR)/etc/ld.so.conf.d && \
682 { echo "ERROR: we shouldn't have a /etc/ld.so.conf.d directory"; exit 1; } || true
683 mkdir -p $(TARGET_DIR)/etc
685 echo "NAME=Buildroot"; \
686 echo "VERSION=$(BR2_VERSION_FULL)"; \
687 echo "ID=buildroot"; \
688 echo "VERSION_ID=$(BR2_VERSION)"; \
689 echo "PRETTY_NAME=\"Buildroot $(BR2_VERSION)\"" \
690 ) > $(TARGET_DIR)/etc/os-release
692 @$(foreach d, $(call qstrip,$(BR2_ROOTFS_OVERLAY)), \
693 $(call MESSAGE,"Copying overlay $(d)"); \
694 rsync -a --ignore-times --keep-dirlinks $(RSYNC_VCS_EXCLUSIONS) \
695 --chmod=u=rwX,go=rX --exclude .empty --exclude '*~' \
696 $(d)/ $(TARGET_DIR)$(sep))
698 @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_BUILD_SCRIPT)), \
699 $(call MESSAGE,"Executing post-build script $(s)"); \
700 $(EXTRA_ENV) $(s) $(TARGET_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
702 target-post-image: $(TARGETS_ROOTFS) target-finalize
703 @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_IMAGE_SCRIPT)), \
704 $(call MESSAGE,"Executing post-image script $(s)"); \
705 $(EXTRA_ENV) $(s) $(BINARIES_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
707 source: $(foreach p,$(PACKAGES),$(p)-all-source)
709 _external-deps: $(foreach p,$(PACKAGES),$(p)-all-external-deps)
710 external-deps:
711 @$(MAKE1) -Bs $(EXTRAMAKEARGS) _external-deps | sort -u
713 # check if download URLs are outdated
714 source-check: $(foreach p,$(PACKAGES),$(p)-all-source-check)
716 legal-info-clean:
717 @rm -fr $(LEGAL_INFO_DIR)
719 legal-info-prepare: $(LEGAL_INFO_DIR)
720 @$(call MESSAGE,"Collecting legal info")
721 @$(call legal-license-file,buildroot,COPYING,COPYING,HOST)
722 @$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE,SOURCE SITE,TARGET)
723 @$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE,SOURCE SITE,HOST)
724 @$(call legal-manifest,buildroot,$(BR2_VERSION_FULL),GPLv2+,COPYING,not saved,not saved,HOST)
725 @$(call legal-warning,the Buildroot source code has not been saved)
726 @cp $(BR2_CONFIG) $(LEGAL_INFO_DIR)/buildroot.config
728 legal-info: dirs legal-info-clean legal-info-prepare $(foreach p,$(PACKAGES),$(p)-all-legal-info) \
729 $(REDIST_SOURCES_DIR_TARGET) $(REDIST_SOURCES_DIR_HOST)
730 @cat support/legal-info/README.header >>$(LEGAL_REPORT)
731 @if [ -r $(LEGAL_WARNINGS) ]; then \
732 cat support/legal-info/README.warnings-header \
733 $(LEGAL_WARNINGS) >>$(LEGAL_REPORT); \
734 cat $(LEGAL_WARNINGS); fi
735 @rm -f $(LEGAL_WARNINGS)
736 @(cd $(LEGAL_INFO_DIR); \
737 find * -type f -exec sha256sum {} + | LC_ALL=C sort -k2 \
738 >.legal-info.sha256; \
739 mv .legal-info.sha256 legal-info.sha256)
740 @echo "Legal info produced in $(LEGAL_INFO_DIR)"
742 show-targets:
743 @echo $(PACKAGES) $(TARGETS_ROOTFS)
745 graph-build: $(O)/build/build-time.log
746 @install -d $(GRAPHS_DIR)
747 $(foreach o,name build duration,./support/scripts/graph-build-time \
748 --type=histogram --order=$(o) --input=$(<) \
749 --output=$(GRAPHS_DIR)/build.hist-$(o).$(BR_GRAPH_OUT) \
750 $(if $(BR2_GRAPH_ALT),--alternate-colors)$(sep))
751 $(foreach t,packages steps,./support/scripts/graph-build-time \
752 --type=pie-$(t) --input=$(<) \
753 --output=$(GRAPHS_DIR)/build.pie-$(t).$(BR_GRAPH_OUT) \
754 $(if $(BR2_GRAPH_ALT),--alternate-colors)$(sep))
756 graph-depends-requirements:
757 @dot -? >/dev/null 2>&1 || \
758 { echo "ERROR: The 'dot' program from Graphviz is needed for graph-depends" >&2; exit 1; }
760 graph-depends: graph-depends-requirements
761 @$(INSTALL) -d $(GRAPHS_DIR)
762 @cd "$(CONFIG_DIR)"; \
763 $(TOPDIR)/support/scripts/graph-depends $(BR2_GRAPH_DEPS_OPTS) \
764 --direct -o $(GRAPHS_DIR)/$(@).dot
765 dot $(BR2_GRAPH_DOT_OPTS) -T$(BR_GRAPH_OUT) \
766 -o $(GRAPHS_DIR)/$(@).$(BR_GRAPH_OUT) \
767 $(GRAPHS_DIR)/$(@).dot
769 graph-size:
770 $(Q)mkdir -p $(GRAPHS_DIR)
771 $(Q)$(TOPDIR)/support/scripts/size-stats --builddir $(BASE_DIR) \
772 --graph $(GRAPHS_DIR)/graph-size.$(BR_GRAPH_OUT) \
773 --file-size-csv $(GRAPHS_DIR)/file-size-stats.csv \
774 --package-size-csv $(GRAPHS_DIR)/package-size-stats.csv
776 check-dependencies:
777 @cd "$(CONFIG_DIR)"; \
778 $(TOPDIR)/support/scripts/graph-depends -C
780 else # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
782 all: menuconfig
784 endif # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
786 # configuration
787 # ---------------------------------------------------------------------------
789 HOSTCFLAGS = $(CFLAGS_FOR_BUILD)
790 export HOSTCFLAGS
792 .PHONY: prepare-kconfig
793 prepare-kconfig: outputmakefile $(BUILD_DIR)/.br2-external.in
795 $(BUILD_DIR)/buildroot-config/%onf:
796 mkdir -p $(@D)/lxdialog
797 PKG_CONFIG_PATH="$(HOST_PKG_CONFIG_PATH)" $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" \
798 obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)
800 DEFCONFIG = $(call qstrip,$(BR2_DEFCONFIG))
802 # We don't want to fully expand BR2_DEFCONFIG here, so Kconfig will
803 # recognize that if it's still at its default $(CONFIG_DIR)/defconfig
804 COMMON_CONFIG_ENV = \
805 BR2_DEFCONFIG='$(call qstrip,$(value BR2_DEFCONFIG))' \
806 KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
807 KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
808 KCONFIG_TRISTATE=$(BUILD_DIR)/buildroot-config/tristate.config \
809 BR2_CONFIG=$(BR2_CONFIG) \
810 HOST_GCC_VERSION="$(HOSTCC_VERSION)" \
811 BUILD_DIR=$(BUILD_DIR) \
812 SKIP_LEGACY=
814 xconfig: $(BUILD_DIR)/buildroot-config/qconf prepare-kconfig
815 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
817 gconfig: $(BUILD_DIR)/buildroot-config/gconf prepare-kconfig
818 @$(COMMON_CONFIG_ENV) srctree=$(TOPDIR) $< $(CONFIG_CONFIG_IN)
820 menuconfig: $(BUILD_DIR)/buildroot-config/mconf prepare-kconfig
821 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
823 nconfig: $(BUILD_DIR)/buildroot-config/nconf prepare-kconfig
824 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
826 config: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
827 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
829 # For the config targets that automatically select options, we pass
830 # SKIP_LEGACY=y to disable the legacy options. However, in that case
831 # no values are set for the legacy options so a subsequent oldconfig
832 # will query them. Therefore, run an additional olddefconfig.
834 oldconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
835 @$(COMMON_CONFIG_ENV) $< --oldconfig $(CONFIG_CONFIG_IN)
837 randconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
838 @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y $< --randconfig $(CONFIG_CONFIG_IN)
839 @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
841 allyesconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
842 @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y $< --allyesconfig $(CONFIG_CONFIG_IN)
843 @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
845 allnoconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
846 @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y $< --allnoconfig $(CONFIG_CONFIG_IN)
847 @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
849 randpackageconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
850 @grep -v BR2_PACKAGE_ $(BR2_CONFIG) > $(CONFIG_DIR)/.config.nopkg
851 @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y \
852 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
853 $< --randconfig $(CONFIG_CONFIG_IN)
854 @rm -f $(CONFIG_DIR)/.config.nopkg
855 @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
857 allyespackageconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
858 @grep -v BR2_PACKAGE_ $(BR2_CONFIG) > $(CONFIG_DIR)/.config.nopkg
859 @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y \
860 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
861 $< --allyesconfig $(CONFIG_CONFIG_IN)
862 @rm -f $(CONFIG_DIR)/.config.nopkg
863 @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
865 allnopackageconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
866 @grep -v BR2_PACKAGE_ $(BR2_CONFIG) > $(CONFIG_DIR)/.config.nopkg
867 @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y \
868 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
869 $< --allnoconfig $(CONFIG_CONFIG_IN)
870 @rm -f $(CONFIG_DIR)/.config.nopkg
871 @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
873 silentoldconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
874 $(COMMON_CONFIG_ENV) $< --silentoldconfig $(CONFIG_CONFIG_IN)
876 olddefconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
877 $(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN)
879 defconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
880 @$(COMMON_CONFIG_ENV) $< --defconfig$(if $(DEFCONFIG),=$(DEFCONFIG)) $(CONFIG_CONFIG_IN)
882 define percent_defconfig
883 # Override the BR2_DEFCONFIG from COMMON_CONFIG_ENV with the new defconfig
884 %_defconfig: $(BUILD_DIR)/buildroot-config/conf $(1)/configs/%_defconfig prepare-kconfig
885 @$$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$(1)/configs/$$@ \
886 $$< --defconfig=$(1)/configs/$$@ $$(CONFIG_CONFIG_IN)
887 endef
888 $(eval $(foreach d,$(call reverse,$(TOPDIR) $(BR2_EXTERNAL_DIRS)),$(call percent_defconfig,$(d))$(sep)))
890 savedefconfig: $(BUILD_DIR)/buildroot-config/conf prepare-kconfig
891 @$(COMMON_CONFIG_ENV) $< \
892 --savedefconfig=$(if $(DEFCONFIG),$(DEFCONFIG),$(CONFIG_DIR)/defconfig) \
893 $(CONFIG_CONFIG_IN)
894 @$(SED) '/BR2_DEFCONFIG=/d' $(if $(DEFCONFIG),$(DEFCONFIG),$(CONFIG_DIR)/defconfig)
896 .PHONY: defconfig savedefconfig
898 ################################################################################
900 # Cleanup and misc junk
902 ################################################################################
904 # outputmakefile generates a Makefile in the output directory, if using a
905 # separate output directory. This allows convenient use of make in the
906 # output directory.
907 outputmakefile:
908 ifeq ($(NEED_WRAPPER),y)
909 $(Q)$(TOPDIR)/support/scripts/mkmakefile $(TOPDIR) $(O)
910 endif
912 # Even though the target is a real file, we mark it as PHONY as we
913 # want it to be re-generated each time make is invoked, in case the
914 # value of BR2_EXTERNAL is changed.
915 .PHONY: $(BUILD_DIR)/.br2-external.in
916 $(BUILD_DIR)/.br2-external.in: $(BUILD_DIR)
917 $(Q)support/scripts/br2-external -k -o "$(@)" $(BR2_EXTERNAL)
919 # printvars prints all the variables currently defined in our
920 # Makefiles. Alternatively, if a non-empty VARS variable is passed,
921 # only the variables matching the make pattern passed in VARS are
922 # displayed.
923 printvars:
924 @$(foreach V, \
925 $(sort $(if $(VARS),$(filter $(VARS),$(.VARIABLES)),$(.VARIABLES))), \
926 $(if $(filter-out environment% default automatic, \
927 $(origin $V)), \
928 $(info $V=$($V) ($(value $V)))))
930 clean:
931 rm -rf $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
932 $(BUILD_DIR) $(BASE_DIR)/staging \
933 $(LEGAL_INFO_DIR) $(GRAPHS_DIR)
935 distclean: clean
936 ifeq ($(O),output)
937 rm -rf $(O)
938 endif
939 rm -rf $(TOPDIR)/dl $(BR2_CONFIG) $(CONFIG_DIR)/.config.old $(CONFIG_DIR)/..config.tmp \
940 $(CONFIG_DIR)/.auto.deps $(BR2_EXTERNAL_FILE)
942 help:
943 @echo 'Cleaning:'
944 @echo ' clean - delete all files created by build'
945 @echo ' distclean - delete all non-source files (including .config)'
946 @echo
947 @echo 'Build:'
948 @echo ' all - make world'
949 @echo ' toolchain - build toolchain'
950 @echo
951 @echo 'Configuration:'
952 @echo ' menuconfig - interactive curses-based configurator'
953 @echo ' nconfig - interactive ncurses-based configurator'
954 @echo ' xconfig - interactive Qt-based configurator'
955 @echo ' gconfig - interactive GTK-based configurator'
956 @echo ' oldconfig - resolve any unresolved symbols in .config'
957 @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps'
958 @echo ' olddefconfig - Same as silentoldconfig but sets new symbols to their default value'
959 @echo ' randconfig - New config with random answer to all options'
960 @echo ' defconfig - New config with default answer to all options'
961 @echo ' BR2_DEFCONFIG, if set, is used as input'
962 @echo ' savedefconfig - Save current config to BR2_DEFCONFIG (minimal config)'
963 @echo ' allyesconfig - New config where all options are accepted with yes'
964 @echo ' allnoconfig - New config where all options are answered with no'
965 @echo ' randpackageconfig - New config with random answer to package options'
966 @echo ' allyespackageconfig - New config where pkg options are accepted with yes'
967 @echo ' allnopackageconfig - New config where package options are answered with no'
968 @echo
969 @echo 'Package-specific:'
970 @echo ' <pkg> - Build and install <pkg> and all its dependencies'
971 @echo ' <pkg>-source - Only download the source files for <pkg>'
972 @echo ' <pkg>-extract - Extract <pkg> sources'
973 @echo ' <pkg>-patch - Apply patches to <pkg>'
974 @echo ' <pkg>-depends - Build <pkg>'\''s dependencies'
975 @echo ' <pkg>-configure - Build <pkg> up to the configure step'
976 @echo ' <pkg>-build - Build <pkg> up to the build step'
977 @echo ' <pkg>-show-depends - List packages on which <pkg> depends'
978 @echo ' <pkg>-show-rdepends - List packages which have <pkg> as a dependency'
979 @echo ' <pkg>-graph-depends - Generate a graph of <pkg>'\''s dependencies'
980 @echo ' <pkg>-graph-rdepends - Generate a graph of <pkg>'\''s reverse dependencies'
981 @echo ' <pkg>-dirclean - Remove <pkg> build directory'
982 @echo ' <pkg>-reconfigure - Restart the build from the configure step'
983 @echo ' <pkg>-rebuild - Restart the build from the build step'
984 $(foreach p,$(HELP_PACKAGES), \
985 @echo $(sep) \
986 @echo '$($(p)_NAME):' $(sep) \
987 $($(p)_HELP_CMDS)$(sep))
988 @echo
989 @echo 'Documentation:'
990 @echo ' manual - build manual in all formats'
991 @echo ' manual-html - build manual in HTML'
992 @echo ' manual-split-html - build manual in split HTML'
993 @echo ' manual-pdf - build manual in PDF'
994 @echo ' manual-text - build manual in text'
995 @echo ' manual-epub - build manual in ePub'
996 @echo ' graph-build - generate graphs of the build times'
997 @echo ' graph-depends - generate graph of the dependency tree'
998 @echo ' graph-size - generate stats of the filesystem size'
999 @echo ' list-defconfigs - list all defconfigs (pre-configured minimal systems)'
1000 @echo
1001 @echo 'Miscellaneous:'
1002 @echo ' source - download all sources needed for offline-build'
1003 @echo ' source-check - check selected packages for valid download URLs'
1004 @echo ' external-deps - list external packages used'
1005 @echo ' legal-info - generate info about license compliance'
1006 @echo
1007 @echo ' make V=0|1 - 0 => quiet build (default), 1 => verbose build'
1008 @echo ' make O=dir - Locate all output files in "dir", including .config'
1009 @echo
1010 @echo 'For further details, see README, generate the Buildroot manual, or consult'
1011 @echo 'it on-line at http://buildroot.org/docs.html'
1012 @echo
1014 # List the defconfig files
1015 # $(1): base directory
1016 # $(2): br2-external name, empty for bundled
1017 define list-defconfigs
1018 @first=true; \
1019 for defconfig in $(1)/configs/*_defconfig; do \
1020 [ -f "$${defconfig}" ] || continue; \
1021 if $${first}; then \
1022 if [ "$(2)" ]; then \
1023 printf 'External configs in "$(call qstrip,$(2))":\n'; \
1024 else \
1025 printf "Built-in configs:\n"; \
1026 fi; \
1027 first=false; \
1028 fi; \
1029 defconfig="$${defconfig##*/}"; \
1030 printf " %-35s - Build for %s\n" "$${defconfig}" "$${defconfig%_defconfig}"; \
1031 done; \
1032 $${first} || printf "\n"
1033 endef
1035 # We iterate over BR2_EXTERNAL_NAMES rather than BR2_EXTERNAL_DIRS,
1036 # because we want to display the name of the br2-external tree.
1037 list-defconfigs:
1038 $(call list-defconfigs,$(TOPDIR))
1039 $(foreach name,$(BR2_EXTERNAL_NAMES),\
1040 $(call list-defconfigs,$(BR2_EXTERNAL_$(name)_PATH),\
1041 $(BR2_EXTERNAL_$(name)_DESC))$(sep))
1043 release: OUT = buildroot-$(BR2_VERSION)
1045 # Create release tarballs. We need to fiddle a bit to add the generated
1046 # documentation to the git output
1047 release:
1048 git archive --format=tar --prefix=$(OUT)/ HEAD > $(OUT).tar
1049 $(MAKE) O=$(OUT) manual-html manual-text manual-pdf
1050 $(MAKE) O=$(OUT) manual-clean
1051 tar rf $(OUT).tar $(OUT)
1052 gzip -9 -c < $(OUT).tar > $(OUT).tar.gz
1053 bzip2 -9 -c < $(OUT).tar > $(OUT).tar.bz2
1054 rm -rf $(OUT) $(OUT).tar
1056 print-version:
1057 @echo $(BR2_VERSION_FULL)
1059 include docs/manual/manual.mk
1060 -include $(foreach dir,$(BR2_EXTERNAL_DIRS),$(dir)/docs/*/*.mk)
1062 .PHONY: $(noconfig_targets)
1064 endif #umask / $(CURDIR) / $(O)