1 # Makefile for buildroot2
3 # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4 # Copyright (C) 2006-2013 by the Buildroot developers <buildroot@uclibc.org>
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #--------------------------------------------------------------
22 # Just run 'make menuconfig', configure stuff, then run 'make'.
23 # You shouldn't need to mess with anything beyond this point...
24 #--------------------------------------------------------------
26 # Set and export the version string
27 export BR2_VERSION:=2013.08-rc1
29 # Check for minimal make version (note: this check will break at make 10.x)
31 ifneq ($(firstword $(sort $(MAKE_VERSION) $(MIN_MAKE_VERSION))),$(MIN_MAKE_VERSION))
32 $(error You have make '$(MAKE_VERSION)' installed. GNU make >= $(MIN_MAKE_VERSION) is required)
35 export HOSTARCH := $(shell uname -m | \
45 # This top-level Makefile can *not* be executed in parallel
50 CONFIG_CONFIG_IN=Config.in
51 CONFIG=support/kconfig
52 DATE:=$(shell date +%Y%m%d)
54 # Compute the full local version string so packages can use it as-is
55 # Need to export it, so it can be got from environment in children (eg. mconf)
56 export BR2_VERSION_FULL:=$(BR2_VERSION)$(shell $(TOPDIR)/support/scripts/setlocalversion)
58 noconfig_targets:=menuconfig nconfig gconfig xconfig config oldconfig randconfig \
59 %_defconfig allyesconfig allnoconfig silentoldconfig release \
60 randpackageconfig allyespackageconfig allnopackageconfig \
61 source-check print-version olddefconfig
63 # Strip quotes and then whitespaces
64 qstrip=$(strip $(subst ",,$(1)))
67 # Variables for use in Make constructs
70 space:=$(empty) $(empty)
72 ifneq ("$(origin O)", "command line")
77 # other packages might also support Linux-style out of tree builds
78 # with the O=<dir> syntax (E.G. Busybox does). As make automatically
79 # forwards command line variable definitions those packages get very
80 # confused. Fix this by telling make to not do so
82 # strangely enough O is still passed to submakes with MAKEOVERRIDES
83 # (with make 3.81 atleast), the only thing that changes is the output
84 # of the origin function (command line -> environment).
85 # Unfortunately some packages don't look at origin (E.G. uClibc 0.9.31+)
86 # To really make O go away, we have to override it.
89 # we need to pass O= everywhere we call back into the toplevel makefile
90 EXTRAMAKEARGS = O=$(O)
94 BUILDROOT_CONFIG=$(CONFIG_DIR)/.config
96 # Pull in the user's configuration file
97 ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
98 -include $(BUILDROOT_CONFIG)
101 # To put more focus on warnings, be less verbose as default
102 # Use 'make V=1' to see the full commands
104 ifeq ("$(origin V)", "command line")
108 ifndef KBUILD_VERBOSE
112 ifeq ($(KBUILD_VERBOSE),1)
123 # we want bash as shell
124 SHELL:=$(shell if [ -x "$$BASH" ]; then echo $$BASH; \
125 else if [ -x /bin/bash ]; then echo /bin/bash; \
126 else echo sh; fi; fi)
128 # kconfig uses CONFIG_SHELL
129 CONFIG_SHELL:=$(SHELL)
131 export SHELL CONFIG_SHELL quiet Q KBUILD_VERBOSE VERBOSE
141 HOSTCC:=$(shell which $(HOSTCC) || type -p $(HOSTCC) || echo gcc)
143 HOSTCC_NOCCACHE:=$(HOSTCC)
146 HOSTCXX:=$(shell which $(HOSTCXX) || type -p $(HOSTCXX) || echo g++)
148 HOSTCXX_NOCCACHE:=$(HOSTCXX)
164 HOSTAR:=$(shell which $(HOSTAR) || type -p $(HOSTAR) || echo ar)
165 HOSTAS:=$(shell which $(HOSTAS) || type -p $(HOSTAS) || echo as)
166 HOSTFC:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo || which g77 || type -p g77 || echo gfortran)
167 HOSTCPP:=$(shell which $(HOSTCPP) || type -p $(HOSTCPP) || echo cpp)
168 HOSTLD:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo ld)
169 HOSTLN:=$(shell which $(HOSTLN) || type -p $(HOSTLN) || echo ln)
170 HOSTNM:=$(shell which $(HOSTNM) || type -p $(HOSTNM) || echo nm)
172 export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD
173 export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE
175 # Make sure pkg-config doesn't look outside the buildroot tree
176 unexport PKG_CONFIG_PATH
177 unexport PKG_CONFIG_SYSROOT_DIR
179 # Having DESTDIR set in the environment confuses the installation
180 # steps of some packages.
183 # Causes breakage with packages that needs host-ruby
186 # bash prints the name of the directory on 'cd <dir>' if CDPATH is
187 # set, so unset it here to not cause problems. Notice that the export
188 # line doesn't affect the environment of $(shell ..) calls, so
189 # explictly throw away any output from 'cd' here.
191 BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && pwd)
192 $(if $(BASE_DIR),, $(error output directory "$(O)" does not exist))
194 BUILD_DIR:=$(BASE_DIR)/build
197 ifeq ($(BR2_HAVE_DOT_CONFIG),y)
199 ################################################################################
201 # Hide troublesome environment variables from sub processes
203 ################################################################################
204 unexport CROSS_COMPILE
211 unexport GREP_OPTIONS
216 GNU_HOST_NAME:=$(shell support/gnuconfig/config.guess)
218 ################################################################################
220 # The list of stuff to build for the target toolchain
221 # along with the packages to build for the target.
223 ################################################################################
225 ifeq ($(BR2_CCACHE),y)
226 BASE_TARGETS += host-ccache
229 ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
230 BASE_TARGETS += toolchain-buildroot
231 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
232 BASE_TARGETS += toolchain-external
233 else ifeq ($(BR2_TOOLCHAIN_CTNG),y)
234 BASE_TARGETS += toolchain-crosstool-ng
239 # silent mode requested?
240 QUIET:=$(if $(findstring s,$(MAKEFLAGS)),-q)
242 # Strip off the annoying quoting
243 ARCH:=$(call qstrip,$(BR2_ARCH))
245 KERNEL_ARCH:=$(shell echo "$(ARCH)" | sed -e "s/-.*//" \
246 -e s/i.86/i386/ -e s/sun4u/sparc64/ \
249 -e s/arm.*/arm/ -e s/sa110/arm/ \
250 -e s/aarch64/arm64/ \
251 -e s/bfin/blackfin/ \
252 -e s/parisc64/parisc/ \
253 -e s/powerpc64/powerpc/ \
254 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
257 ZCAT:=$(call qstrip,$(BR2_ZCAT))
258 BZCAT:=$(call qstrip,$(BR2_BZCAT))
259 XZCAT:=$(call qstrip,$(BR2_XZCAT))
260 TAR_OPTIONS=$(call qstrip,$(BR2_TAR_OPTIONS)) -xf
262 # packages compiled for the host go here
263 HOST_DIR:=$(call qstrip,$(BR2_HOST_DIR))
265 # locales to generate
266 GENERATE_LOCALE=$(call qstrip,$(BR2_GENERATE_LOCALE))
268 # stamp (dependency) files go here
269 STAMP_DIR:=$(BASE_DIR)/stamps
271 BINARIES_DIR:=$(BASE_DIR)/images
272 TARGET_DIR:=$(BASE_DIR)/target
273 TARGET_SKELETON=$(TOPDIR)/system/skeleton
275 LEGAL_INFO_DIR=$(BASE_DIR)/legal-info
276 REDIST_SOURCES_DIR=$(LEGAL_INFO_DIR)/sources
277 LICENSE_FILES_DIR=$(LEGAL_INFO_DIR)/licenses
278 LEGAL_MANIFEST_CSV=$(LEGAL_INFO_DIR)/manifest.csv
279 LEGAL_LICENSES_TXT=$(LEGAL_INFO_DIR)/licenses.txt
280 LEGAL_WARNINGS=$(LEGAL_INFO_DIR)/.warnings
281 LEGAL_REPORT=$(LEGAL_INFO_DIR)/README
283 # Location of a file giving a big fat warning that output/target
284 # should not be used as the root filesystem.
285 TARGET_DIR_WARNING_FILE=$(TARGET_DIR)/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
287 ifeq ($(BR2_CCACHE),y)
288 CCACHE:=$(HOST_DIR)/usr/bin/ccache
289 BUILDROOT_CACHE_DIR = $(call qstrip,$(BR2_CCACHE_DIR))
290 export BUILDROOT_CACHE_DIR
291 HOSTCC := $(CCACHE) $(HOSTCC)
292 HOSTCXX := $(CCACHE) $(HOSTCXX)
295 # Scripts in support/ or post-build scripts may need to reference
296 # these locations, so export them so it is easier to use
297 export BUILDROOT_CONFIG
304 ################################################################################
306 # You should probably leave this stuff alone unless you know
307 # what you are doing.
309 ################################################################################
313 # Include legacy before the other things, because package .mk files
315 ifneq ($(BR2_DEPRECATED),y)
316 include Makefile.legacy
319 include package/Makefile.in
320 include support/dependencies/dependencies.mk
322 # We also need the various per-package makefiles, which also add
323 # each selected package to TARGETS if that package was selected
324 # in the .config file.
325 ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
326 include toolchain/toolchain-buildroot.mk
327 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
328 include toolchain/toolchain-external.mk
329 else ifeq ($(BR2_TOOLCHAIN_CTNG),y)
330 include toolchain/toolchain-crosstool-ng.mk
333 # Include the package override file if one has been provided in the
335 PACKAGE_OVERRIDE_FILE=$(call qstrip,$(BR2_PACKAGE_OVERRIDE_FILE))
336 ifneq ($(PACKAGE_OVERRIDE_FILE),)
337 -include $(PACKAGE_OVERRIDE_FILE)
340 include package/*/*.mk
342 include boot/common.mk
343 include linux/linux.mk
344 include system/system.mk
346 TARGETS+=target-finalize
348 ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
349 TARGETS+=target-purgelocales
352 ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),y)
353 ifneq ($(GENERATE_LOCALE),)
354 TARGETS+=target-generatelocales
358 ifeq ($(BR2_ECLIPSE_REGISTER),y)
359 TARGETS+=toolchain-eclipse-register
364 TARGETS+=target-post-image
366 TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
367 TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS) $(BASE_TARGETS))
368 TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
369 TARGETS_ALL:=$(patsubst %,__real_tgt_%,$(TARGETS))
371 # host-* dependencies have to be handled specially, as those aren't
372 # visible in Kconfig and hence not added to a variable like TARGETS.
373 # instead, find all the host-* targets listed in each <PKG>_DEPENDENCIES
374 # variable for each enabled target.
375 # Notice: this only works for newstyle gentargets/autotargets packages
376 TARGETS_HOST_DEPS = $(sort $(filter host-%,$(foreach dep,\
377 $(addsuffix _DEPENDENCIES,$(call UPPERCASE,$(TARGETS))),\
379 # Host packages can in turn have their own dependencies. Likewise find
380 # all the package names listed in the HOST_<PKG>_DEPENDENCIES for each
381 # host package found above. Ideally this should be done recursively until
382 # no more packages are found, but that's hard to do in make, so limit to
384 HOST_DEPS = $(sort $(foreach dep,\
385 $(addsuffix _DEPENDENCIES,$(call UPPERCASE,$(TARGETS_HOST_DEPS))),\
387 HOST_SOURCE += $(addsuffix -source,$(sort $(TARGETS_HOST_DEPS) $(HOST_DEPS)))
389 TARGETS_LEGAL_INFO:=$(patsubst %,%-legal-info,\
390 $(TARGETS) $(BASE_TARGETS) $(TARGETS_HOST_DEPS) $(HOST_DEPS))))
392 # all targets depend on the crosscompiler and it's prerequisites
393 $(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) %
395 dirs: $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
396 $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR)
398 $(BASE_TARGETS): dirs $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake
400 $(BUILD_DIR)/buildroot-config/auto.conf: $(BUILDROOT_CONFIG)
401 $(MAKE) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig
403 prepare: $(BUILD_DIR)/buildroot-config/auto.conf
405 toolchain: prepare dirs dependencies $(BASE_TARGETS)
407 world: toolchain $(TARGETS_ALL)
409 .PHONY: all world toolchain dirs clean distclean source outputmakefile \
410 legal-info legal-info-prepare legal-info-clean printvars \
411 $(BASE_TARGETS) $(TARGETS) $(TARGETS_ALL) \
412 $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) $(TARGETS_LEGAL_INFO) \
413 $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
414 $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR)
416 ################################################################################
418 # staging and target directories do NOT list these as
419 # dependencies anywhere else
421 ################################################################################
422 $(BUILD_DIR) $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR) $(LEGAL_INFO_DIR) $(REDIST_SOURCES_DIR):
426 @mkdir -p $(STAGING_DIR)/bin
427 @mkdir -p $(STAGING_DIR)/lib
428 @mkdir -p $(STAGING_DIR)/usr/lib
429 @mkdir -p $(STAGING_DIR)/usr/include
430 @mkdir -p $(STAGING_DIR)/usr/bin
431 @ln -snf $(STAGING_DIR) $(BASE_DIR)/staging
433 ifeq ($(BR2_ROOTFS_SKELETON_CUSTOM),y)
434 TARGET_SKELETON=$(BR2_ROOTFS_SKELETON_CUSTOM_PATH)
438 mkdir -p $(TARGET_DIR)
440 --exclude .empty --exclude .svn --exclude .git \
441 --exclude .hg --exclude=CVS --exclude '*~' \
442 $(TARGET_SKELETON)/ $(TARGET_DIR)/
443 cp support/misc/target-dir-warning.txt $(TARGET_DIR_WARNING_FILE)
446 $(TARGET_DIR): $(BUILD_DIR)/.root
448 STRIP_FIND_CMD = find $(TARGET_DIR)
449 ifneq (,$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS)))
450 STRIP_FIND_CMD += \( $(call finddirclauses,$(TARGET_DIR),$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS))) \) -prune -o
452 STRIP_FIND_CMD += -type f -perm /111
453 STRIP_FIND_CMD += -not \( $(call findfileclauses,libpthread*.so* $(call qstrip,$(BR2_STRIP_EXCLUDE_FILES))) \) -print
456 rm -rf $(TARGET_DIR)/usr/include $(TARGET_DIR)/usr/share/aclocal \
457 $(TARGET_DIR)/usr/lib/pkgconfig $(TARGET_DIR)/usr/share/pkgconfig \
458 $(TARGET_DIR)/usr/lib/cmake $(TARGET_DIR)/usr/share/cmake
459 find $(TARGET_DIR)/usr/{lib,share}/ -name '*.cmake' -print0 | xargs -0 rm -f
460 find $(TARGET_DIR)/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
461 find $(TARGET_DIR)/usr/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
462 ifneq ($(BR2_PACKAGE_GDB),y)
463 rm -rf $(TARGET_DIR)/usr/share/gdb
465 ifneq ($(BR2_HAVE_DOCUMENTATION),y)
466 rm -rf $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/man
467 rm -rf $(TARGET_DIR)/usr/info $(TARGET_DIR)/usr/share/info
468 rm -rf $(TARGET_DIR)/usr/doc $(TARGET_DIR)/usr/share/doc
469 rm -rf $(TARGET_DIR)/usr/share/gtk-doc
470 -rmdir $(TARGET_DIR)/usr/share 2>/dev/null
472 ifeq ($(BR2_PACKAGE_PYTHON_PY_ONLY),y)
473 find $(TARGET_DIR)/usr/lib/ -name '*.pyc' -print0 | xargs -0 rm -f
475 ifeq ($(BR2_PACKAGE_PYTHON_PYC_ONLY),y)
476 find $(TARGET_DIR)/usr/lib/ -name '*.py' -print0 | xargs -0 rm -f
478 $(STRIP_FIND_CMD) | xargs $(STRIPCMD) 2>/dev/null || true
479 find $(TARGET_DIR)/lib/modules -type f -name '*.ko' | \
480 xargs -r $(KSTRIPCMD) || true
482 # See http://sourceware.org/gdb/wiki/FAQ, "GDB does not see any threads
483 # besides the one in which crash occurred; or SIGTRAP kills my program when
484 # I set a breakpoint"
485 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
486 find $(TARGET_DIR)/lib -type f -name 'libpthread*.so*' | \
487 xargs $(STRIPCMD) $(STRIP_STRIP_DEBUG) || true
490 mkdir -p $(TARGET_DIR)/etc
491 # Mandatory configuration file and auxilliary cache directory
492 # for recent versions of ldconfig
493 touch $(TARGET_DIR)/etc/ld.so.conf
494 mkdir -p $(TARGET_DIR)/var/cache/ldconfig
495 if [ -x "$(TARGET_CROSS)ldconfig" ]; \
497 $(TARGET_CROSS)ldconfig -r $(TARGET_DIR); \
499 /sbin/ldconfig -r $(TARGET_DIR); \
502 echo "NAME=Buildroot"; \
503 echo "VERSION=$(BR2_VERSION_FULL)"; \
504 echo "ID=buildroot"; \
505 echo "VERSION_ID=$(BR2_VERSION)"; \
506 echo "PRETTY_NAME=\"Buildroot $(BR2_VERSION)\"" \
507 ) > $(TARGET_DIR)/etc/os-release
509 @$(foreach d, $(call qstrip,$(BR2_ROOTFS_OVERLAY)), \
510 $(call MESSAGE,"Copying overlay $(d)"); \
512 --exclude .empty --exclude .svn --exclude .git \
513 --exclude .hg --exclude=CVS --exclude '*~' \
514 $(d)/ $(TARGET_DIR)$(sep))
516 @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_BUILD_SCRIPT)), \
517 $(call MESSAGE,"Executing post-build script $(s)"); \
518 $(s) $(TARGET_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
520 ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
521 LOCALE_WHITELIST=$(BUILD_DIR)/locales.nopurge
522 LOCALE_NOPURGE=$(call qstrip,$(BR2_ENABLE_LOCALE_WHITELIST))
525 rm -f $(LOCALE_WHITELIST)
526 for i in $(LOCALE_NOPURGE); do echo $$i >> $(LOCALE_WHITELIST); done
528 for dir in $(wildcard $(addprefix $(TARGET_DIR),/usr/share/locale /usr/share/X11/locale /usr/man /usr/share/man)); \
530 for lang in $$(cd $$dir; ls .|grep -v man); \
532 grep -qx $$lang $(LOCALE_WHITELIST) || rm -rf $$dir/$$lang; \
537 ifneq ($(GENERATE_LOCALE),)
538 # Generate locale data. Basically, we call the localedef program
539 # (built by the host-localedef package) for each locale. The input
540 # data comes preferably from the toolchain, or if the toolchain does
541 # not have them (Linaro toolchains), we use the ones available on the
543 target-generatelocales: host-localedef
544 $(Q)mkdir -p $(TARGET_DIR)/usr/lib/locale/
545 $(Q)for locale in $(GENERATE_LOCALE) ; do \
546 inputfile=`echo $${locale} | cut -f1 -d'.'` ; \
547 charmap=`echo $${locale} | cut -f2 -d'.'` ; \
548 if test -z "$${charmap}" ; then \
551 echo "Generating locale $${inputfile}.$${charmap}" ; \
552 I18NPATH=$(STAGING_DIR)/usr/share/i18n:/usr/share/i18n \
553 $(HOST_DIR)/usr/bin/localedef \
554 --prefix=$(TARGET_DIR) \
555 --`echo $(BR2_ENDIAN) | tr [A-Z] [a-z]`-endian \
556 -i $${inputfile} -f $${charmap} \
562 @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_IMAGE_SCRIPT)), \
563 $(call MESSAGE,"Executing post-image script $(s)"); \
564 $(s) $(BINARIES_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
566 toolchain-eclipse-register:
567 ./support/scripts/eclipse-register-toolchain `readlink -f $(O)` $(notdir $(TARGET_CROSS)) $(BR2_ARCH)
569 source: dirs $(TARGETS_SOURCE) $(HOST_SOURCE)
572 @$(MAKE) -Bs DL_MODE=SHOW_EXTERNAL_DEPS $(EXTRAMAKEARGS) source | sort -u
575 @rm -fr $(LEGAL_INFO_DIR)
577 legal-info-prepare: $(LEGAL_INFO_DIR)
578 @$(call MESSAGE,"Collecting legal info")
579 @$(call legal-license-file,buildroot,COPYING,COPYING)
580 @$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE)
581 @$(call legal-manifest,buildroot,$(BR2_VERSION_FULL),GPLv2+,COPYING,not saved)
582 @$(call legal-warning,the Buildroot source code has not been saved)
583 @$(call legal-warning,the toolchain has not been saved)
584 @cp $(BUILDROOT_CONFIG) $(LEGAL_INFO_DIR)/buildroot.config
586 legal-info: dirs legal-info-clean legal-info-prepare $(REDIST_SOURCES_DIR) \
587 $(TARGETS_LEGAL_INFO)
588 @cat support/legal-info/README.header >>$(LEGAL_REPORT)
589 @if [ -r $(LEGAL_WARNINGS) ]; then \
590 cat support/legal-info/README.warnings-header \
591 $(LEGAL_WARNINGS) >>$(LEGAL_REPORT); \
592 cat $(LEGAL_WARNINGS); fi
593 @echo "Legal info produced in $(LEGAL_INFO_DIR)"
594 @rm -f $(LEGAL_WARNINGS)
599 else # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
603 endif # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
606 # ---------------------------------------------------------------------------
608 HOSTCFLAGS=$(CFLAGS_FOR_BUILD)
611 $(BUILD_DIR)/buildroot-config/%onf:
612 mkdir -p $(@D)/lxdialog
613 $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)
615 DEFCONFIG = $(call qstrip,$(BR2_DEFCONFIG))
617 # We don't want to fully expand BR2_DEFCONFIG here, so Kconfig will
618 # recognize that if it's still at its default $(CONFIG_DIR)/defconfig
619 COMMON_CONFIG_ENV = \
620 BR2_DEFCONFIG='$(call qstrip,$(value BR2_DEFCONFIG))' \
621 KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
622 KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
623 KCONFIG_TRISTATE=$(BUILD_DIR)/buildroot-config/tristate.config \
624 BUILDROOT_CONFIG=$(BUILDROOT_CONFIG)
626 xconfig: $(BUILD_DIR)/buildroot-config/qconf outputmakefile
627 @mkdir -p $(BUILD_DIR)/buildroot-config
628 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
630 gconfig: $(BUILD_DIR)/buildroot-config/gconf outputmakefile
631 @mkdir -p $(BUILD_DIR)/buildroot-config
632 @$(COMMON_CONFIG_ENV) srctree=$(TOPDIR) $< $(CONFIG_CONFIG_IN)
634 menuconfig: $(BUILD_DIR)/buildroot-config/mconf outputmakefile
635 @mkdir -p $(BUILD_DIR)/buildroot-config
636 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
638 nconfig: $(BUILD_DIR)/buildroot-config/nconf outputmakefile
639 @mkdir -p $(BUILD_DIR)/buildroot-config
640 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
642 config: $(BUILD_DIR)/buildroot-config/conf outputmakefile
643 @mkdir -p $(BUILD_DIR)/buildroot-config
644 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
646 oldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
647 mkdir -p $(BUILD_DIR)/buildroot-config
648 @$(COMMON_CONFIG_ENV) $< --oldconfig $(CONFIG_CONFIG_IN)
650 randconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
651 @mkdir -p $(BUILD_DIR)/buildroot-config
652 @$(COMMON_CONFIG_ENV) $< --randconfig $(CONFIG_CONFIG_IN)
654 allyesconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
655 @mkdir -p $(BUILD_DIR)/buildroot-config
656 @$(COMMON_CONFIG_ENV) $< --allyesconfig $(CONFIG_CONFIG_IN)
658 allnoconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
659 @mkdir -p $(BUILD_DIR)/buildroot-config
660 @$(COMMON_CONFIG_ENV) $< --allnoconfig $(CONFIG_CONFIG_IN)
662 randpackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
663 @mkdir -p $(BUILD_DIR)/buildroot-config
664 @grep -v BR2_PACKAGE_ $(BUILDROOT_CONFIG) > $(CONFIG_DIR)/.config.nopkg
665 @grep '^config BR2_PACKAGE_' Config.in.legacy | \
666 while read config pkg; do \
667 echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
668 @$(COMMON_CONFIG_ENV) \
669 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
670 $< --randconfig $(CONFIG_CONFIG_IN)
671 @rm -f $(CONFIG_DIR)/.config.nopkg
673 allyespackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
674 @mkdir -p $(BUILD_DIR)/buildroot-config
675 @grep -v BR2_PACKAGE_ $(BUILDROOT_CONFIG) > $(CONFIG_DIR)/.config.nopkg
676 @grep '^config BR2_PACKAGE_' Config.in.legacy | \
677 while read config pkg; do \
678 echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
679 @$(COMMON_CONFIG_ENV) \
680 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
681 $< --allyesconfig $(CONFIG_CONFIG_IN)
682 @rm -f $(CONFIG_DIR)/.config.nopkg
684 allnopackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
685 @mkdir -p $(BUILD_DIR)/buildroot-config
686 @grep -v BR2_PACKAGE_ $(BUILDROOT_CONFIG) > $(CONFIG_DIR)/.config.nopkg
687 @$(COMMON_CONFIG_ENV) \
688 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
689 $< --allnoconfig $(CONFIG_CONFIG_IN)
690 @rm -f $(CONFIG_DIR)/.config.nopkg
692 silentoldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
693 @mkdir -p $(BUILD_DIR)/buildroot-config
694 $(COMMON_CONFIG_ENV) $< --silentoldconfig $(CONFIG_CONFIG_IN)
696 olddefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
697 @mkdir -p $(BUILD_DIR)/buildroot-config
698 $(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN)
700 defconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
701 @mkdir -p $(BUILD_DIR)/buildroot-config
702 @$(COMMON_CONFIG_ENV) $< --defconfig$(if $(DEFCONFIG),=$(DEFCONFIG)) $(CONFIG_CONFIG_IN)
704 %_defconfig: $(BUILD_DIR)/buildroot-config/conf $(TOPDIR)/configs/%_defconfig outputmakefile
705 @mkdir -p $(BUILD_DIR)/buildroot-config
706 @$(COMMON_CONFIG_ENV) $< --defconfig=$(TOPDIR)/configs/$@ $(CONFIG_CONFIG_IN)
708 savedefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
709 @mkdir -p $(BUILD_DIR)/buildroot-config
710 @$(COMMON_CONFIG_ENV) $< \
711 --savedefconfig=$(if $(DEFCONFIG),$(DEFCONFIG),$(CONFIG_DIR)/defconfig) \
714 # check if download URLs are outdated
716 $(MAKE) DL_MODE=SOURCE_CHECK $(EXTRAMAKEARGS) source
718 .PHONY: defconfig savedefconfig
720 ################################################################################
722 # Cleanup and misc junk
724 ################################################################################
726 # outputmakefile generates a Makefile in the output directory, if using a
727 # separate output directory. This allows convenient use of make in the
730 ifeq ($(NEED_WRAPPER),y)
731 $(Q)$(TOPDIR)/support/scripts/mkmakefile $(TOPDIR) $(O)
734 # printvars prints all the variables currently defined in our Makefiles
737 $(sort $(.VARIABLES)), \
738 $(if $(filter-out environment% default automatic, \
740 $(info $V=$($V) ($(value $V)))))
743 rm -rf $(STAGING_DIR) $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
744 $(STAMP_DIR) $(BUILD_DIR) $(BASE_DIR)/staging \
748 ifeq ($(DL_DIR),$(TOPDIR)/dl)
754 rm -rf $(BUILDROOT_CONFIG) $(CONFIG_DIR)/.config.old $(CONFIG_DIR)/.auto.deps
758 @echo ' clean - delete all files created by build'
759 @echo ' distclean - delete all non-source files (including .config)'
762 @echo ' all - make world'
763 @echo ' toolchain - build toolchain'
764 @echo ' <package>-rebuild - force recompile <package>'
765 @echo ' <package>-reconfigure - force reconfigure <package>'
767 @echo 'Configuration:'
768 @echo ' menuconfig - interactive curses-based configurator'
769 @echo ' nconfig - interactive ncurses-based configurator'
770 @echo ' xconfig - interactive Qt-based configurator'
771 @echo ' gconfig - interactive GTK-based configurator'
772 @echo ' oldconfig - resolve any unresolved symbols in .config'
773 @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps'
774 @echo ' olddefconfig - Same as silentoldconfig but sets new symbols to their default value'
775 @echo ' randconfig - New config with random answer to all options'
776 @echo ' defconfig - New config with default answer to all options'
777 @echo ' BR2_DEFCONFIG, if set, is used as input'
778 @echo ' savedefconfig - Save current config as ./defconfig (minimal config)'
779 @echo ' allyesconfig - New config where all options are accepted with yes'
780 @echo ' allnoconfig - New config where all options are answered with no'
781 @echo ' randpackageconfig - New config with random answer to package options'
782 @echo ' allyespackageconfig - New config where pkg options are accepted with yes'
783 @echo ' allnopackageconfig - New config where package options are answered with no'
784 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
785 @echo ' busybox-menuconfig - Run BusyBox menuconfig'
787 ifeq ($(BR2_LINUX_KERNEL),y)
788 @echo ' linux-menuconfig - Run Linux kernel menuconfig'
789 @echo ' linux-savedefconfig - Run Linux kernel savedefconfig'
791 ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
792 @echo ' uclibc-menuconfig - Run uClibc menuconfig'
794 ifeq ($(BR2_TOOLCHAIN_CTNG),y)
795 @echo ' ctng-menuconfig - Run crosstool-NG menuconfig'
797 ifeq ($(BR2_TARGET_BAREBOX),y)
798 @echo ' barebox-menuconfig - Run barebox menuconfig'
799 @echo ' barebox-savedefconfig - Run barebox savedefconfig'
802 @echo 'Documentation:'
803 @echo ' manual - build manual in HTML, split HTML, PDF and txt'
804 @echo ' manual-html - build manual in HTML'
805 @echo ' manual-split-html - build manual in split HTML'
806 @echo ' manual-pdf - build manual in PDF'
807 @echo ' manual-txt - build manual in txt'
808 @echo ' manual-epub - build manual in ePub'
810 @echo 'Miscellaneous:'
811 @echo ' source - download all sources needed for offline-build'
812 @echo ' source-check - check selected packages for valid download URLs'
813 @echo ' external-deps - list external packages used'
814 @echo ' legal-info - generate info about license compliance'
816 @echo ' make V=0|1 - 0 => quiet build (default), 1 => verbose build'
817 @echo ' make O=dir - Locate all output files in "dir", including .config'
819 @$(foreach b, $(sort $(notdir $(wildcard $(TOPDIR)/configs/*_defconfig))), \
820 printf " %-35s - Build for %s\\n" $(b) $(b:_defconfig=);)
822 @echo 'See docs/README, or generate the Buildroot manual for further details'
825 release: OUT=buildroot-$(BR2_VERSION)
827 # Create release tarballs. We need to fiddle a bit to add the generated
828 # documentation to the git output
830 git archive --format=tar --prefix=$(OUT)/ master > $(OUT).tar
831 $(MAKE) O=$(OUT) manual-html manual-txt manual-pdf
832 tar rf $(OUT).tar $(OUT)
833 gzip -9 -c < $(OUT).tar > $(OUT).tar.gz
834 bzip2 -9 -c < $(OUT).tar > $(OUT).tar.bz2
835 rm -rf $(OUT) $(OUT).tar
838 @echo $(BR2_VERSION_FULL)
840 include docs/manual/manual.mk
842 .PHONY: $(noconfig_targets)