1 # Makefile for buildroot2
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:=2012.11-rc2
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 %_defconfig savedefconfig allyesconfig allnoconfig silentoldconfig release \
60 randpackageconfig allyespackageconfig allnopackageconfig \
61 source-check print-version
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 # Pull in the user's configuration file
95 ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
96 -include $(CONFIG_DIR)/.config
99 # To put more focus on warnings, be less verbose as default
100 # Use 'make V=1' to see the full commands
102 ifeq ("$(origin V)", "command line")
106 ifndef KBUILD_VERBOSE
110 ifeq ($(KBUILD_VERBOSE),1)
121 # we want bash as shell
122 SHELL:=$(shell if [ -x "$$BASH" ]; then echo $$BASH; \
123 else if [ -x /bin/bash ]; then echo /bin/bash; \
124 else echo sh; fi; fi)
126 # kconfig uses CONFIG_SHELL
127 CONFIG_SHELL:=$(SHELL)
129 export SHELL CONFIG_SHELL quiet Q KBUILD_VERBOSE VERBOSE
139 HOSTCC:=$(shell which $(HOSTCC) || type -p $(HOSTCC) || echo gcc)
141 HOSTCC_NOCCACHE:=$(HOSTCC)
144 HOSTCXX:=$(shell which $(HOSTCXX) || type -p $(HOSTCXX) || echo g++)
146 HOSTCXX_NOCCACHE:=$(HOSTCXX)
162 HOSTAR:=$(shell which $(HOSTAR) || type -p $(HOSTAR) || echo ar)
163 HOSTAS:=$(shell which $(HOSTAS) || type -p $(HOSTAS) || echo as)
164 HOSTFC:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo || which g77 || type -p g77 || echo gfortran)
165 HOSTCPP:=$(shell which $(HOSTCPP) || type -p $(HOSTCPP) || echo cpp)
166 HOSTLD:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo ld)
167 HOSTLN:=$(shell which $(HOSTLN) || type -p $(HOSTLN) || echo ln)
168 HOSTNM:=$(shell which $(HOSTNM) || type -p $(HOSTNM) || echo nm)
170 export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD
171 export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE
173 # Make sure pkg-config doesn't look outside the buildroot tree
174 unexport PKG_CONFIG_PATH
176 # Having DESTDIR set in the environment confuses the installation
177 # steps of some packages.
180 # bash prints the name of the directory on 'cd <dir>' if CDPATH is
181 # set, so unset it here to not cause problems. Notice that the export
182 # line doesn't affect the environment of $(shell ..) calls, so
183 # explictly throw away any output from 'cd' here.
185 BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && pwd)
186 $(if $(BASE_DIR),, $(error output directory "$(O)" does not exist))
188 BUILD_DIR:=$(BASE_DIR)/build
191 ifeq ($(BR2_HAVE_DOT_CONFIG),y)
193 #############################################################
195 # Hide troublesome environment variables from sub processes
197 #############################################################
198 unexport CROSS_COMPILE
205 unexport GREP_OPTIONS
209 GNU_HOST_NAME:=$(shell support/gnuconfig/config.guess)
211 ##############################################################
213 # The list of stuff to build for the target toolchain
214 # along with the packages to build for the target.
216 ##############################################################
218 ifeq ($(BR2_CCACHE),y)
219 BASE_TARGETS += host-ccache
222 ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
223 BASE_TARGETS += uclibc-configured host-binutils cross_compiler uclibc-target-utils kernel-headers
225 BASE_TARGETS += uclibc
229 # silent mode requested?
230 QUIET:=$(if $(findstring s,$(MAKEFLAGS)),-q)
232 # Strip off the annoying quoting
233 ARCH:=$(call qstrip,$(BR2_ARCH))
235 KERNEL_ARCH:=$(shell echo "$(ARCH)" | sed -e "s/-.*//" \
236 -e s/i.86/i386/ -e s/sun4u/sparc64/ \
237 -e s/arm.*/arm/ -e s/sa110/arm/ \
238 -e s/aarch64/arm64/ \
239 -e s/bfin/blackfin/ \
240 -e s/parisc64/parisc/ \
241 -e s/powerpc64/powerpc/ \
242 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
245 ZCAT:=$(call qstrip,$(BR2_ZCAT))
246 BZCAT:=$(call qstrip,$(BR2_BZCAT))
247 XZCAT:=$(call qstrip,$(BR2_XZCAT))
248 TAR_OPTIONS=$(call qstrip,$(BR2_TAR_OPTIONS)) -xf
250 # packages compiled for the host go here
251 HOST_DIR:=$(call qstrip,$(BR2_HOST_DIR))
253 # locales to generate
254 GENERATE_LOCALE=$(call qstrip,$(BR2_GENERATE_LOCALE))
256 # stamp (dependency) files go here
257 STAMP_DIR:=$(BASE_DIR)/stamps
259 BINARIES_DIR:=$(BASE_DIR)/images
260 TARGET_DIR:=$(BASE_DIR)/target
261 TOOLCHAIN_DIR=$(BASE_DIR)/toolchain
262 TARGET_SKELETON=$(TOPDIR)/system/skeleton
264 LEGAL_INFO_DIR=$(BASE_DIR)/legal-info
265 REDIST_SOURCES_DIR=$(LEGAL_INFO_DIR)/sources
266 LICENSE_FILES_DIR=$(LEGAL_INFO_DIR)/licenses
267 LEGAL_MANIFEST_CSV=$(LEGAL_INFO_DIR)/manifest.csv
268 LEGAL_LICENSES_TXT=$(LEGAL_INFO_DIR)/licenses.txt
269 LEGAL_WARNINGS=$(LEGAL_INFO_DIR)/.warnings
270 LEGAL_REPORT=$(LEGAL_INFO_DIR)/README
272 # Location of a file giving a big fat warning that output/target
273 # should not be used as the root filesystem.
274 TARGET_DIR_WARNING_FILE=$(TARGET_DIR)/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
276 ifeq ($(BR2_CCACHE),y)
277 CCACHE:=$(HOST_DIR)/usr/bin/ccache
278 BUILDROOT_CACHE_DIR = $(call qstrip,$(BR2_CCACHE_DIR))
279 export BUILDROOT_CACHE_DIR
280 HOSTCC := $(CCACHE) $(HOSTCC)
281 HOSTCXX := $(CCACHE) $(HOSTCXX)
284 #############################################################
286 # You should probably leave this stuff alone unless you know
287 # what you are doing.
289 #############################################################
293 # Include legacy before the other things, because package .mk files
295 ifneq ($(BR2_DEPRECATED),y)
296 include Makefile.legacy
299 include package/Makefile.in
300 include support/dependencies/dependencies.mk
302 # We also need the various per-package makefiles, which also add
303 # each selected package to TARGETS if that package was selected
304 # in the .config file.
305 ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
306 include toolchain/toolchain-buildroot.mk
307 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
308 include toolchain/toolchain-external.mk
309 else ifeq ($(BR2_TOOLCHAIN_CTNG),y)
310 include toolchain/toolchain-crosstool-ng.mk
313 # Include the package override file if one has been provided in the
315 PACKAGE_OVERRIDE_FILE=$(call qstrip,$(BR2_PACKAGE_OVERRIDE_FILE))
316 ifneq ($(PACKAGE_OVERRIDE_FILE),)
317 -include $(PACKAGE_OVERRIDE_FILE)
320 include package/*/*.mk
322 include boot/common.mk
323 include linux/linux.mk
325 TARGETS+=target-finalize
327 ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
328 TARGETS+=target-purgelocales
331 ifneq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC)$(BR2_TOOLCHAIN_CTNG_eglibc)$(BR2_TOOLCHAIN_CTNG_glibc),)
332 ifneq ($(GENERATE_LOCALE),)
333 TARGETS+=target-generatelocales
337 include system/system.mk
340 TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
341 TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS) $(BASE_TARGETS))
342 TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
343 TARGETS_ALL:=$(patsubst %,__real_tgt_%,$(TARGETS))
345 # host-* dependencies have to be handled specially, as those aren't
346 # visible in Kconfig and hence not added to a variable like TARGETS.
347 # instead, find all the host-* targets listed in each <PKG>_DEPENDENCIES
348 # variable for each enabled target.
349 # Notice: this only works for newstyle gentargets/autotargets packages
350 TARGETS_HOST_DEPS = $(sort $(filter host-%,$(foreach dep,\
351 $(addsuffix _DEPENDENCIES,$(call UPPERCASE,$(TARGETS))),\
353 # Host packages can in turn have their own dependencies. Likewise find
354 # all the package names listed in the HOST_<PKG>_DEPENDENCIES for each
355 # host package found above. Ideally this should be done recursively until
356 # no more packages are found, but that's hard to do in make, so limit to
358 HOST_DEPS = $(sort $(foreach dep,\
359 $(addsuffix _DEPENDENCIES,$(call UPPERCASE,$(TARGETS_HOST_DEPS))),\
361 HOST_SOURCE += $(addsuffix -source,$(sort $(TARGETS_HOST_DEPS) $(HOST_DEPS)))
363 TARGETS_LEGAL_INFO:=$(patsubst %,%-legal-info,\
364 $(TARGETS) $(BASE_TARGETS) $(TARGETS_HOST_DEPS) $(HOST_DEPS))))
366 # all targets depend on the crosscompiler and it's prerequisites
367 $(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) %
369 dirs: $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
370 $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR)
372 $(BASE_TARGETS): dirs $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake
374 $(BUILD_DIR)/buildroot-config/auto.conf: $(CONFIG_DIR)/.config
375 $(MAKE) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig
377 prepare: $(BUILD_DIR)/buildroot-config/auto.conf
379 world: prepare dirs dependencies $(BASE_TARGETS) $(TARGETS_ALL)
381 .PHONY: all world dirs clean distclean source outputmakefile \
382 legal-info legal-info-prepare legal-info-clean \
383 $(BASE_TARGETS) $(TARGETS) $(TARGETS_ALL) \
384 $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) $(TARGETS_LEGAL_INFO) \
385 $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
386 $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR)
388 #############################################################
390 # staging and target directories do NOT list these as
391 # dependencies anywhere else
393 #############################################################
394 $(TOOLCHAIN_DIR) $(BUILD_DIR) $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR) $(LEGAL_INFO_DIR) $(REDIST_SOURCES_DIR):
398 @mkdir -p $(STAGING_DIR)/bin
399 @mkdir -p $(STAGING_DIR)/lib
400 @mkdir -p $(STAGING_DIR)/usr/lib
401 @mkdir -p $(STAGING_DIR)/usr/include
402 @mkdir -p $(STAGING_DIR)/usr/bin
403 @ln -snf $(STAGING_DIR) $(BASE_DIR)/staging
405 ifeq ($(BR2_ROOTFS_SKELETON_CUSTOM),y)
406 TARGET_SKELETON=$(BR2_ROOTFS_SKELETON_CUSTOM_PATH)
410 mkdir -p $(TARGET_DIR)
411 if ! [ -d "$(TARGET_DIR)/bin" ]; then \
412 if [ -d "$(TARGET_SKELETON)" ]; then \
413 cp -fa $(TARGET_SKELETON)/* $(TARGET_DIR)/; \
416 cp support/misc/target-dir-warning.txt $(TARGET_DIR_WARNING_FILE)
417 -find $(TARGET_DIR) -type d -name CVS -print0 -o -name .svn -print0 | xargs -0 rm -rf
418 -find $(TARGET_DIR) -type f \( -name .empty -o -name '*~' \) -print0 | xargs -0 rm -rf
421 $(TARGET_DIR): $(BUILD_DIR)/.root
423 STRIP_FIND_CMD = find $(TARGET_DIR)
424 ifneq (,$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS)))
425 STRIP_FIND_CMD += \( $(call finddirclauses,$(TARGET_DIR),$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS))) \) -prune -o
427 STRIP_FIND_CMD += -type f -perm +111
428 STRIP_FIND_CMD += -not \( $(call findfileclauses,libpthread*.so* $(call qstrip,$(BR2_STRIP_EXCLUDE_FILES))) \) -print
431 ifeq ($(BR2_HAVE_DEVFILES),y)
432 ( support/scripts/copy.sh $(STAGING_DIR) $(TARGET_DIR) )
434 rm -rf $(TARGET_DIR)/usr/include $(TARGET_DIR)/usr/share/aclocal \
435 $(TARGET_DIR)/usr/lib/pkgconfig $(TARGET_DIR)/usr/share/pkgconfig
436 find $(TARGET_DIR)/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
437 find $(TARGET_DIR)/usr/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
439 ifneq ($(BR2_PACKAGE_GDB),y)
440 rm -rf $(TARGET_DIR)/usr/share/gdb
442 ifneq ($(BR2_HAVE_DOCUMENTATION),y)
443 rm -rf $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/man
444 rm -rf $(TARGET_DIR)/usr/info $(TARGET_DIR)/usr/share/info
445 rm -rf $(TARGET_DIR)/usr/doc $(TARGET_DIR)/usr/share/doc
446 rm -rf $(TARGET_DIR)/usr/share/gtk-doc
447 -rmdir $(TARGET_DIR)/usr/share 2>/dev/null
449 ifeq ($(BR2_PACKAGE_PYTHON_PY_ONLY),y)
450 find $(TARGET_DIR)/usr/lib/ -name '*.pyc' -print0 | xargs -0 rm -f
452 ifeq ($(BR2_PACKAGE_PYTHON_PYC_ONLY),y)
453 find $(TARGET_DIR)/usr/lib/ -name '*.py' -print0 | xargs -0 rm -f
455 $(STRIP_FIND_CMD) | xargs $(STRIPCMD) 2>/dev/null || true
456 find $(TARGET_DIR)/lib/modules -type f -name '*.ko' | \
457 xargs -r $(KSTRIPCMD) || true
459 # See http://sourceware.org/gdb/wiki/FAQ, "GDB does not see any threads
460 # besides the one in which crash occurred; or SIGTRAP kills my program when
461 # I set a breakpoint"
462 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
463 find $(TARGET_DIR)/lib -type f -name 'libpthread*.so*' | \
464 xargs $(STRIPCMD) $(STRIP_STRIP_DEBUG) || true
467 mkdir -p $(TARGET_DIR)/etc
468 # Mandatory configuration file and auxilliary cache directory
469 # for recent versions of ldconfig
470 touch $(TARGET_DIR)/etc/ld.so.conf
471 mkdir -p $(TARGET_DIR)/var/cache/ldconfig
472 if [ -x "$(TARGET_CROSS)ldconfig" ]; \
474 $(TARGET_CROSS)ldconfig -r $(TARGET_DIR); \
476 /sbin/ldconfig -r $(TARGET_DIR); \
479 echo "NAME=Buildroot"; \
480 echo "VERSION=$(BR2_VERSION_FULL)"; \
481 echo "ID=buildroot"; \
482 echo "VERSION_ID=$(BR2_VERSION)"; \
483 echo "PRETTY_NAME=\"Buildroot $(BR2_VERSION)\"" \
484 ) > $(TARGET_DIR)/etc/os-release
486 ifneq ($(BR2_ROOTFS_POST_BUILD_SCRIPT),"")
487 @$(call MESSAGE,"Executing post-build script\(s\)")
488 @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_BUILD_SCRIPT)), \
489 $(s) $(TARGET_DIR)$(sep))
492 ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
493 LOCALE_WHITELIST=$(BUILD_DIR)/locales.nopurge
494 LOCALE_NOPURGE=$(call qstrip,$(BR2_ENABLE_LOCALE_WHITELIST))
497 rm -f $(LOCALE_WHITELIST)
498 for i in $(LOCALE_NOPURGE); do echo $$i >> $(LOCALE_WHITELIST); done
500 for dir in $(wildcard $(addprefix $(TARGET_DIR),/usr/share/locale /usr/share/X11/locale /usr/man /usr/share/man)); \
502 for lang in $$(cd $$dir; ls .|grep -v man); \
504 grep -qx $$lang $(LOCALE_WHITELIST) || rm -rf $$dir/$$lang; \
509 ifneq ($(GENERATE_LOCALE),)
510 # Generate locale data. Basically, we call the localedef program
511 # (built by the host-localedef package) for each locale. The input
512 # data comes preferably from the toolchain, or if the toolchain does
513 # not have them (Linaro toolchains), we use the ones available on the
515 target-generatelocales: host-localedef
516 $(Q)mkdir -p $(TARGET_DIR)/usr/lib/locale/
517 $(Q)for locale in $(GENERATE_LOCALE) ; do \
518 inputfile=`echo $${locale} | cut -f1 -d'.'` ; \
519 charmap=`echo $${locale} | cut -f2 -d'.'` ; \
520 if test -z "$${charmap}" ; then \
523 echo "Generating locale $${inputfile}.$${charmap}" ; \
524 I18NPATH=$(STAGING_DIR)/usr/share/i18n:/usr/share/i18n \
525 $(HOST_DIR)/usr/bin/localedef \
526 --prefix=$(TARGET_DIR) \
527 --`echo $(BR2_ENDIAN) | tr [A-Z] [a-z]`-endian \
528 -i $${inputfile} -f $${charmap} \
533 source: dirs $(TARGETS_SOURCE) $(HOST_SOURCE)
536 @$(MAKE) -Bs DL_MODE=SHOW_EXTERNAL_DEPS $(EXTRAMAKEARGS) source | sort -u
539 @rm -fr $(LEGAL_INFO_DIR)
541 legal-info-prepare: $(LEGAL_INFO_DIR)
542 @$(call MESSAGE,"Collecting legal info")
543 @$(call legal-license-file,buildroot,COPYING,COPYING)
544 @$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE)
545 @$(call legal-manifest,buildroot,$(BR2_VERSION_FULL),GPLv2+,COPYING,not saved)
546 @$(call legal-warning,the Buildroot source code has not been saved)
547 @$(call legal-warning,the toolchain has not been saved)
548 @cp $(CONFIG_DIR)/.config $(LEGAL_INFO_DIR)/buildroot.config
550 legal-info: dirs legal-info-clean legal-info-prepare $(REDIST_SOURCES_DIR) \
551 $(TARGETS_LEGAL_INFO)
552 @cat support/legal-info/README.header >>$(LEGAL_REPORT)
553 @if [ -r $(LEGAL_WARNINGS) ]; then \
554 cat support/legal-info/README.warnings-header \
555 $(LEGAL_WARNINGS) >>$(LEGAL_REPORT); \
556 cat $(LEGAL_WARNINGS); fi
557 @echo "Legal info produced in $(LEGAL_INFO_DIR)"
558 @rm -f $(LEGAL_WARNINGS)
563 else # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
568 # ---------------------------------------------------------------------------
570 HOSTCFLAGS=$(CFLAGS_FOR_BUILD)
573 $(BUILD_DIR)/buildroot-config/%onf:
574 mkdir -p $(@D)/lxdialog
575 $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)
577 COMMON_CONFIG_ENV = \
578 KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
579 KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
580 KCONFIG_TRISTATE=$(BUILD_DIR)/buildroot-config/tristate.config \
581 BUILDROOT_CONFIG=$(CONFIG_DIR)/.config
583 xconfig: $(BUILD_DIR)/buildroot-config/qconf outputmakefile
584 @mkdir -p $(BUILD_DIR)/buildroot-config
585 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
587 gconfig: $(BUILD_DIR)/buildroot-config/gconf outputmakefile
588 @mkdir -p $(BUILD_DIR)/buildroot-config
589 @$(COMMON_CONFIG_ENV) srctree=$(TOPDIR) $< $(CONFIG_CONFIG_IN)
591 menuconfig: $(BUILD_DIR)/buildroot-config/mconf outputmakefile
592 @mkdir -p $(BUILD_DIR)/buildroot-config
593 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
595 nconfig: $(BUILD_DIR)/buildroot-config/nconf outputmakefile
596 @mkdir -p $(BUILD_DIR)/buildroot-config
597 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
599 config: $(BUILD_DIR)/buildroot-config/conf outputmakefile
600 @mkdir -p $(BUILD_DIR)/buildroot-config
601 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
603 oldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
604 mkdir -p $(BUILD_DIR)/buildroot-config
605 @$(COMMON_CONFIG_ENV) $< --oldconfig $(CONFIG_CONFIG_IN)
607 randconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
608 @mkdir -p $(BUILD_DIR)/buildroot-config
609 @$(COMMON_CONFIG_ENV) $< --randconfig $(CONFIG_CONFIG_IN)
611 allyesconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
612 @mkdir -p $(BUILD_DIR)/buildroot-config
613 @$(COMMON_CONFIG_ENV) $< --allyesconfig $(CONFIG_CONFIG_IN)
615 allnoconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
616 @mkdir -p $(BUILD_DIR)/buildroot-config
617 @$(COMMON_CONFIG_ENV) $< --allnoconfig $(CONFIG_CONFIG_IN)
619 randpackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
620 @mkdir -p $(BUILD_DIR)/buildroot-config
621 @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg
622 @grep '^config BR2_PACKAGE_' Config.in.legacy | \
623 while read config pkg; do \
624 echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
625 @$(COMMON_CONFIG_ENV) \
626 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
627 $< --randconfig $(CONFIG_CONFIG_IN)
628 @rm -f $(CONFIG_DIR)/.config.nopkg
630 allyespackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
631 @mkdir -p $(BUILD_DIR)/buildroot-config
632 @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg
633 @grep '^config BR2_PACKAGE_' Config.in.legacy | \
634 while read config pkg; do \
635 echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
636 @$(COMMON_CONFIG_ENV) \
637 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
638 $< --allyesconfig $(CONFIG_CONFIG_IN)
639 @rm -f $(CONFIG_DIR)/.config.nopkg
641 allnopackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
642 @mkdir -p $(BUILD_DIR)/buildroot-config
643 @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg
644 @$(COMMON_CONFIG_ENV) \
645 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
646 $< --allnoconfig $(CONFIG_CONFIG_IN)
647 @rm -f $(CONFIG_DIR)/.config.nopkg
649 silentoldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
650 @mkdir -p $(BUILD_DIR)/buildroot-config
651 $(COMMON_CONFIG_ENV) $< --silentoldconfig $(CONFIG_CONFIG_IN)
653 defconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
654 @mkdir -p $(BUILD_DIR)/buildroot-config
655 @$(COMMON_CONFIG_ENV) $< --defconfig$(if $(BR2_DEFCONFIG),=$(BR2_DEFCONFIG)) $(CONFIG_CONFIG_IN)
657 %_defconfig: $(BUILD_DIR)/buildroot-config/conf $(TOPDIR)/configs/%_defconfig outputmakefile
658 @mkdir -p $(BUILD_DIR)/buildroot-config
659 @$(COMMON_CONFIG_ENV) $< --defconfig=$(TOPDIR)/configs/$@ $(CONFIG_CONFIG_IN)
661 savedefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
662 @mkdir -p $(BUILD_DIR)/buildroot-config
663 @$(COMMON_CONFIG_ENV) $< --savedefconfig=$(CONFIG_DIR)/defconfig $(CONFIG_CONFIG_IN)
665 # check if download URLs are outdated
667 $(MAKE) DL_MODE=SOURCE_CHECK $(EXTRAMAKEARGS) source
669 endif # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
671 #############################################################
673 # Cleanup and misc junk
675 #############################################################
677 # outputmakefile generates a Makefile in the output directory, if using a
678 # separate output directory. This allows convenient use of make in the
681 ifeq ($(NEED_WRAPPER),y)
682 $(Q)$(TOPDIR)/support/scripts/mkmakefile $(TOPDIR) $(O)
686 rm -rf $(STAGING_DIR) $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
687 $(STAMP_DIR) $(BUILD_DIR) $(TOOLCHAIN_DIR) $(BASE_DIR)/staging \
691 ifeq ($(DL_DIR),$(TOPDIR)/dl)
697 rm -rf $(CONFIG_DIR)/.config $(CONFIG_DIR)/.config.old $(CONFIG_DIR)/.auto.deps
699 cross: $(BASE_TARGETS)
703 @echo ' clean - delete all files created by build'
704 @echo ' distclean - delete all non-source files (including .config)'
707 @echo ' all - make world'
708 @echo ' <package>-rebuild - force recompile <package>'
709 @echo ' <package>-reconfigure - force reconfigure <package>'
711 @echo 'Configuration:'
712 @echo ' menuconfig - interactive curses-based configurator'
713 @echo ' nconfig - interactive ncurses-based configurator'
714 @echo ' xconfig - interactive Qt-based configurator'
715 @echo ' gconfig - interactive GTK-based configurator'
716 @echo ' oldconfig - resolve any unresolved symbols in .config'
717 @echo ' randconfig - New config with random answer to all options'
718 @echo ' defconfig - New config with default answer to all options'
719 @echo ' BR2_DEFCONFIG, if set, is used as input'
720 @echo ' savedefconfig - Save current config as ./defconfig (minimal config)'
721 @echo ' allyesconfig - New config where all options are accepted with yes'
722 @echo ' allnoconfig - New config where all options are answered with no'
723 @echo ' randpackageconfig - New config with random answer to package options'
724 @echo ' allyespackageconfig - New config where pkg options are accepted with yes'
725 @echo ' allnopackageconfig - New config where package options are answered with no'
726 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
727 @echo ' busybox-menuconfig - Run BusyBox menuconfig'
729 ifeq ($(BR2_LINUX_KERNEL),y)
730 @echo ' linux-menuconfig - Run Linux kernel menuconfig'
731 @echo ' linux-savedefconfig - Run Linux kernel savedefconfig'
733 ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
734 @echo ' uclibc-menuconfig - Run uClibc menuconfig'
736 ifeq ($(BR2_TOOLCHAIN_CTNG),y)
737 @echo ' ctng-menuconfig - Run crosstool-NG menuconfig'
739 ifeq ($(BR2_TARGET_BAREBOX),y)
740 @echo ' barebox-menuconfig - Run barebox menuconfig'
741 @echo ' barebox-savedefconfig - Run barebox savedefconfig'
744 @echo 'Documentation:'
745 @echo ' manual - build manual in HTML, split HTML, PDF and txt'
746 @echo ' manual-html - build manual in HTML'
747 @echo ' manual-split-html - build manual in split HTML'
748 @echo ' manual-pdf - build manual in PDF'
749 @echo ' manual-txt - build manual in txt'
750 @echo ' manual-epub - build manual in ePub'
752 @echo 'Miscellaneous:'
753 @echo ' source - download all sources needed for offline-build'
754 @echo ' source-check - check selected packages for valid download URLs'
755 @echo ' external-deps - list external packages used'
756 @echo ' legal-info - generate info about license compliance'
758 @echo ' make V=0|1 - 0 => quiet build (default), 1 => verbose build'
759 @echo ' make O=dir - Locate all output files in "dir", including .config'
761 @$(foreach b, $(sort $(notdir $(wildcard $(TOPDIR)/configs/*_defconfig))), \
762 printf " %-35s - Build for %s\\n" $(b) $(b:_defconfig=);)
764 @echo 'See docs/README, or generate the Buildroot manual for further details'
767 release: OUT=buildroot-$(BR2_VERSION)
769 # Create release tarballs. We need to fiddle a bit to add the generated
770 # documentation to the git output
772 git archive --format=tar --prefix=$(OUT)/ master > $(OUT).tar
773 $(MAKE) O=$(OUT) manual-html manual-txt manual-pdf
774 tar rf $(OUT).tar $(OUT)
775 gzip -9 -c < $(OUT).tar > $(OUT).tar.gz
776 bzip2 -9 -c < $(OUT).tar > $(OUT).tar.bz2
777 rm -rf $(OUT) $(OUT).tar
780 @echo $(BR2_VERSION_FULL)
782 include docs/manual/manual.mk
784 .PHONY: $(noconfig_targets)