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