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