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:=2014.02-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))
103 # Handling of BR2_EXTERNAL.
105 # The value of BR2_EXTERNAL is stored in .br-external in the output directory.
106 # On subsequent invocations of make, it is read in. It can still be overridden
107 # on the command line, therefore the file is re-created every time make is run.
109 # When BR2_EXTERNAL is not set, the .br-external file is removed and we point
110 # to support/dummy-external. This makes sure we can unconditionally include the
111 # Config.in and external.mk from the BR2_EXTERNAL directory. In this case,
112 # override is necessary so the user can clear BR2_EXTERNAL from the command
113 # line, but the dummy path is still used internally.
115 BR2_EXTERNAL_FILE = $(BASE_DIR)/.br-external
116 -include $(BR2_EXTERNAL_FILE)
117 ifeq ($(BR2_EXTERNAL),)
118 override BR2_EXTERNAL = support/dummy-external
119 $(shell rm -f $(BR2_EXTERNAL_FILE))
121 $(shell echo BR2_EXTERNAL ?= $(BR2_EXTERNAL) > $(BR2_EXTERNAL_FILE))
125 BUILD_DIR:=$(BASE_DIR)/build
126 STAMP_DIR:=$(BASE_DIR)/stamps
127 BINARIES_DIR:=$(BASE_DIR)/images
128 TARGET_DIR:=$(BASE_DIR)/target
129 # initial definition so that 'make clean' works for most users, even without
130 # .config. HOST_DIR will be overwritten later when .config is included.
131 HOST_DIR:=$(BASE_DIR)/host
133 LEGAL_INFO_DIR=$(BASE_DIR)/legal-info
134 REDIST_SOURCES_DIR_TARGET=$(LEGAL_INFO_DIR)/sources
135 REDIST_SOURCES_DIR_HOST=$(LEGAL_INFO_DIR)/host-sources
136 LICENSE_FILES_DIR_TARGET=$(LEGAL_INFO_DIR)/licenses
137 LICENSE_FILES_DIR_HOST=$(LEGAL_INFO_DIR)/host-licenses
138 LEGAL_MANIFEST_CSV_TARGET=$(LEGAL_INFO_DIR)/manifest.csv
139 LEGAL_MANIFEST_CSV_HOST=$(LEGAL_INFO_DIR)/host-manifest.csv
140 LEGAL_LICENSES_TXT_TARGET=$(LEGAL_INFO_DIR)/licenses.txt
141 LEGAL_LICENSES_TXT_HOST=$(LEGAL_INFO_DIR)/host-licenses.txt
142 LEGAL_WARNINGS=$(LEGAL_INFO_DIR)/.warnings
143 LEGAL_REPORT=$(LEGAL_INFO_DIR)/README
145 BUILDROOT_CONFIG=$(CONFIG_DIR)/.config
147 # Pull in the user's configuration file
148 ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
149 -include $(BUILDROOT_CONFIG)
152 # To put more focus on warnings, be less verbose as default
153 # Use 'make V=1' to see the full commands
155 ifeq ("$(origin V)", "command line")
159 ifndef KBUILD_VERBOSE
163 ifeq ($(KBUILD_VERBOSE),1)
174 # we want bash as shell
175 SHELL:=$(shell if [ -x "$$BASH" ]; then echo $$BASH; \
176 else if [ -x /bin/bash ]; then echo /bin/bash; \
177 else echo sh; fi; fi)
179 # kconfig uses CONFIG_SHELL
180 CONFIG_SHELL:=$(SHELL)
182 export SHELL CONFIG_SHELL quiet Q KBUILD_VERBOSE VERBOSE
192 HOSTCC:=$(shell which $(HOSTCC) || type -p $(HOSTCC) || echo gcc)
194 HOSTCC_NOCCACHE:=$(HOSTCC)
197 HOSTCXX:=$(shell which $(HOSTCXX) || type -p $(HOSTCXX) || echo g++)
199 HOSTCXX_NOCCACHE:=$(HOSTCXX)
221 HOSTAR:=$(shell which $(HOSTAR) || type -p $(HOSTAR) || echo ar)
222 HOSTAS:=$(shell which $(HOSTAS) || type -p $(HOSTAS) || echo as)
223 HOSTFC:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo || which g77 || type -p g77 || echo gfortran)
224 HOSTCPP:=$(shell which $(HOSTCPP) || type -p $(HOSTCPP) || echo cpp)
225 HOSTLD:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo ld)
226 HOSTLN:=$(shell which $(HOSTLN) || type -p $(HOSTLN) || echo ln)
227 HOSTNM:=$(shell which $(HOSTNM) || type -p $(HOSTNM) || echo nm)
228 HOSTOBJCOPY:=$(shell which $(HOSTOBJCOPY) || type -p $(HOSTOBJCOPY) || echo objcopy)
229 HOSTRANLIB:=$(shell which $(HOSTRANLIB) || type -p $(HOSTRANLIB) || echo ranlib)
231 export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD
232 export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE
234 # Make sure pkg-config doesn't look outside the buildroot tree
235 unexport PKG_CONFIG_PATH
236 unexport PKG_CONFIG_SYSROOT_DIR
237 unexport PKG_CONFIG_LIBDIR
239 # Having DESTDIR set in the environment confuses the installation
240 # steps of some packages.
243 # Causes breakage with packages that needs host-ruby
246 ifeq ($(BR2_HAVE_DOT_CONFIG),y)
248 ################################################################################
250 # Hide troublesome environment variables from sub processes
252 ################################################################################
253 unexport CROSS_COMPILE
260 unexport GREP_OPTIONS
265 GNU_HOST_NAME:=$(shell support/gnuconfig/config.guess)
267 ################################################################################
269 # The list of stuff to build for the target toolchain
270 # along with the packages to build for the target.
272 ################################################################################
274 BASE_TARGETS = toolchain
278 # silent mode requested?
279 QUIET:=$(if $(findstring s,$(MAKEFLAGS)),-q)
281 # Strip off the annoying quoting
282 ARCH:=$(call qstrip,$(BR2_ARCH))
284 KERNEL_ARCH:=$(shell echo "$(ARCH)" | sed -e "s/-.*//" \
285 -e s/i.86/i386/ -e s/sun4u/sparc64/ \
288 -e s/arm.*/arm/ -e s/sa110/arm/ \
289 -e s/aarch64/arm64/ \
290 -e s/bfin/blackfin/ \
291 -e s/parisc64/parisc/ \
292 -e s/powerpc64/powerpc/ \
293 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
296 ZCAT:=$(call qstrip,$(BR2_ZCAT))
297 BZCAT:=$(call qstrip,$(BR2_BZCAT))
298 XZCAT:=$(call qstrip,$(BR2_XZCAT))
299 TAR_OPTIONS=$(call qstrip,$(BR2_TAR_OPTIONS)) -xf
301 # packages compiled for the host go here
302 HOST_DIR:=$(call qstrip,$(BR2_HOST_DIR))
304 # locales to generate
305 GENERATE_LOCALE=$(call qstrip,$(BR2_GENERATE_LOCALE))
307 TARGET_SKELETON=$(TOPDIR)/system/skeleton
309 # Location of a file giving a big fat warning that output/target
310 # should not be used as the root filesystem.
311 TARGET_DIR_WARNING_FILE=$(TARGET_DIR)/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
313 ifeq ($(BR2_CCACHE),y)
314 CCACHE:=$(HOST_DIR)/usr/bin/ccache
315 BUILDROOT_CACHE_DIR = $(call qstrip,$(BR2_CCACHE_DIR))
316 export BUILDROOT_CACHE_DIR
317 HOSTCC := $(CCACHE) $(HOSTCC)
318 HOSTCXX := $(CCACHE) $(HOSTCXX)
321 # Scripts in support/ or post-build scripts may need to reference
322 # these locations, so export them so it is easier to use
323 export BUILDROOT_CONFIG
330 ################################################################################
332 # You should probably leave this stuff alone unless you know
333 # what you are doing.
335 ################################################################################
339 # Include legacy before the other things, because package .mk files
341 ifneq ($(BR2_DEPRECATED),y)
342 include Makefile.legacy
345 include package/Makefile.in
346 include support/dependencies/dependencies.mk
348 # We also need the various per-package makefiles, which also add
349 # each selected package to TARGETS if that package was selected
350 # in the .config file.
351 include toolchain/helpers.mk
352 include toolchain/*/*.mk
354 # Include the package override file if one has been provided in the
356 PACKAGE_OVERRIDE_FILE=$(call qstrip,$(BR2_PACKAGE_OVERRIDE_FILE))
357 ifneq ($(PACKAGE_OVERRIDE_FILE),)
358 -include $(PACKAGE_OVERRIDE_FILE)
361 include $(sort $(wildcard package/*/*.mk))
363 include boot/common.mk
364 include linux/linux.mk
365 include system/system.mk
367 TARGETS+=target-finalize
369 ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
370 TARGETS+=target-purgelocales
373 ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),y)
374 ifneq ($(GENERATE_LOCALE),)
375 TARGETS+=target-generatelocales
379 ifeq ($(BR2_ECLIPSE_REGISTER),y)
380 TARGETS+=toolchain-eclipse-register
385 TARGETS+=target-post-image
387 TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS) $(BASE_TARGETS))
388 TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
389 TARGETS_ALL:=$(patsubst %,__real_tgt_%,$(TARGETS))
391 # host-* dependencies have to be handled specially, as those aren't
392 # visible in Kconfig and hence not added to a variable like TARGETS.
393 # instead, find all the host-* targets listed in each <PKG>_DEPENDENCIES
394 # variable for each enabled target.
395 # Notice: this only works for newstyle gentargets/autotargets packages
396 TARGETS_HOST_DEPS = $(sort $(filter host-%,$(foreach dep,\
397 $(addsuffix _DEPENDENCIES,$(call UPPERCASE,$(TARGETS))),\
399 # Host packages can in turn have their own dependencies. Likewise find
400 # all the package names listed in the HOST_<PKG>_DEPENDENCIES for each
401 # host package found above. Ideally this should be done recursively until
402 # no more packages are found, but that's hard to do in make, so limit to
404 HOST_DEPS = $(sort $(foreach dep,\
405 $(addsuffix _DEPENDENCIES,$(call UPPERCASE,$(TARGETS_HOST_DEPS))),\
407 HOST_SOURCE += $(addsuffix -source,$(sort $(TARGETS_HOST_DEPS) $(HOST_DEPS)))
409 TARGETS_LEGAL_INFO:=$(patsubst %,%-legal-info,\
410 $(TARGETS) $(BASE_TARGETS) $(TARGETS_HOST_DEPS) $(HOST_DEPS))))
412 # all targets depend on the crosscompiler and it's prerequisites
413 $(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) %
415 dirs: $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
416 $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR)
418 $(BUILD_DIR)/buildroot-config/auto.conf: $(BUILDROOT_CONFIG)
419 $(MAKE) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig
421 prepare: $(BUILD_DIR)/buildroot-config/auto.conf
423 world: $(BASE_TARGETS) $(TARGETS_ALL)
425 .PHONY: all world toolchain dirs clean distclean source outputmakefile \
426 legal-info legal-info-prepare legal-info-clean printvars \
427 $(BASE_TARGETS) $(TARGETS) $(TARGETS_ALL) \
428 $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) $(TARGETS_LEGAL_INFO) \
429 $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
430 $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR)
432 ################################################################################
434 # staging and target directories do NOT list these as
435 # dependencies anywhere else
437 ################################################################################
438 $(BUILD_DIR) $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR) $(LEGAL_INFO_DIR) $(REDIST_SOURCES_DIR_TARGET) $(REDIST_SOURCES_DIR_HOST):
441 # We make a symlink lib32->lib or lib64->lib as appropriate
442 # MIPS64/n32 requires lib32 even though it's a 64-bit arch.
443 ifeq ($(BR2_ARCH_IS_64)$(BR2_MIPS_NABI32),y)
450 @mkdir -p $(STAGING_DIR)/bin
451 @mkdir -p $(STAGING_DIR)/lib
452 @ln -snf lib $(STAGING_DIR)/$(LIB_SYMLINK)
453 @mkdir -p $(STAGING_DIR)/usr/lib
454 @ln -snf lib $(STAGING_DIR)/usr/$(LIB_SYMLINK)
455 @mkdir -p $(STAGING_DIR)/usr/include
456 @mkdir -p $(STAGING_DIR)/usr/bin
457 @ln -snf $(STAGING_DIR) $(BASE_DIR)/staging
459 ifeq ($(BR2_ROOTFS_SKELETON_CUSTOM),y)
460 TARGET_SKELETON=$(BR2_ROOTFS_SKELETON_CUSTOM_PATH)
463 RSYNC_VCS_EXCLUSIONS = \
464 --exclude .svn --exclude .git --exclude .hg --exclude .bzr \
468 mkdir -p $(TARGET_DIR)
469 rsync -a $(RSYNC_VCS_EXCLUSIONS) \
470 --exclude .empty --exclude '*~' \
471 $(TARGET_SKELETON)/ $(TARGET_DIR)/
472 cp support/misc/target-dir-warning.txt $(TARGET_DIR_WARNING_FILE)
473 @ln -snf lib $(TARGET_DIR)/$(LIB_SYMLINK)
474 @mkdir -p $(TARGET_DIR)/usr
475 @ln -snf lib $(TARGET_DIR)/usr/$(LIB_SYMLINK)
478 $(TARGET_DIR): $(BUILD_DIR)/.root
480 STRIP_FIND_CMD = find $(TARGET_DIR)
481 ifneq (,$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS)))
482 STRIP_FIND_CMD += \( $(call finddirclauses,$(TARGET_DIR),$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS))) \) -prune -o
484 STRIP_FIND_CMD += -type f -perm /111
485 STRIP_FIND_CMD += -not \( $(call findfileclauses,libpthread*.so* $(call qstrip,$(BR2_STRIP_EXCLUDE_FILES))) \) -print
488 rm -rf $(TARGET_DIR)/usr/include $(TARGET_DIR)/usr/share/aclocal \
489 $(TARGET_DIR)/usr/lib/pkgconfig $(TARGET_DIR)/usr/share/pkgconfig \
490 $(TARGET_DIR)/usr/lib/cmake $(TARGET_DIR)/usr/share/cmake
491 find $(TARGET_DIR)/usr/{lib,share}/ -name '*.cmake' -print0 | xargs -0 rm -f
492 find $(TARGET_DIR)/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
493 find $(TARGET_DIR)/usr/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
494 ifneq ($(BR2_PACKAGE_GDB),y)
495 rm -rf $(TARGET_DIR)/usr/share/gdb
497 ifneq ($(BR2_HAVE_DOCUMENTATION),y)
498 rm -rf $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/man
499 rm -rf $(TARGET_DIR)/usr/info $(TARGET_DIR)/usr/share/info
500 rm -rf $(TARGET_DIR)/usr/doc $(TARGET_DIR)/usr/share/doc
501 rm -rf $(TARGET_DIR)/usr/share/gtk-doc
502 -rmdir $(TARGET_DIR)/usr/share 2>/dev/null
504 ifeq ($(BR2_PACKAGE_PYTHON_PY_ONLY),y)
505 find $(TARGET_DIR)/usr/lib/ -name '*.pyc' -print0 | xargs -0 rm -f
507 ifeq ($(BR2_PACKAGE_PYTHON_PYC_ONLY),y)
508 find $(TARGET_DIR)/usr/lib/ -name '*.py' -print0 | xargs -0 rm -f
510 $(STRIP_FIND_CMD) | xargs $(STRIPCMD) 2>/dev/null || true
511 if test -d $(TARGET_DIR)/lib/modules; then \
512 find $(TARGET_DIR)/lib/modules -type f -name '*.ko' | \
513 xargs -r $(KSTRIPCMD); fi
515 # See http://sourceware.org/gdb/wiki/FAQ, "GDB does not see any threads
516 # besides the one in which crash occurred; or SIGTRAP kills my program when
517 # I set a breakpoint"
518 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
519 find $(TARGET_DIR)/lib -type f -name 'libpthread*.so*' | \
520 xargs -r $(STRIPCMD) $(STRIP_STRIP_DEBUG)
523 mkdir -p $(TARGET_DIR)/etc
524 # Mandatory configuration file and auxilliary cache directory
525 # for recent versions of ldconfig
526 touch $(TARGET_DIR)/etc/ld.so.conf
527 mkdir -p $(TARGET_DIR)/var/cache/ldconfig
528 if [ -x "$(TARGET_CROSS)ldconfig" ]; \
530 $(TARGET_CROSS)ldconfig -r $(TARGET_DIR); \
532 /sbin/ldconfig -r $(TARGET_DIR); \
535 echo "NAME=Buildroot"; \
536 echo "VERSION=$(BR2_VERSION_FULL)"; \
537 echo "ID=buildroot"; \
538 echo "VERSION_ID=$(BR2_VERSION)"; \
539 echo "PRETTY_NAME=\"Buildroot $(BR2_VERSION)\"" \
540 ) > $(TARGET_DIR)/etc/os-release
542 @$(foreach d, $(call qstrip,$(BR2_ROOTFS_OVERLAY)), \
543 $(call MESSAGE,"Copying overlay $(d)"); \
544 rsync -a $(RSYNC_VCS_EXCLUSIONS) \
545 --exclude .empty --exclude '*~' \
546 $(d)/ $(TARGET_DIR)$(sep))
548 @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_BUILD_SCRIPT)), \
549 $(call MESSAGE,"Executing post-build script $(s)"); \
550 $(USER_HOOKS_EXTRA_ENV) $(s) $(TARGET_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
552 ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
553 LOCALE_WHITELIST=$(BUILD_DIR)/locales.nopurge
554 LOCALE_NOPURGE=$(call qstrip,$(BR2_ENABLE_LOCALE_WHITELIST))
557 rm -f $(LOCALE_WHITELIST)
558 for i in $(LOCALE_NOPURGE); do echo $$i >> $(LOCALE_WHITELIST); done
560 for dir in $(wildcard $(addprefix $(TARGET_DIR),/usr/share/locale /usr/share/X11/locale /usr/man /usr/share/man)); \
562 for lang in $$(cd $$dir; ls .|grep -v man); \
564 grep -qx $$lang $(LOCALE_WHITELIST) || rm -rf $$dir/$$lang; \
569 ifneq ($(GENERATE_LOCALE),)
570 # Generate locale data. Basically, we call the localedef program
571 # (built by the host-localedef package) for each locale. The input
572 # data comes preferably from the toolchain, or if the toolchain does
573 # not have them (Linaro toolchains), we use the ones available on the
575 target-generatelocales: host-localedef
576 $(Q)mkdir -p $(TARGET_DIR)/usr/lib/locale/
577 $(Q)for locale in $(GENERATE_LOCALE) ; do \
578 inputfile=`echo $${locale} | cut -f1 -d'.'` ; \
579 charmap=`echo $${locale} | cut -f2 -d'.' -s` ; \
580 if test -z "$${charmap}" ; then \
583 echo "Generating locale $${inputfile}.$${charmap}" ; \
584 I18NPATH=$(STAGING_DIR)/usr/share/i18n:/usr/share/i18n \
585 $(HOST_DIR)/usr/bin/localedef \
586 --prefix=$(TARGET_DIR) \
587 --$(call LOWERCASE,$(BR2_ENDIAN))-endian \
588 -i $${inputfile} -f $${charmap} \
594 @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_IMAGE_SCRIPT)), \
595 $(call MESSAGE,"Executing post-image script $(s)"); \
596 $(USER_HOOKS_EXTRA_ENV) $(s) $(BINARIES_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
598 toolchain-eclipse-register:
599 ./support/scripts/eclipse-register-toolchain `readlink -f $(O)` $(notdir $(TARGET_CROSS)) $(BR2_ARCH)
601 source: dirs $(TARGETS_SOURCE) $(HOST_SOURCE)
604 @$(MAKE) -Bs DL_MODE=SHOW_EXTERNAL_DEPS $(EXTRAMAKEARGS) source | sort -u
607 @rm -fr $(LEGAL_INFO_DIR)
609 legal-info-prepare: $(LEGAL_INFO_DIR)
610 @$(call MESSAGE,"Collecting legal info")
611 @$(call legal-license-file,buildroot,COPYING,COPYING,HOST)
612 @$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE,TARGET)
613 @$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE,HOST)
614 @$(call legal-manifest,buildroot,$(BR2_VERSION_FULL),GPLv2+,COPYING,not saved,HOST)
615 @$(call legal-warning,the Buildroot source code has not been saved)
616 @$(call legal-warning,the toolchain has not been saved)
617 @cp $(BUILDROOT_CONFIG) $(LEGAL_INFO_DIR)/buildroot.config
619 legal-info: dirs legal-info-clean legal-info-prepare $(TARGETS_LEGAL_INFO) \
620 $(REDIST_SOURCES_DIR_TARGET) $(REDIST_SOURCES_DIR_HOST)
621 @cat support/legal-info/README.header >>$(LEGAL_REPORT)
622 @if [ -r $(LEGAL_WARNINGS) ]; then \
623 cat support/legal-info/README.warnings-header \
624 $(LEGAL_WARNINGS) >>$(LEGAL_REPORT); \
625 cat $(LEGAL_WARNINGS); fi
626 @echo "Legal info produced in $(LEGAL_INFO_DIR)"
627 @rm -f $(LEGAL_WARNINGS)
632 else # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
636 endif # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
639 # ---------------------------------------------------------------------------
641 HOSTCFLAGS=$(CFLAGS_FOR_BUILD)
644 $(BUILD_DIR)/buildroot-config/%onf:
645 mkdir -p $(@D)/lxdialog
646 $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)
648 DEFCONFIG = $(call qstrip,$(BR2_DEFCONFIG))
650 # We don't want to fully expand BR2_DEFCONFIG here, so Kconfig will
651 # recognize that if it's still at its default $(CONFIG_DIR)/defconfig
652 COMMON_CONFIG_ENV = \
653 BR2_DEFCONFIG='$(call qstrip,$(value BR2_DEFCONFIG))' \
654 KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
655 KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
656 KCONFIG_TRISTATE=$(BUILD_DIR)/buildroot-config/tristate.config \
657 BUILDROOT_CONFIG=$(BUILDROOT_CONFIG) \
658 BR2_EXTERNAL=$(BR2_EXTERNAL)
660 xconfig: $(BUILD_DIR)/buildroot-config/qconf outputmakefile
661 @mkdir -p $(BUILD_DIR)/buildroot-config
662 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
664 gconfig: $(BUILD_DIR)/buildroot-config/gconf outputmakefile
665 @mkdir -p $(BUILD_DIR)/buildroot-config
666 @$(COMMON_CONFIG_ENV) srctree=$(TOPDIR) $< $(CONFIG_CONFIG_IN)
668 menuconfig: $(BUILD_DIR)/buildroot-config/mconf outputmakefile
669 @mkdir -p $(BUILD_DIR)/buildroot-config
670 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
672 nconfig: $(BUILD_DIR)/buildroot-config/nconf outputmakefile
673 @mkdir -p $(BUILD_DIR)/buildroot-config
674 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
676 config: $(BUILD_DIR)/buildroot-config/conf outputmakefile
677 @mkdir -p $(BUILD_DIR)/buildroot-config
678 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
680 oldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
681 mkdir -p $(BUILD_DIR)/buildroot-config
682 @$(COMMON_CONFIG_ENV) $< --oldconfig $(CONFIG_CONFIG_IN)
684 randconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
685 @mkdir -p $(BUILD_DIR)/buildroot-config
686 @$(COMMON_CONFIG_ENV) $< --randconfig $(CONFIG_CONFIG_IN)
688 allyesconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
689 @mkdir -p $(BUILD_DIR)/buildroot-config
690 @$(COMMON_CONFIG_ENV) $< --allyesconfig $(CONFIG_CONFIG_IN)
692 allnoconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
693 @mkdir -p $(BUILD_DIR)/buildroot-config
694 @$(COMMON_CONFIG_ENV) $< --allnoconfig $(CONFIG_CONFIG_IN)
696 randpackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
697 @mkdir -p $(BUILD_DIR)/buildroot-config
698 @grep -v BR2_PACKAGE_ $(BUILDROOT_CONFIG) > $(CONFIG_DIR)/.config.nopkg
699 @grep '^config BR2_PACKAGE_' Config.in.legacy | \
700 while read config pkg; do \
701 echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
702 @$(COMMON_CONFIG_ENV) \
703 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
704 $< --randconfig $(CONFIG_CONFIG_IN)
705 @rm -f $(CONFIG_DIR)/.config.nopkg
707 allyespackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
708 @mkdir -p $(BUILD_DIR)/buildroot-config
709 @grep -v BR2_PACKAGE_ $(BUILDROOT_CONFIG) > $(CONFIG_DIR)/.config.nopkg
710 @grep '^config BR2_PACKAGE_' Config.in.legacy | \
711 while read config pkg; do \
712 echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
713 @$(COMMON_CONFIG_ENV) \
714 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
715 $< --allyesconfig $(CONFIG_CONFIG_IN)
716 @rm -f $(CONFIG_DIR)/.config.nopkg
718 allnopackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
719 @mkdir -p $(BUILD_DIR)/buildroot-config
720 @grep -v BR2_PACKAGE_ $(BUILDROOT_CONFIG) > $(CONFIG_DIR)/.config.nopkg
721 @$(COMMON_CONFIG_ENV) \
722 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
723 $< --allnoconfig $(CONFIG_CONFIG_IN)
724 @rm -f $(CONFIG_DIR)/.config.nopkg
726 silentoldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
727 @mkdir -p $(BUILD_DIR)/buildroot-config
728 $(COMMON_CONFIG_ENV) $< --silentoldconfig $(CONFIG_CONFIG_IN)
730 olddefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
731 @mkdir -p $(BUILD_DIR)/buildroot-config
732 $(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN)
734 defconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
735 @mkdir -p $(BUILD_DIR)/buildroot-config
736 @$(COMMON_CONFIG_ENV) $< --defconfig$(if $(DEFCONFIG),=$(DEFCONFIG)) $(CONFIG_CONFIG_IN)
738 %_defconfig: $(BUILD_DIR)/buildroot-config/conf $(TOPDIR)/configs/%_defconfig outputmakefile
739 @mkdir -p $(BUILD_DIR)/buildroot-config
740 @$(COMMON_CONFIG_ENV) $< --defconfig=$(TOPDIR)/configs/$@ $(CONFIG_CONFIG_IN)
742 savedefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
743 @mkdir -p $(BUILD_DIR)/buildroot-config
744 @$(COMMON_CONFIG_ENV) $< \
745 --savedefconfig=$(if $(DEFCONFIG),$(DEFCONFIG),$(CONFIG_DIR)/defconfig) \
748 # check if download URLs are outdated
750 $(MAKE) DL_MODE=SOURCE_CHECK $(EXTRAMAKEARGS) source
752 .PHONY: defconfig savedefconfig
754 ################################################################################
756 # Cleanup and misc junk
758 ################################################################################
760 # outputmakefile generates a Makefile in the output directory, if using a
761 # separate output directory. This allows convenient use of make in the
764 ifeq ($(NEED_WRAPPER),y)
765 $(Q)$(TOPDIR)/support/scripts/mkmakefile $(TOPDIR) $(O)
768 # printvars prints all the variables currently defined in our Makefiles
771 $(sort $(.VARIABLES)), \
772 $(if $(filter-out environment% default automatic, \
774 $(info $V=$($V) ($(value $V)))))
777 rm -rf $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
778 $(STAMP_DIR) $(BUILD_DIR) $(BASE_DIR)/staging \
782 ifeq ($(DL_DIR),$(TOPDIR)/dl)
788 rm -rf $(BUILDROOT_CONFIG) $(CONFIG_DIR)/.config.old $(CONFIG_DIR)/.auto.deps
792 @echo ' clean - delete all files created by build'
793 @echo ' distclean - delete all non-source files (including .config)'
796 @echo ' all - make world'
797 @echo ' toolchain - build toolchain'
798 @echo ' <package>-rebuild - force recompile <package>'
799 @echo ' <package>-reconfigure - force reconfigure <package>'
801 @echo 'Configuration:'
802 @echo ' menuconfig - interactive curses-based configurator'
803 @echo ' nconfig - interactive ncurses-based configurator'
804 @echo ' xconfig - interactive Qt-based configurator'
805 @echo ' gconfig - interactive GTK-based configurator'
806 @echo ' oldconfig - resolve any unresolved symbols in .config'
807 @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps'
808 @echo ' olddefconfig - Same as silentoldconfig but sets new symbols to their default value'
809 @echo ' randconfig - New config with random answer to all options'
810 @echo ' defconfig - New config with default answer to all options'
811 @echo ' BR2_DEFCONFIG, if set, is used as input'
812 @echo ' savedefconfig - Save current config as ./defconfig (minimal config)'
813 @echo ' allyesconfig - New config where all options are accepted with yes'
814 @echo ' allnoconfig - New config where all options are answered with no'
815 @echo ' randpackageconfig - New config with random answer to package options'
816 @echo ' allyespackageconfig - New config where pkg options are accepted with yes'
817 @echo ' allnopackageconfig - New config where package options are answered with no'
818 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
819 @echo ' busybox-menuconfig - Run BusyBox menuconfig'
821 ifeq ($(BR2_LINUX_KERNEL),y)
822 @echo ' linux-menuconfig - Run Linux kernel menuconfig'
823 @echo ' linux-savedefconfig - Run Linux kernel savedefconfig'
825 ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
826 @echo ' uclibc-menuconfig - Run uClibc menuconfig'
828 ifeq ($(BR2_TARGET_BAREBOX),y)
829 @echo ' barebox-menuconfig - Run barebox menuconfig'
830 @echo ' barebox-savedefconfig - Run barebox savedefconfig'
833 @echo 'Documentation:'
834 @echo ' manual - build manual in all formats'
835 @echo ' manual-html - build manual in HTML'
836 @echo ' manual-split-html - build manual in split HTML'
837 @echo ' manual-pdf - build manual in PDF'
838 @echo ' manual-text - build manual in text'
839 @echo ' manual-epub - build manual in ePub'
841 @echo 'Miscellaneous:'
842 @echo ' source - download all sources needed for offline-build'
843 @echo ' source-check - check selected packages for valid download URLs'
844 @echo ' external-deps - list external packages used'
845 @echo ' legal-info - generate info about license compliance'
847 @echo ' make V=0|1 - 0 => quiet build (default), 1 => verbose build'
848 @echo ' make O=dir - Locate all output files in "dir", including .config'
850 @$(foreach b, $(sort $(notdir $(wildcard $(TOPDIR)/configs/*_defconfig))), \
851 printf " %-35s - Build for %s\\n" $(b) $(b:_defconfig=);)
853 @echo 'See docs/README, or generate the Buildroot manual for further details'
856 release: OUT=buildroot-$(BR2_VERSION)
858 # Create release tarballs. We need to fiddle a bit to add the generated
859 # documentation to the git output
861 git archive --format=tar --prefix=$(OUT)/ HEAD > $(OUT).tar
862 $(MAKE) O=$(OUT) manual-html manual-text manual-pdf
863 tar rf $(OUT).tar $(OUT)
864 gzip -9 -c < $(OUT).tar > $(OUT).tar.gz
865 bzip2 -9 -c < $(OUT).tar > $(OUT).tar.bz2
866 rm -rf $(OUT) $(OUT).tar
869 @echo $(BR2_VERSION_FULL)
871 include docs/manual/manual.mk
873 .PHONY: $(noconfig_targets)