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:=2013.02
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
175 unexport PKG_CONFIG_SYSROOT_DIR
177 # Having DESTDIR set in the environment confuses the installation
178 # steps of some packages.
181 # bash prints the name of the directory on 'cd <dir>' if CDPATH is
182 # set, so unset it here to not cause problems. Notice that the export
183 # line doesn't affect the environment of $(shell ..) calls, so
184 # explictly throw away any output from 'cd' here.
186 BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && pwd)
187 $(if $(BASE_DIR),, $(error output directory "$(O)" does not exist))
189 BUILD_DIR:=$(BASE_DIR)/build
192 ifeq ($(BR2_HAVE_DOT_CONFIG),y)
194 #############################################################
196 # Hide troublesome environment variables from sub processes
198 #############################################################
199 unexport CROSS_COMPILE
206 unexport GREP_OPTIONS
210 GNU_HOST_NAME:=$(shell support/gnuconfig/config.guess)
212 ##############################################################
214 # The list of stuff to build for the target toolchain
215 # along with the packages to build for the target.
217 ##############################################################
219 ifeq ($(BR2_CCACHE),y)
220 BASE_TARGETS += host-ccache
223 ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
224 BASE_TARGETS += uclibc-configured host-binutils cross_compiler uclibc-target-utils kernel-headers
226 BASE_TARGETS += uclibc
230 # silent mode requested?
231 QUIET:=$(if $(findstring s,$(MAKEFLAGS)),-q)
233 # Strip off the annoying quoting
234 ARCH:=$(call qstrip,$(BR2_ARCH))
236 KERNEL_ARCH:=$(shell echo "$(ARCH)" | sed -e "s/-.*//" \
237 -e s/i.86/i386/ -e s/sun4u/sparc64/ \
238 -e s/arm.*/arm/ -e s/sa110/arm/ \
239 -e s/aarch64/arm64/ \
240 -e s/bfin/blackfin/ \
241 -e s/parisc64/parisc/ \
242 -e s/powerpc64/powerpc/ \
243 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
246 ZCAT:=$(call qstrip,$(BR2_ZCAT))
247 BZCAT:=$(call qstrip,$(BR2_BZCAT))
248 XZCAT:=$(call qstrip,$(BR2_XZCAT))
249 TAR_OPTIONS=$(call qstrip,$(BR2_TAR_OPTIONS)) -xf
251 # packages compiled for the host go here
252 HOST_DIR:=$(call qstrip,$(BR2_HOST_DIR))
254 # locales to generate
255 GENERATE_LOCALE=$(call qstrip,$(BR2_GENERATE_LOCALE))
257 # stamp (dependency) files go here
258 STAMP_DIR:=$(BASE_DIR)/stamps
260 BINARIES_DIR:=$(BASE_DIR)/images
261 TARGET_DIR:=$(BASE_DIR)/target
262 TOOLCHAIN_DIR=$(BASE_DIR)/toolchain
263 TARGET_SKELETON=$(TOPDIR)/system/skeleton
265 LEGAL_INFO_DIR=$(BASE_DIR)/legal-info
266 REDIST_SOURCES_DIR=$(LEGAL_INFO_DIR)/sources
267 LICENSE_FILES_DIR=$(LEGAL_INFO_DIR)/licenses
268 LEGAL_MANIFEST_CSV=$(LEGAL_INFO_DIR)/manifest.csv
269 LEGAL_LICENSES_TXT=$(LEGAL_INFO_DIR)/licenses.txt
270 LEGAL_WARNINGS=$(LEGAL_INFO_DIR)/.warnings
271 LEGAL_REPORT=$(LEGAL_INFO_DIR)/README
273 # Location of a file giving a big fat warning that output/target
274 # should not be used as the root filesystem.
275 TARGET_DIR_WARNING_FILE=$(TARGET_DIR)/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
277 ifeq ($(BR2_CCACHE),y)
278 CCACHE:=$(HOST_DIR)/usr/bin/ccache
279 BUILDROOT_CACHE_DIR = $(call qstrip,$(BR2_CCACHE_DIR))
280 export BUILDROOT_CACHE_DIR
281 HOSTCC := $(CCACHE) $(HOSTCC)
282 HOSTCXX := $(CCACHE) $(HOSTCXX)
285 #############################################################
287 # You should probably leave this stuff alone unless you know
288 # what you are doing.
290 #############################################################
294 # Include legacy before the other things, because package .mk files
296 ifneq ($(BR2_DEPRECATED),y)
297 include Makefile.legacy
300 include package/Makefile.in
301 include support/dependencies/dependencies.mk
303 # We also need the various per-package makefiles, which also add
304 # each selected package to TARGETS if that package was selected
305 # in the .config file.
306 ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
307 include toolchain/toolchain-buildroot.mk
308 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
309 include toolchain/toolchain-external.mk
310 else ifeq ($(BR2_TOOLCHAIN_CTNG),y)
311 include toolchain/toolchain-crosstool-ng.mk
314 # Include the package override file if one has been provided in the
316 PACKAGE_OVERRIDE_FILE=$(call qstrip,$(BR2_PACKAGE_OVERRIDE_FILE))
317 ifneq ($(PACKAGE_OVERRIDE_FILE),)
318 -include $(PACKAGE_OVERRIDE_FILE)
321 include package/*/*.mk
323 include boot/common.mk
324 include linux/linux.mk
326 TARGETS+=target-finalize
328 ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
329 TARGETS+=target-purgelocales
332 ifneq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC)$(BR2_TOOLCHAIN_CTNG_eglibc)$(BR2_TOOLCHAIN_CTNG_glibc),)
333 ifneq ($(GENERATE_LOCALE),)
334 TARGETS+=target-generatelocales
338 include system/system.mk
341 TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
342 TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS) $(BASE_TARGETS))
343 TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
344 TARGETS_ALL:=$(patsubst %,__real_tgt_%,$(TARGETS))
346 # host-* dependencies have to be handled specially, as those aren't
347 # visible in Kconfig and hence not added to a variable like TARGETS.
348 # instead, find all the host-* targets listed in each <PKG>_DEPENDENCIES
349 # variable for each enabled target.
350 # Notice: this only works for newstyle gentargets/autotargets packages
351 TARGETS_HOST_DEPS = $(sort $(filter host-%,$(foreach dep,\
352 $(addsuffix _DEPENDENCIES,$(call UPPERCASE,$(TARGETS))),\
354 # Host packages can in turn have their own dependencies. Likewise find
355 # all the package names listed in the HOST_<PKG>_DEPENDENCIES for each
356 # host package found above. Ideally this should be done recursively until
357 # no more packages are found, but that's hard to do in make, so limit to
359 HOST_DEPS = $(sort $(foreach dep,\
360 $(addsuffix _DEPENDENCIES,$(call UPPERCASE,$(TARGETS_HOST_DEPS))),\
362 HOST_SOURCE += $(addsuffix -source,$(sort $(TARGETS_HOST_DEPS) $(HOST_DEPS)))
364 TARGETS_LEGAL_INFO:=$(patsubst %,%-legal-info,\
365 $(TARGETS) $(BASE_TARGETS) $(TARGETS_HOST_DEPS) $(HOST_DEPS))))
367 # all targets depend on the crosscompiler and it's prerequisites
368 $(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) %
370 dirs: $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
371 $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR)
373 $(BASE_TARGETS): dirs $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake
375 $(BUILD_DIR)/buildroot-config/auto.conf: $(CONFIG_DIR)/.config
376 $(MAKE) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig
378 prepare: $(BUILD_DIR)/buildroot-config/auto.conf
380 world: prepare dirs dependencies $(BASE_TARGETS) $(TARGETS_ALL)
382 .PHONY: all world dirs clean distclean source outputmakefile \
383 legal-info legal-info-prepare legal-info-clean \
384 $(BASE_TARGETS) $(TARGETS) $(TARGETS_ALL) \
385 $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) $(TARGETS_LEGAL_INFO) \
386 $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
387 $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR)
389 #############################################################
391 # staging and target directories do NOT list these as
392 # dependencies anywhere else
394 #############################################################
395 $(TOOLCHAIN_DIR) $(BUILD_DIR) $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR) $(LEGAL_INFO_DIR) $(REDIST_SOURCES_DIR):
399 @mkdir -p $(STAGING_DIR)/bin
400 @mkdir -p $(STAGING_DIR)/lib
401 @mkdir -p $(STAGING_DIR)/usr/lib
402 @mkdir -p $(STAGING_DIR)/usr/include
403 @mkdir -p $(STAGING_DIR)/usr/bin
404 @ln -snf $(STAGING_DIR) $(BASE_DIR)/staging
406 ifeq ($(BR2_ROOTFS_SKELETON_CUSTOM),y)
407 TARGET_SKELETON=$(BR2_ROOTFS_SKELETON_CUSTOM_PATH)
411 mkdir -p $(TARGET_DIR)
412 if ! [ -d "$(TARGET_DIR)/bin" ]; then \
413 if [ -d "$(TARGET_SKELETON)" ]; then \
414 cp -fa $(TARGET_SKELETON)/* $(TARGET_DIR)/; \
417 cp support/misc/target-dir-warning.txt $(TARGET_DIR_WARNING_FILE)
418 -find $(TARGET_DIR) -type d -name CVS -print0 -o -name .svn -print0 | xargs -0 rm -rf
419 -find $(TARGET_DIR) -type f \( -name .empty -o -name '*~' \) -print0 | xargs -0 rm -rf
422 $(TARGET_DIR): $(BUILD_DIR)/.root
424 STRIP_FIND_CMD = find $(TARGET_DIR)
425 ifneq (,$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS)))
426 STRIP_FIND_CMD += \( $(call finddirclauses,$(TARGET_DIR),$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS))) \) -prune -o
428 STRIP_FIND_CMD += -type f -perm +111
429 STRIP_FIND_CMD += -not \( $(call findfileclauses,libpthread*.so* $(call qstrip,$(BR2_STRIP_EXCLUDE_FILES))) \) -print
432 ifeq ($(BR2_HAVE_DEVFILES),y)
433 ( support/scripts/copy.sh $(STAGING_DIR) $(TARGET_DIR) )
435 rm -rf $(TARGET_DIR)/usr/include $(TARGET_DIR)/usr/share/aclocal \
436 $(TARGET_DIR)/usr/lib/pkgconfig $(TARGET_DIR)/usr/share/pkgconfig
437 find $(TARGET_DIR)/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
438 find $(TARGET_DIR)/usr/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
440 ifneq ($(BR2_PACKAGE_GDB),y)
441 rm -rf $(TARGET_DIR)/usr/share/gdb
443 ifneq ($(BR2_HAVE_DOCUMENTATION),y)
444 rm -rf $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/man
445 rm -rf $(TARGET_DIR)/usr/info $(TARGET_DIR)/usr/share/info
446 rm -rf $(TARGET_DIR)/usr/doc $(TARGET_DIR)/usr/share/doc
447 rm -rf $(TARGET_DIR)/usr/share/gtk-doc
448 -rmdir $(TARGET_DIR)/usr/share 2>/dev/null
450 ifeq ($(BR2_PACKAGE_PYTHON_PY_ONLY),y)
451 find $(TARGET_DIR)/usr/lib/ -name '*.pyc' -print0 | xargs -0 rm -f
453 ifeq ($(BR2_PACKAGE_PYTHON_PYC_ONLY),y)
454 find $(TARGET_DIR)/usr/lib/ -name '*.py' -print0 | xargs -0 rm -f
456 $(STRIP_FIND_CMD) | xargs $(STRIPCMD) 2>/dev/null || true
457 find $(TARGET_DIR)/lib/modules -type f -name '*.ko' | \
458 xargs -r $(KSTRIPCMD) || true
460 # See http://sourceware.org/gdb/wiki/FAQ, "GDB does not see any threads
461 # besides the one in which crash occurred; or SIGTRAP kills my program when
462 # I set a breakpoint"
463 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
464 find $(TARGET_DIR)/lib -type f -name 'libpthread*.so*' | \
465 xargs $(STRIPCMD) $(STRIP_STRIP_DEBUG) || true
468 mkdir -p $(TARGET_DIR)/etc
469 # Mandatory configuration file and auxilliary cache directory
470 # for recent versions of ldconfig
471 touch $(TARGET_DIR)/etc/ld.so.conf
472 mkdir -p $(TARGET_DIR)/var/cache/ldconfig
473 if [ -x "$(TARGET_CROSS)ldconfig" ]; \
475 $(TARGET_CROSS)ldconfig -r $(TARGET_DIR); \
477 /sbin/ldconfig -r $(TARGET_DIR); \
480 echo "NAME=Buildroot"; \
481 echo "VERSION=$(BR2_VERSION_FULL)"; \
482 echo "ID=buildroot"; \
483 echo "VERSION_ID=$(BR2_VERSION)"; \
484 echo "PRETTY_NAME=\"Buildroot $(BR2_VERSION)\"" \
485 ) > $(TARGET_DIR)/etc/os-release
487 ifneq ($(BR2_ROOTFS_POST_BUILD_SCRIPT),"")
488 @$(call MESSAGE,"Executing post-build script\(s\)")
489 @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_BUILD_SCRIPT)), \
490 $(s) $(TARGET_DIR)$(sep))
493 ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
494 LOCALE_WHITELIST=$(BUILD_DIR)/locales.nopurge
495 LOCALE_NOPURGE=$(call qstrip,$(BR2_ENABLE_LOCALE_WHITELIST))
498 rm -f $(LOCALE_WHITELIST)
499 for i in $(LOCALE_NOPURGE); do echo $$i >> $(LOCALE_WHITELIST); done
501 for dir in $(wildcard $(addprefix $(TARGET_DIR),/usr/share/locale /usr/share/X11/locale /usr/man /usr/share/man)); \
503 for lang in $$(cd $$dir; ls .|grep -v man); \
505 grep -qx $$lang $(LOCALE_WHITELIST) || rm -rf $$dir/$$lang; \
510 ifneq ($(GENERATE_LOCALE),)
511 # Generate locale data. Basically, we call the localedef program
512 # (built by the host-localedef package) for each locale. The input
513 # data comes preferably from the toolchain, or if the toolchain does
514 # not have them (Linaro toolchains), we use the ones available on the
516 target-generatelocales: host-localedef
517 $(Q)mkdir -p $(TARGET_DIR)/usr/lib/locale/
518 $(Q)for locale in $(GENERATE_LOCALE) ; do \
519 inputfile=`echo $${locale} | cut -f1 -d'.'` ; \
520 charmap=`echo $${locale} | cut -f2 -d'.'` ; \
521 if test -z "$${charmap}" ; then \
524 echo "Generating locale $${inputfile}.$${charmap}" ; \
525 I18NPATH=$(STAGING_DIR)/usr/share/i18n:/usr/share/i18n \
526 $(HOST_DIR)/usr/bin/localedef \
527 --prefix=$(TARGET_DIR) \
528 --`echo $(BR2_ENDIAN) | tr [A-Z] [a-z]`-endian \
529 -i $${inputfile} -f $${charmap} \
534 source: dirs $(TARGETS_SOURCE) $(HOST_SOURCE)
537 @$(MAKE) -Bs DL_MODE=SHOW_EXTERNAL_DEPS $(EXTRAMAKEARGS) source | sort -u
540 @rm -fr $(LEGAL_INFO_DIR)
542 legal-info-prepare: $(LEGAL_INFO_DIR)
543 @$(call MESSAGE,"Collecting legal info")
544 @$(call legal-license-file,buildroot,COPYING,COPYING)
545 @$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE)
546 @$(call legal-manifest,buildroot,$(BR2_VERSION_FULL),GPLv2+,COPYING,not saved)
547 @$(call legal-warning,the Buildroot source code has not been saved)
548 @$(call legal-warning,the toolchain has not been saved)
549 @cp $(CONFIG_DIR)/.config $(LEGAL_INFO_DIR)/buildroot.config
551 legal-info: dirs legal-info-clean legal-info-prepare $(REDIST_SOURCES_DIR) \
552 $(TARGETS_LEGAL_INFO)
553 @cat support/legal-info/README.header >>$(LEGAL_REPORT)
554 @if [ -r $(LEGAL_WARNINGS) ]; then \
555 cat support/legal-info/README.warnings-header \
556 $(LEGAL_WARNINGS) >>$(LEGAL_REPORT); \
557 cat $(LEGAL_WARNINGS); fi
558 @echo "Legal info produced in $(LEGAL_INFO_DIR)"
559 @rm -f $(LEGAL_WARNINGS)
564 else # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
569 # ---------------------------------------------------------------------------
571 HOSTCFLAGS=$(CFLAGS_FOR_BUILD)
574 $(BUILD_DIR)/buildroot-config/%onf:
575 mkdir -p $(@D)/lxdialog
576 $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)
578 COMMON_CONFIG_ENV = \
579 KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
580 KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
581 KCONFIG_TRISTATE=$(BUILD_DIR)/buildroot-config/tristate.config \
582 BUILDROOT_CONFIG=$(CONFIG_DIR)/.config
584 xconfig: $(BUILD_DIR)/buildroot-config/qconf outputmakefile
585 @mkdir -p $(BUILD_DIR)/buildroot-config
586 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
588 gconfig: $(BUILD_DIR)/buildroot-config/gconf outputmakefile
589 @mkdir -p $(BUILD_DIR)/buildroot-config
590 @$(COMMON_CONFIG_ENV) srctree=$(TOPDIR) $< $(CONFIG_CONFIG_IN)
592 menuconfig: $(BUILD_DIR)/buildroot-config/mconf outputmakefile
593 @mkdir -p $(BUILD_DIR)/buildroot-config
594 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
596 nconfig: $(BUILD_DIR)/buildroot-config/nconf outputmakefile
597 @mkdir -p $(BUILD_DIR)/buildroot-config
598 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
600 config: $(BUILD_DIR)/buildroot-config/conf outputmakefile
601 @mkdir -p $(BUILD_DIR)/buildroot-config
602 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
604 oldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
605 mkdir -p $(BUILD_DIR)/buildroot-config
606 @$(COMMON_CONFIG_ENV) $< --oldconfig $(CONFIG_CONFIG_IN)
608 randconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
609 @mkdir -p $(BUILD_DIR)/buildroot-config
610 @$(COMMON_CONFIG_ENV) $< --randconfig $(CONFIG_CONFIG_IN)
612 allyesconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
613 @mkdir -p $(BUILD_DIR)/buildroot-config
614 @$(COMMON_CONFIG_ENV) $< --allyesconfig $(CONFIG_CONFIG_IN)
616 allnoconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
617 @mkdir -p $(BUILD_DIR)/buildroot-config
618 @$(COMMON_CONFIG_ENV) $< --allnoconfig $(CONFIG_CONFIG_IN)
620 randpackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
621 @mkdir -p $(BUILD_DIR)/buildroot-config
622 @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg
623 @grep '^config BR2_PACKAGE_' Config.in.legacy | \
624 while read config pkg; do \
625 echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
626 @$(COMMON_CONFIG_ENV) \
627 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
628 $< --randconfig $(CONFIG_CONFIG_IN)
629 @rm -f $(CONFIG_DIR)/.config.nopkg
631 allyespackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
632 @mkdir -p $(BUILD_DIR)/buildroot-config
633 @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg
634 @grep '^config BR2_PACKAGE_' Config.in.legacy | \
635 while read config pkg; do \
636 echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
637 @$(COMMON_CONFIG_ENV) \
638 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
639 $< --allyesconfig $(CONFIG_CONFIG_IN)
640 @rm -f $(CONFIG_DIR)/.config.nopkg
642 allnopackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
643 @mkdir -p $(BUILD_DIR)/buildroot-config
644 @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg
645 @$(COMMON_CONFIG_ENV) \
646 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
647 $< --allnoconfig $(CONFIG_CONFIG_IN)
648 @rm -f $(CONFIG_DIR)/.config.nopkg
650 silentoldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
651 @mkdir -p $(BUILD_DIR)/buildroot-config
652 $(COMMON_CONFIG_ENV) $< --silentoldconfig $(CONFIG_CONFIG_IN)
654 defconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
655 @mkdir -p $(BUILD_DIR)/buildroot-config
656 @$(COMMON_CONFIG_ENV) $< --defconfig$(if $(BR2_DEFCONFIG),=$(BR2_DEFCONFIG)) $(CONFIG_CONFIG_IN)
658 %_defconfig: $(BUILD_DIR)/buildroot-config/conf $(TOPDIR)/configs/%_defconfig outputmakefile
659 @mkdir -p $(BUILD_DIR)/buildroot-config
660 @$(COMMON_CONFIG_ENV) $< --defconfig=$(TOPDIR)/configs/$@ $(CONFIG_CONFIG_IN)
662 savedefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
663 @mkdir -p $(BUILD_DIR)/buildroot-config
664 @$(COMMON_CONFIG_ENV) $< --savedefconfig=$(CONFIG_DIR)/defconfig $(CONFIG_CONFIG_IN)
666 # check if download URLs are outdated
668 $(MAKE) DL_MODE=SOURCE_CHECK $(EXTRAMAKEARGS) source
670 endif # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
672 #############################################################
674 # Cleanup and misc junk
676 #############################################################
678 # outputmakefile generates a Makefile in the output directory, if using a
679 # separate output directory. This allows convenient use of make in the
682 ifeq ($(NEED_WRAPPER),y)
683 $(Q)$(TOPDIR)/support/scripts/mkmakefile $(TOPDIR) $(O)
687 rm -rf $(STAGING_DIR) $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
688 $(STAMP_DIR) $(BUILD_DIR) $(TOOLCHAIN_DIR) $(BASE_DIR)/staging \
692 ifeq ($(DL_DIR),$(TOPDIR)/dl)
698 rm -rf $(CONFIG_DIR)/.config $(CONFIG_DIR)/.config.old $(CONFIG_DIR)/.auto.deps
700 cross: $(BASE_TARGETS)
704 @echo ' clean - delete all files created by build'
705 @echo ' distclean - delete all non-source files (including .config)'
708 @echo ' all - make world'
709 @echo ' <package>-rebuild - force recompile <package>'
710 @echo ' <package>-reconfigure - force reconfigure <package>'
712 @echo 'Configuration:'
713 @echo ' menuconfig - interactive curses-based configurator'
714 @echo ' nconfig - interactive ncurses-based configurator'
715 @echo ' xconfig - interactive Qt-based configurator'
716 @echo ' gconfig - interactive GTK-based configurator'
717 @echo ' oldconfig - resolve any unresolved symbols in .config'
718 @echo ' randconfig - New config with random answer to all options'
719 @echo ' defconfig - New config with default answer to all options'
720 @echo ' BR2_DEFCONFIG, if set, is used as input'
721 @echo ' savedefconfig - Save current config as ./defconfig (minimal config)'
722 @echo ' allyesconfig - New config where all options are accepted with yes'
723 @echo ' allnoconfig - New config where all options are answered with no'
724 @echo ' randpackageconfig - New config with random answer to package options'
725 @echo ' allyespackageconfig - New config where pkg options are accepted with yes'
726 @echo ' allnopackageconfig - New config where package options are answered with no'
727 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
728 @echo ' busybox-menuconfig - Run BusyBox menuconfig'
730 ifeq ($(BR2_LINUX_KERNEL),y)
731 @echo ' linux-menuconfig - Run Linux kernel menuconfig'
732 @echo ' linux-savedefconfig - Run Linux kernel savedefconfig'
734 ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
735 @echo ' uclibc-menuconfig - Run uClibc menuconfig'
737 ifeq ($(BR2_TOOLCHAIN_CTNG),y)
738 @echo ' ctng-menuconfig - Run crosstool-NG menuconfig'
740 ifeq ($(BR2_TARGET_BAREBOX),y)
741 @echo ' barebox-menuconfig - Run barebox menuconfig'
742 @echo ' barebox-savedefconfig - Run barebox savedefconfig'
745 @echo 'Documentation:'
746 @echo ' manual - build manual in HTML, split HTML, PDF and txt'
747 @echo ' manual-html - build manual in HTML'
748 @echo ' manual-split-html - build manual in split HTML'
749 @echo ' manual-pdf - build manual in PDF'
750 @echo ' manual-txt - build manual in txt'
751 @echo ' manual-epub - build manual in ePub'
753 @echo 'Miscellaneous:'
754 @echo ' source - download all sources needed for offline-build'
755 @echo ' source-check - check selected packages for valid download URLs'
756 @echo ' external-deps - list external packages used'
757 @echo ' legal-info - generate info about license compliance'
759 @echo ' make V=0|1 - 0 => quiet build (default), 1 => verbose build'
760 @echo ' make O=dir - Locate all output files in "dir", including .config'
762 @$(foreach b, $(sort $(notdir $(wildcard $(TOPDIR)/configs/*_defconfig))), \
763 printf " %-35s - Build for %s\\n" $(b) $(b:_defconfig=);)
765 @echo 'See docs/README, or generate the Buildroot manual for further details'
768 release: OUT=buildroot-$(BR2_VERSION)
770 # Create release tarballs. We need to fiddle a bit to add the generated
771 # documentation to the git output
773 git archive --format=tar --prefix=$(OUT)/ master > $(OUT).tar
774 $(MAKE) O=$(OUT) manual-html manual-txt manual-pdf
775 tar rf $(OUT).tar $(OUT)
776 gzip -9 -c < $(OUT).tar > $(OUT).tar.gz
777 bzip2 -9 -c < $(OUT).tar > $(OUT).tar.bz2
778 rm -rf $(OUT) $(OUT).tar
781 @echo $(BR2_VERSION_FULL)
783 include docs/manual/manual.mk
785 .PHONY: $(noconfig_targets)