1 # Makefile for buildroot
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.11-git
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 # bash prints the name of the directory on 'cd <dir>' if CDPATH is
95 # set, so unset it here to not cause problems. Notice that the export
96 # line doesn't affect the environment of $(shell ..) calls, so
97 # explictly throw away any output from 'cd' here.
99 BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && pwd)
100 $(if $(BASE_DIR),, $(error output directory "$(O)" does not exist))
102 BUILD_DIR:=$(BASE_DIR)/build
103 STAMP_DIR:=$(BASE_DIR)/stamps
104 BINARIES_DIR:=$(BASE_DIR)/images
105 TARGET_DIR:=$(BASE_DIR)/target
106 # initial definition so that 'make clean' works for most users, even without
107 # .config. HOST_DIR will be overwritten later when .config is included.
108 HOST_DIR:=$(BASE_DIR)/host
110 LEGAL_INFO_DIR=$(BASE_DIR)/legal-info
111 REDIST_SOURCES_DIR=$(LEGAL_INFO_DIR)/sources
112 LICENSE_FILES_DIR=$(LEGAL_INFO_DIR)/licenses
113 LEGAL_MANIFEST_CSV=$(LEGAL_INFO_DIR)/manifest.csv
114 LEGAL_LICENSES_TXT=$(LEGAL_INFO_DIR)/licenses.txt
115 LEGAL_WARNINGS=$(LEGAL_INFO_DIR)/.warnings
116 LEGAL_REPORT=$(LEGAL_INFO_DIR)/README
118 BUILDROOT_CONFIG=$(CONFIG_DIR)/.config
120 # Pull in the user's configuration file
121 ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
122 -include $(BUILDROOT_CONFIG)
125 # To put more focus on warnings, be less verbose as default
126 # Use 'make V=1' to see the full commands
128 ifeq ("$(origin V)", "command line")
132 ifndef KBUILD_VERBOSE
136 ifeq ($(KBUILD_VERBOSE),1)
147 # we want bash as shell
148 SHELL:=$(shell if [ -x "$$BASH" ]; then echo $$BASH; \
149 else if [ -x /bin/bash ]; then echo /bin/bash; \
150 else echo sh; fi; fi)
152 # kconfig uses CONFIG_SHELL
153 CONFIG_SHELL:=$(SHELL)
155 export SHELL CONFIG_SHELL quiet Q KBUILD_VERBOSE VERBOSE
165 HOSTCC:=$(shell which $(HOSTCC) || type -p $(HOSTCC) || echo gcc)
167 HOSTCC_NOCCACHE:=$(HOSTCC)
170 HOSTCXX:=$(shell which $(HOSTCXX) || type -p $(HOSTCXX) || echo g++)
172 HOSTCXX_NOCCACHE:=$(HOSTCXX)
188 HOSTAR:=$(shell which $(HOSTAR) || type -p $(HOSTAR) || echo ar)
189 HOSTAS:=$(shell which $(HOSTAS) || type -p $(HOSTAS) || echo as)
190 HOSTFC:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo || which g77 || type -p g77 || echo gfortran)
191 HOSTCPP:=$(shell which $(HOSTCPP) || type -p $(HOSTCPP) || echo cpp)
192 HOSTLD:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo ld)
193 HOSTLN:=$(shell which $(HOSTLN) || type -p $(HOSTLN) || echo ln)
194 HOSTNM:=$(shell which $(HOSTNM) || type -p $(HOSTNM) || echo nm)
196 export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD
197 export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE
199 # Make sure pkg-config doesn't look outside the buildroot tree
200 unexport PKG_CONFIG_PATH
201 unexport PKG_CONFIG_SYSROOT_DIR
202 unexport PKG_CONFIG_LIBDIR
204 # Having DESTDIR set in the environment confuses the installation
205 # steps of some packages.
208 # Causes breakage with packages that needs host-ruby
211 ifeq ($(BR2_HAVE_DOT_CONFIG),y)
213 ################################################################################
215 # Hide troublesome environment variables from sub processes
217 ################################################################################
218 unexport CROSS_COMPILE
225 unexport GREP_OPTIONS
230 GNU_HOST_NAME:=$(shell support/gnuconfig/config.guess)
232 ################################################################################
234 # The list of stuff to build for the target toolchain
235 # along with the packages to build for the target.
237 ################################################################################
239 BASE_TARGETS = toolchain
243 # silent mode requested?
244 QUIET:=$(if $(findstring s,$(MAKEFLAGS)),-q)
246 # Strip off the annoying quoting
247 ARCH:=$(call qstrip,$(BR2_ARCH))
249 KERNEL_ARCH:=$(shell echo "$(ARCH)" | sed -e "s/-.*//" \
250 -e s/i.86/i386/ -e s/sun4u/sparc64/ \
253 -e s/arm.*/arm/ -e s/sa110/arm/ \
254 -e s/aarch64/arm64/ \
255 -e s/bfin/blackfin/ \
256 -e s/parisc64/parisc/ \
257 -e s/powerpc64/powerpc/ \
258 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
261 ZCAT:=$(call qstrip,$(BR2_ZCAT))
262 BZCAT:=$(call qstrip,$(BR2_BZCAT))
263 XZCAT:=$(call qstrip,$(BR2_XZCAT))
264 TAR_OPTIONS=$(call qstrip,$(BR2_TAR_OPTIONS)) -xf
266 # packages compiled for the host go here
267 HOST_DIR:=$(call qstrip,$(BR2_HOST_DIR))
269 # locales to generate
270 GENERATE_LOCALE=$(call qstrip,$(BR2_GENERATE_LOCALE))
272 TARGET_SKELETON=$(TOPDIR)/system/skeleton
274 # Location of a file giving a big fat warning that output/target
275 # should not be used as the root filesystem.
276 TARGET_DIR_WARNING_FILE=$(TARGET_DIR)/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
278 ifeq ($(BR2_CCACHE),y)
279 CCACHE:=$(HOST_DIR)/usr/bin/ccache
280 BUILDROOT_CACHE_DIR = $(call qstrip,$(BR2_CCACHE_DIR))
281 export BUILDROOT_CACHE_DIR
282 HOSTCC := $(CCACHE) $(HOSTCC)
283 HOSTCXX := $(CCACHE) $(HOSTCXX)
286 # Scripts in support/ or post-build scripts may need to reference
287 # these locations, so export them so it is easier to use
288 export BUILDROOT_CONFIG
295 ################################################################################
297 # You should probably leave this stuff alone unless you know
298 # what you are doing.
300 ################################################################################
304 # Include legacy before the other things, because package .mk files
306 ifneq ($(BR2_DEPRECATED),y)
307 include Makefile.legacy
310 include package/Makefile.in
311 include support/dependencies/dependencies.mk
313 # We also need the various per-package makefiles, which also add
314 # each selected package to TARGETS if that package was selected
315 # in the .config file.
316 include toolchain/helpers.mk
317 include toolchain/*/*.mk
319 # Include the package override file if one has been provided in the
321 PACKAGE_OVERRIDE_FILE=$(call qstrip,$(BR2_PACKAGE_OVERRIDE_FILE))
322 ifneq ($(PACKAGE_OVERRIDE_FILE),)
323 -include $(PACKAGE_OVERRIDE_FILE)
326 include $(sort $(wildcard package/*/*.mk))
328 include boot/common.mk
329 include linux/linux.mk
330 include system/system.mk
332 TARGETS+=target-finalize
334 ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
335 TARGETS+=target-purgelocales
338 ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),y)
339 ifneq ($(GENERATE_LOCALE),)
340 TARGETS+=target-generatelocales
344 ifeq ($(BR2_ECLIPSE_REGISTER),y)
345 TARGETS+=toolchain-eclipse-register
350 TARGETS+=target-post-image
352 TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
353 TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS) $(BASE_TARGETS))
354 TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
355 TARGETS_ALL:=$(patsubst %,__real_tgt_%,$(TARGETS))
357 # host-* dependencies have to be handled specially, as those aren't
358 # visible in Kconfig and hence not added to a variable like TARGETS.
359 # instead, find all the host-* targets listed in each <PKG>_DEPENDENCIES
360 # variable for each enabled target.
361 # Notice: this only works for newstyle gentargets/autotargets packages
362 TARGETS_HOST_DEPS = $(sort $(filter host-%,$(foreach dep,\
363 $(addsuffix _DEPENDENCIES,$(call UPPERCASE,$(TARGETS))),\
365 # Host packages can in turn have their own dependencies. Likewise find
366 # all the package names listed in the HOST_<PKG>_DEPENDENCIES for each
367 # host package found above. Ideally this should be done recursively until
368 # no more packages are found, but that's hard to do in make, so limit to
370 HOST_DEPS = $(sort $(foreach dep,\
371 $(addsuffix _DEPENDENCIES,$(call UPPERCASE,$(TARGETS_HOST_DEPS))),\
373 HOST_SOURCE += $(addsuffix -source,$(sort $(TARGETS_HOST_DEPS) $(HOST_DEPS)))
375 TARGETS_LEGAL_INFO:=$(patsubst %,%-legal-info,\
376 $(TARGETS) $(BASE_TARGETS) $(TARGETS_HOST_DEPS) $(HOST_DEPS))))
378 # all targets depend on the crosscompiler and it's prerequisites
379 $(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) %
381 dirs: $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
382 $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR)
384 $(BUILD_DIR)/buildroot-config/auto.conf: $(BUILDROOT_CONFIG)
385 $(MAKE) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig
387 prepare: $(BUILD_DIR)/buildroot-config/auto.conf
389 world: $(BASE_TARGETS) $(TARGETS_ALL)
391 .PHONY: all world toolchain dirs clean distclean source outputmakefile \
392 legal-info legal-info-prepare legal-info-clean printvars \
393 $(BASE_TARGETS) $(TARGETS) $(TARGETS_ALL) \
394 $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) $(TARGETS_LEGAL_INFO) \
395 $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
396 $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR)
398 ################################################################################
400 # staging and target directories do NOT list these as
401 # dependencies anywhere else
403 ################################################################################
404 $(BUILD_DIR) $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR) $(LEGAL_INFO_DIR) $(REDIST_SOURCES_DIR):
407 # We make a symlink lib32->lib or lib64->lib as appropriate
408 # MIPS64/n32 requires lib32 even though it's a 64-bit arch.
409 ifeq ($(BR2_ARCH_IS_64)$(BR2_MIPS_NABI32),y)
416 @mkdir -p $(STAGING_DIR)/bin
417 @mkdir -p $(STAGING_DIR)/lib
418 @ln -snf lib $(STAGING_DIR)/$(LIB_SYMLINK)
419 @mkdir -p $(STAGING_DIR)/usr/lib
420 @ln -snf lib $(STAGING_DIR)/usr/$(LIB_SYMLINK)
421 @mkdir -p $(STAGING_DIR)/usr/include
422 @mkdir -p $(STAGING_DIR)/usr/bin
423 @ln -snf $(STAGING_DIR) $(BASE_DIR)/staging
425 ifeq ($(BR2_ROOTFS_SKELETON_CUSTOM),y)
426 TARGET_SKELETON=$(BR2_ROOTFS_SKELETON_CUSTOM_PATH)
429 RSYNC_VCS_EXCLUSIONS = \
430 --exclude .svn --exclude .git --exclude .hg --exclude .bzr \
434 mkdir -p $(TARGET_DIR)
435 rsync -a $(RSYNC_VCS_EXCLUSIONS) \
436 --exclude .empty --exclude '*~' \
437 $(TARGET_SKELETON)/ $(TARGET_DIR)/
438 cp support/misc/target-dir-warning.txt $(TARGET_DIR_WARNING_FILE)
439 @ln -snf lib $(TARGET_DIR)/$(LIB_SYMLINK)
440 @mkdir -p $(TARGET_DIR)/usr
441 @ln -snf lib $(TARGET_DIR)/usr/$(LIB_SYMLINK)
444 $(TARGET_DIR): $(BUILD_DIR)/.root
446 STRIP_FIND_CMD = find $(TARGET_DIR)
447 ifneq (,$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS)))
448 STRIP_FIND_CMD += \( $(call finddirclauses,$(TARGET_DIR),$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS))) \) -prune -o
450 STRIP_FIND_CMD += -type f -perm /111
451 STRIP_FIND_CMD += -not \( $(call findfileclauses,libpthread*.so* $(call qstrip,$(BR2_STRIP_EXCLUDE_FILES))) \) -print
454 rm -rf $(TARGET_DIR)/usr/include $(TARGET_DIR)/usr/share/aclocal \
455 $(TARGET_DIR)/usr/lib/pkgconfig $(TARGET_DIR)/usr/share/pkgconfig \
456 $(TARGET_DIR)/usr/lib/cmake $(TARGET_DIR)/usr/share/cmake
457 find $(TARGET_DIR)/usr/{lib,share}/ -name '*.cmake' -print0 | xargs -0 rm -f
458 find $(TARGET_DIR)/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
459 find $(TARGET_DIR)/usr/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
460 ifneq ($(BR2_PACKAGE_GDB),y)
461 rm -rf $(TARGET_DIR)/usr/share/gdb
463 ifneq ($(BR2_HAVE_DOCUMENTATION),y)
464 rm -rf $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/man
465 rm -rf $(TARGET_DIR)/usr/info $(TARGET_DIR)/usr/share/info
466 rm -rf $(TARGET_DIR)/usr/doc $(TARGET_DIR)/usr/share/doc
467 rm -rf $(TARGET_DIR)/usr/share/gtk-doc
468 -rmdir $(TARGET_DIR)/usr/share 2>/dev/null
470 ifeq ($(BR2_PACKAGE_PYTHON_PY_ONLY),y)
471 find $(TARGET_DIR)/usr/lib/ -name '*.pyc' -print0 | xargs -0 rm -f
473 ifeq ($(BR2_PACKAGE_PYTHON_PYC_ONLY),y)
474 find $(TARGET_DIR)/usr/lib/ -name '*.py' -print0 | xargs -0 rm -f
476 $(STRIP_FIND_CMD) | xargs $(STRIPCMD) 2>/dev/null || true
477 if test -d $(TARGET_DIR)/lib/modules; then \
478 find $(TARGET_DIR)/lib/modules -type f -name '*.ko' | \
479 xargs -r $(KSTRIPCMD); fi
481 # See http://sourceware.org/gdb/wiki/FAQ, "GDB does not see any threads
482 # besides the one in which crash occurred; or SIGTRAP kills my program when
483 # I set a breakpoint"
484 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
485 find $(TARGET_DIR)/lib -type f -name 'libpthread*.so*' | \
486 xargs -r $(STRIPCMD) $(STRIP_STRIP_DEBUG)
489 mkdir -p $(TARGET_DIR)/etc
490 # Mandatory configuration file and auxilliary cache directory
491 # for recent versions of ldconfig
492 touch $(TARGET_DIR)/etc/ld.so.conf
493 mkdir -p $(TARGET_DIR)/var/cache/ldconfig
494 if [ -x "$(TARGET_CROSS)ldconfig" ]; \
496 $(TARGET_CROSS)ldconfig -r $(TARGET_DIR); \
498 /sbin/ldconfig -r $(TARGET_DIR); \
501 echo "NAME=Buildroot"; \
502 echo "VERSION=$(BR2_VERSION_FULL)"; \
503 echo "ID=buildroot"; \
504 echo "VERSION_ID=$(BR2_VERSION)"; \
505 echo "PRETTY_NAME=\"Buildroot $(BR2_VERSION)\"" \
506 ) > $(TARGET_DIR)/etc/os-release
508 @$(foreach d, $(call qstrip,$(BR2_ROOTFS_OVERLAY)), \
509 $(call MESSAGE,"Copying overlay $(d)"); \
510 rsync -a $(RSYNC_VCS_EXCLUSIONS) \
511 --exclude .empty --exclude '*~' \
512 $(d)/ $(TARGET_DIR)$(sep))
514 @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_BUILD_SCRIPT)), \
515 $(call MESSAGE,"Executing post-build script $(s)"); \
516 $(s) $(TARGET_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
518 ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
519 LOCALE_WHITELIST=$(BUILD_DIR)/locales.nopurge
520 LOCALE_NOPURGE=$(call qstrip,$(BR2_ENABLE_LOCALE_WHITELIST))
523 rm -f $(LOCALE_WHITELIST)
524 for i in $(LOCALE_NOPURGE); do echo $$i >> $(LOCALE_WHITELIST); done
526 for dir in $(wildcard $(addprefix $(TARGET_DIR),/usr/share/locale /usr/share/X11/locale /usr/man /usr/share/man)); \
528 for lang in $$(cd $$dir; ls .|grep -v man); \
530 grep -qx $$lang $(LOCALE_WHITELIST) || rm -rf $$dir/$$lang; \
535 ifneq ($(GENERATE_LOCALE),)
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
541 target-generatelocales: host-localedef
542 $(Q)mkdir -p $(TARGET_DIR)/usr/lib/locale/
543 $(Q)for locale in $(GENERATE_LOCALE) ; do \
544 inputfile=`echo $${locale} | cut -f1 -d'.'` ; \
545 charmap=`echo $${locale} | cut -f2 -d'.' -s` ; \
546 if test -z "$${charmap}" ; then \
549 echo "Generating locale $${inputfile}.$${charmap}" ; \
550 I18NPATH=$(STAGING_DIR)/usr/share/i18n:/usr/share/i18n \
551 $(HOST_DIR)/usr/bin/localedef \
552 --prefix=$(TARGET_DIR) \
553 --$(call LOWERCASE,$(BR2_ENDIAN))-endian \
554 -i $${inputfile} -f $${charmap} \
560 @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_IMAGE_SCRIPT)), \
561 $(call MESSAGE,"Executing post-image script $(s)"); \
562 $(s) $(BINARIES_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
564 toolchain-eclipse-register:
565 ./support/scripts/eclipse-register-toolchain `readlink -f $(O)` $(notdir $(TARGET_CROSS)) $(BR2_ARCH)
567 source: dirs $(TARGETS_SOURCE) $(HOST_SOURCE)
570 @$(MAKE) -Bs DL_MODE=SHOW_EXTERNAL_DEPS $(EXTRAMAKEARGS) source | sort -u
573 @rm -fr $(LEGAL_INFO_DIR)
575 legal-info-prepare: $(LEGAL_INFO_DIR)
576 @$(call MESSAGE,"Collecting legal info")
577 @$(call legal-license-file,buildroot,COPYING,COPYING)
578 @$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE)
579 @$(call legal-manifest,buildroot,$(BR2_VERSION_FULL),GPLv2+,COPYING,not saved)
580 @$(call legal-warning,the Buildroot source code has not been saved)
581 @$(call legal-warning,the toolchain has not been saved)
582 @cp $(BUILDROOT_CONFIG) $(LEGAL_INFO_DIR)/buildroot.config
584 legal-info: dirs legal-info-clean legal-info-prepare $(REDIST_SOURCES_DIR) \
585 $(TARGETS_LEGAL_INFO)
586 @cat support/legal-info/README.header >>$(LEGAL_REPORT)
587 @if [ -r $(LEGAL_WARNINGS) ]; then \
588 cat support/legal-info/README.warnings-header \
589 $(LEGAL_WARNINGS) >>$(LEGAL_REPORT); \
590 cat $(LEGAL_WARNINGS); fi
591 @echo "Legal info produced in $(LEGAL_INFO_DIR)"
592 @rm -f $(LEGAL_WARNINGS)
597 else # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
601 endif # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
604 # ---------------------------------------------------------------------------
606 HOSTCFLAGS=$(CFLAGS_FOR_BUILD)
609 $(BUILD_DIR)/buildroot-config/%onf:
610 mkdir -p $(@D)/lxdialog
611 $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)
613 DEFCONFIG = $(call qstrip,$(BR2_DEFCONFIG))
615 # We don't want to fully expand BR2_DEFCONFIG here, so Kconfig will
616 # recognize that if it's still at its default $(CONFIG_DIR)/defconfig
617 COMMON_CONFIG_ENV = \
618 BR2_DEFCONFIG='$(call qstrip,$(value BR2_DEFCONFIG))' \
619 KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
620 KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
621 KCONFIG_TRISTATE=$(BUILD_DIR)/buildroot-config/tristate.config \
622 BUILDROOT_CONFIG=$(BUILDROOT_CONFIG)
624 xconfig: $(BUILD_DIR)/buildroot-config/qconf outputmakefile
625 @mkdir -p $(BUILD_DIR)/buildroot-config
626 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
628 gconfig: $(BUILD_DIR)/buildroot-config/gconf outputmakefile
629 @mkdir -p $(BUILD_DIR)/buildroot-config
630 @$(COMMON_CONFIG_ENV) srctree=$(TOPDIR) $< $(CONFIG_CONFIG_IN)
632 menuconfig: $(BUILD_DIR)/buildroot-config/mconf outputmakefile
633 @mkdir -p $(BUILD_DIR)/buildroot-config
634 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
636 nconfig: $(BUILD_DIR)/buildroot-config/nconf outputmakefile
637 @mkdir -p $(BUILD_DIR)/buildroot-config
638 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
640 config: $(BUILD_DIR)/buildroot-config/conf outputmakefile
641 @mkdir -p $(BUILD_DIR)/buildroot-config
642 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
644 oldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
645 mkdir -p $(BUILD_DIR)/buildroot-config
646 @$(COMMON_CONFIG_ENV) $< --oldconfig $(CONFIG_CONFIG_IN)
648 randconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
649 @mkdir -p $(BUILD_DIR)/buildroot-config
650 @$(COMMON_CONFIG_ENV) $< --randconfig $(CONFIG_CONFIG_IN)
652 allyesconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
653 @mkdir -p $(BUILD_DIR)/buildroot-config
654 @$(COMMON_CONFIG_ENV) $< --allyesconfig $(CONFIG_CONFIG_IN)
656 allnoconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
657 @mkdir -p $(BUILD_DIR)/buildroot-config
658 @$(COMMON_CONFIG_ENV) $< --allnoconfig $(CONFIG_CONFIG_IN)
660 randpackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
661 @mkdir -p $(BUILD_DIR)/buildroot-config
662 @grep -v BR2_PACKAGE_ $(BUILDROOT_CONFIG) > $(CONFIG_DIR)/.config.nopkg
663 @grep '^config BR2_PACKAGE_' Config.in.legacy | \
664 while read config pkg; do \
665 echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
666 @$(COMMON_CONFIG_ENV) \
667 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
668 $< --randconfig $(CONFIG_CONFIG_IN)
669 @rm -f $(CONFIG_DIR)/.config.nopkg
671 allyespackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
672 @mkdir -p $(BUILD_DIR)/buildroot-config
673 @grep -v BR2_PACKAGE_ $(BUILDROOT_CONFIG) > $(CONFIG_DIR)/.config.nopkg
674 @grep '^config BR2_PACKAGE_' Config.in.legacy | \
675 while read config pkg; do \
676 echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
677 @$(COMMON_CONFIG_ENV) \
678 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
679 $< --allyesconfig $(CONFIG_CONFIG_IN)
680 @rm -f $(CONFIG_DIR)/.config.nopkg
682 allnopackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
683 @mkdir -p $(BUILD_DIR)/buildroot-config
684 @grep -v BR2_PACKAGE_ $(BUILDROOT_CONFIG) > $(CONFIG_DIR)/.config.nopkg
685 @$(COMMON_CONFIG_ENV) \
686 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
687 $< --allnoconfig $(CONFIG_CONFIG_IN)
688 @rm -f $(CONFIG_DIR)/.config.nopkg
690 silentoldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
691 @mkdir -p $(BUILD_DIR)/buildroot-config
692 $(COMMON_CONFIG_ENV) $< --silentoldconfig $(CONFIG_CONFIG_IN)
694 olddefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
695 @mkdir -p $(BUILD_DIR)/buildroot-config
696 $(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN)
698 defconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
699 @mkdir -p $(BUILD_DIR)/buildroot-config
700 @$(COMMON_CONFIG_ENV) $< --defconfig$(if $(DEFCONFIG),=$(DEFCONFIG)) $(CONFIG_CONFIG_IN)
702 %_defconfig: $(BUILD_DIR)/buildroot-config/conf $(TOPDIR)/configs/%_defconfig outputmakefile
703 @mkdir -p $(BUILD_DIR)/buildroot-config
704 @$(COMMON_CONFIG_ENV) $< --defconfig=$(TOPDIR)/configs/$@ $(CONFIG_CONFIG_IN)
706 savedefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
707 @mkdir -p $(BUILD_DIR)/buildroot-config
708 @$(COMMON_CONFIG_ENV) $< \
709 --savedefconfig=$(if $(DEFCONFIG),$(DEFCONFIG),$(CONFIG_DIR)/defconfig) \
712 # check if download URLs are outdated
714 $(MAKE) DL_MODE=SOURCE_CHECK $(EXTRAMAKEARGS) source
716 .PHONY: defconfig savedefconfig
718 ################################################################################
720 # Cleanup and misc junk
722 ################################################################################
724 # outputmakefile generates a Makefile in the output directory, if using a
725 # separate output directory. This allows convenient use of make in the
728 ifeq ($(NEED_WRAPPER),y)
729 $(Q)$(TOPDIR)/support/scripts/mkmakefile $(TOPDIR) $(O)
732 # printvars prints all the variables currently defined in our Makefiles
735 $(sort $(.VARIABLES)), \
736 $(if $(filter-out environment% default automatic, \
738 $(info $V=$($V) ($(value $V)))))
741 rm -rf $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
742 $(STAMP_DIR) $(BUILD_DIR) $(BASE_DIR)/staging \
746 ifeq ($(DL_DIR),$(TOPDIR)/dl)
752 rm -rf $(BUILDROOT_CONFIG) $(CONFIG_DIR)/.config.old $(CONFIG_DIR)/.auto.deps
756 @echo ' clean - delete all files created by build'
757 @echo ' distclean - delete all non-source files (including .config)'
760 @echo ' all - make world'
761 @echo ' toolchain - build toolchain'
762 @echo ' <package>-rebuild - force recompile <package>'
763 @echo ' <package>-reconfigure - force reconfigure <package>'
765 @echo 'Configuration:'
766 @echo ' menuconfig - interactive curses-based configurator'
767 @echo ' nconfig - interactive ncurses-based configurator'
768 @echo ' xconfig - interactive Qt-based configurator'
769 @echo ' gconfig - interactive GTK-based configurator'
770 @echo ' oldconfig - resolve any unresolved symbols in .config'
771 @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps'
772 @echo ' olddefconfig - Same as silentoldconfig but sets new symbols to their default value'
773 @echo ' randconfig - New config with random answer to all options'
774 @echo ' defconfig - New config with default answer to all options'
775 @echo ' BR2_DEFCONFIG, if set, is used as input'
776 @echo ' savedefconfig - Save current config as ./defconfig (minimal config)'
777 @echo ' allyesconfig - New config where all options are accepted with yes'
778 @echo ' allnoconfig - New config where all options are answered with no'
779 @echo ' randpackageconfig - New config with random answer to package options'
780 @echo ' allyespackageconfig - New config where pkg options are accepted with yes'
781 @echo ' allnopackageconfig - New config where package options are answered with no'
782 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
783 @echo ' busybox-menuconfig - Run BusyBox menuconfig'
785 ifeq ($(BR2_LINUX_KERNEL),y)
786 @echo ' linux-menuconfig - Run Linux kernel menuconfig'
787 @echo ' linux-savedefconfig - Run Linux kernel savedefconfig'
789 ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
790 @echo ' uclibc-menuconfig - Run uClibc menuconfig'
792 ifeq ($(BR2_TARGET_BAREBOX),y)
793 @echo ' barebox-menuconfig - Run barebox menuconfig'
794 @echo ' barebox-savedefconfig - Run barebox savedefconfig'
797 @echo 'Documentation:'
798 @echo ' manual - build manual in all formats'
799 @echo ' manual-html - build manual in HTML'
800 @echo ' manual-split-html - build manual in split HTML'
801 @echo ' manual-pdf - build manual in PDF'
802 @echo ' manual-text - build manual in text'
803 @echo ' manual-epub - build manual in ePub'
805 @echo 'Miscellaneous:'
806 @echo ' source - download all sources needed for offline-build'
807 @echo ' source-check - check selected packages for valid download URLs'
808 @echo ' external-deps - list external packages used'
809 @echo ' legal-info - generate info about license compliance'
811 @echo ' make V=0|1 - 0 => quiet build (default), 1 => verbose build'
812 @echo ' make O=dir - Locate all output files in "dir", including .config'
814 @$(foreach b, $(sort $(notdir $(wildcard $(TOPDIR)/configs/*_defconfig))), \
815 printf " %-35s - Build for %s\\n" $(b) $(b:_defconfig=);)
817 @echo 'See docs/README, or generate the Buildroot manual for further details'
820 release: OUT=buildroot-$(BR2_VERSION)
822 # Create release tarballs. We need to fiddle a bit to add the generated
823 # documentation to the git output
825 git archive --format=tar --prefix=$(OUT)/ HEAD > $(OUT).tar
826 $(MAKE) O=$(OUT) manual-html manual-text manual-pdf
827 tar rf $(OUT).tar $(OUT)
828 gzip -9 -c < $(OUT).tar > $(OUT).tar.gz
829 bzip2 -9 -c < $(OUT).tar > $(OUT).tar.bz2
830 rm -rf $(OUT) $(OUT).tar
833 @echo $(BR2_VERSION_FULL)
835 include docs/manual/manual.mk
837 .PHONY: $(noconfig_targets)