1 # Makefile for buildroot
3 # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4 # Copyright (C) 2006-2014 by the Buildroot developers <buildroot@uclibc.org>
5 # Copyright (C) 2014 by the Buildroot developers <buildroot@buildroot.org>
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #--------------------------------------------------------------
23 # Just run 'make menuconfig', configure stuff, then run 'make'.
24 # You shouldn't need to mess with anything beyond this point...
25 #--------------------------------------------------------------
27 # Set and export the version string
28 export BR2_VERSION:=2014.02
30 # Check for minimal make version (note: this check will break at make 10.x)
32 ifneq ($(firstword $(sort $(MAKE_VERSION) $(MIN_MAKE_VERSION))),$(MIN_MAKE_VERSION))
33 $(error You have make '$(MAKE_VERSION)' installed. GNU make >= $(MIN_MAKE_VERSION) is required)
36 export HOSTARCH := $(shell uname -m | \
46 # This top-level Makefile can *not* be executed in parallel
51 CONFIG_CONFIG_IN=Config.in
52 CONFIG=support/kconfig
53 DATE:=$(shell date +%Y%m%d)
55 # Compute the full local version string so packages can use it as-is
56 # Need to export it, so it can be got from environment in children (eg. mconf)
57 export BR2_VERSION_FULL:=$(BR2_VERSION)$(shell $(TOPDIR)/support/scripts/setlocalversion)
59 noconfig_targets:=menuconfig nconfig gconfig xconfig config oldconfig randconfig \
60 defconfig %_defconfig allyesconfig allnoconfig silentoldconfig release \
61 randpackageconfig allyespackageconfig allnopackageconfig \
62 source-check print-version olddefconfig
64 # Strip quotes and then whitespaces
65 qstrip=$(strip $(subst ",,$(1)))
68 # Variables for use in Make constructs
71 space:=$(empty) $(empty)
73 ifneq ("$(origin O)", "command line")
78 # other packages might also support Linux-style out of tree builds
79 # with the O=<dir> syntax (E.G. Busybox does). As make automatically
80 # forwards command line variable definitions those packages get very
81 # confused. Fix this by telling make to not do so
83 # strangely enough O is still passed to submakes with MAKEOVERRIDES
84 # (with make 3.81 atleast), the only thing that changes is the output
85 # of the origin function (command line -> environment).
86 # Unfortunately some packages don't look at origin (E.G. uClibc 0.9.31+)
87 # To really make O go away, we have to override it.
90 # we need to pass O= everywhere we call back into the toplevel makefile
91 EXTRAMAKEARGS = O=$(O)
95 # bash prints the name of the directory on 'cd <dir>' if CDPATH is
96 # set, so unset it here to not cause problems. Notice that the export
97 # line doesn't affect the environment of $(shell ..) calls, so
98 # explictly throw away any output from 'cd' here.
100 BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && pwd)
101 $(if $(BASE_DIR),, $(error output directory "$(O)" does not exist))
104 # Handling of BR2_EXTERNAL.
106 # The value of BR2_EXTERNAL is stored in .br-external in the output directory.
107 # On subsequent invocations of make, it is read in. It can still be overridden
108 # on the command line, therefore the file is re-created every time make is run.
110 # When BR2_EXTERNAL is not set, the .br-external file is removed and we point
111 # to support/dummy-external. This makes sure we can unconditionally include the
112 # Config.in and external.mk from the BR2_EXTERNAL directory. In this case,
113 # override is necessary so the user can clear BR2_EXTERNAL from the command
114 # line, but the dummy path is still used internally.
116 BR2_EXTERNAL_FILE = $(BASE_DIR)/.br-external
117 -include $(BR2_EXTERNAL_FILE)
118 ifeq ($(BR2_EXTERNAL),)
119 override BR2_EXTERNAL = support/dummy-external
120 $(shell rm -f $(BR2_EXTERNAL_FILE))
122 _BR2_EXTERNAL = $(shell cd $(BR2_EXTERNAL) >/dev/null 2>&1 && pwd)
123 ifeq ($(_BR2_EXTERNAL),)
124 $(error BR2_EXTERNAL='$(BR2_EXTERNAL)' does not exist, relative to $(TOPDIR))
126 override BR2_EXTERNAL := $(_BR2_EXTERNAL)
127 $(shell echo BR2_EXTERNAL ?= $(BR2_EXTERNAL) > $(BR2_EXTERNAL_FILE))
130 # To make sure the the environment variable overrides the .config option,
131 # set this before including .config.
132 ifneq ($(BR2_DL_DIR),)
133 DL_DIR := $(BR2_DL_DIR)
137 # Need that early, before we scan packages
138 # Avoids doing the $(or...) everytime
139 _BR2_GRAPH_OUT := $(or $(BR2_GRAPH_OUT),pdf)
141 BUILD_DIR:=$(BASE_DIR)/build
142 STAMP_DIR:=$(BASE_DIR)/stamps
143 BINARIES_DIR:=$(BASE_DIR)/images
144 TARGET_DIR:=$(BASE_DIR)/target
145 # initial definition so that 'make clean' works for most users, even without
146 # .config. HOST_DIR will be overwritten later when .config is included.
147 HOST_DIR:=$(BASE_DIR)/host
149 LEGAL_INFO_DIR=$(BASE_DIR)/legal-info
150 REDIST_SOURCES_DIR_TARGET=$(LEGAL_INFO_DIR)/sources
151 REDIST_SOURCES_DIR_HOST=$(LEGAL_INFO_DIR)/host-sources
152 LICENSE_FILES_DIR_TARGET=$(LEGAL_INFO_DIR)/licenses
153 LICENSE_FILES_DIR_HOST=$(LEGAL_INFO_DIR)/host-licenses
154 LEGAL_MANIFEST_CSV_TARGET=$(LEGAL_INFO_DIR)/manifest.csv
155 LEGAL_MANIFEST_CSV_HOST=$(LEGAL_INFO_DIR)/host-manifest.csv
156 LEGAL_LICENSES_TXT_TARGET=$(LEGAL_INFO_DIR)/licenses.txt
157 LEGAL_LICENSES_TXT_HOST=$(LEGAL_INFO_DIR)/host-licenses.txt
158 LEGAL_WARNINGS=$(LEGAL_INFO_DIR)/.warnings
159 LEGAL_REPORT=$(LEGAL_INFO_DIR)/README
161 BR2_CONFIG=$(CONFIG_DIR)/.config
163 # Pull in the user's configuration file
164 ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
165 -include $(BR2_CONFIG)
168 # To put more focus on warnings, be less verbose as default
169 # Use 'make V=1' to see the full commands
171 ifeq ("$(origin V)", "command line")
175 ifndef KBUILD_VERBOSE
179 ifeq ($(KBUILD_VERBOSE),1)
190 # we want bash as shell
191 SHELL:=$(shell if [ -x "$$BASH" ]; then echo $$BASH; \
192 else if [ -x /bin/bash ]; then echo /bin/bash; \
193 else echo sh; fi; fi)
195 # kconfig uses CONFIG_SHELL
196 CONFIG_SHELL:=$(SHELL)
198 export SHELL CONFIG_SHELL quiet Q KBUILD_VERBOSE VERBOSE
208 HOSTCC:=$(shell which $(HOSTCC) || type -p $(HOSTCC) || echo gcc)
210 HOSTCC_NOCCACHE:=$(HOSTCC)
213 HOSTCXX:=$(shell which $(HOSTCXX) || type -p $(HOSTCXX) || echo g++)
215 HOSTCXX_NOCCACHE:=$(HOSTCXX)
237 HOSTAR:=$(shell which $(HOSTAR) || type -p $(HOSTAR) || echo ar)
238 HOSTAS:=$(shell which $(HOSTAS) || type -p $(HOSTAS) || echo as)
239 HOSTFC:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo || which g77 || type -p g77 || echo gfortran)
240 HOSTCPP:=$(shell which $(HOSTCPP) || type -p $(HOSTCPP) || echo cpp)
241 HOSTLD:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo ld)
242 HOSTLN:=$(shell which $(HOSTLN) || type -p $(HOSTLN) || echo ln)
243 HOSTNM:=$(shell which $(HOSTNM) || type -p $(HOSTNM) || echo nm)
244 HOSTOBJCOPY:=$(shell which $(HOSTOBJCOPY) || type -p $(HOSTOBJCOPY) || echo objcopy)
245 HOSTRANLIB:=$(shell which $(HOSTRANLIB) || type -p $(HOSTRANLIB) || echo ranlib)
247 export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD
248 export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE
250 # Make sure pkg-config doesn't look outside the buildroot tree
251 unexport PKG_CONFIG_PATH
252 unexport PKG_CONFIG_SYSROOT_DIR
253 unexport PKG_CONFIG_LIBDIR
255 # Having DESTDIR set in the environment confuses the installation
256 # steps of some packages.
259 # Causes breakage with packages that needs host-ruby
262 ifeq ($(BR2_HAVE_DOT_CONFIG),y)
264 ################################################################################
266 # Hide troublesome environment variables from sub processes
268 ################################################################################
269 unexport CROSS_COMPILE
276 unexport GREP_OPTIONS
282 GNU_HOST_NAME:=$(shell support/gnuconfig/config.guess)
284 ################################################################################
286 # The list of stuff to build for the target toolchain
287 # along with the packages to build for the target.
289 ################################################################################
291 BASE_TARGETS = toolchain
295 # silent mode requested?
296 QUIET:=$(if $(findstring s,$(MAKEFLAGS)),-q)
298 # Strip off the annoying quoting
299 ARCH:=$(call qstrip,$(BR2_ARCH))
301 KERNEL_ARCH:=$(shell echo "$(ARCH)" | sed -e "s/-.*//" \
302 -e s/i.86/i386/ -e s/sun4u/sparc64/ \
305 -e s/arm.*/arm/ -e s/sa110/arm/ \
306 -e s/aarch64/arm64/ \
307 -e s/bfin/blackfin/ \
308 -e s/parisc64/parisc/ \
309 -e s/powerpc64/powerpc/ \
310 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
313 ZCAT:=$(call qstrip,$(BR2_ZCAT))
314 BZCAT:=$(call qstrip,$(BR2_BZCAT))
315 XZCAT:=$(call qstrip,$(BR2_XZCAT))
316 TAR_OPTIONS=$(call qstrip,$(BR2_TAR_OPTIONS)) -xf
318 # packages compiled for the host go here
319 HOST_DIR:=$(call qstrip,$(BR2_HOST_DIR))
321 # locales to generate
322 GENERATE_LOCALE=$(call qstrip,$(BR2_GENERATE_LOCALE))
324 TARGET_SKELETON=$(TOPDIR)/system/skeleton
326 # Location of a file giving a big fat warning that output/target
327 # should not be used as the root filesystem.
328 TARGET_DIR_WARNING_FILE=$(TARGET_DIR)/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
330 ifeq ($(BR2_CCACHE),y)
331 CCACHE:=$(HOST_DIR)/usr/bin/ccache
332 BR_CACHE_DIR = $(call qstrip,$(BR2_CCACHE_DIR))
334 HOSTCC := $(CCACHE) $(HOSTCC)
335 HOSTCXX := $(CCACHE) $(HOSTCXX)
338 # Scripts in support/ or post-build scripts may need to reference
339 # these locations, so export them so it is easier to use
347 ################################################################################
349 # You should probably leave this stuff alone unless you know
350 # what you are doing.
352 ################################################################################
356 # Include legacy before the other things, because package .mk files
358 ifneq ($(BR2_DEPRECATED),y)
359 include Makefile.legacy
362 include package/Makefile.in
363 include support/dependencies/dependencies.mk
365 # We also need the various per-package makefiles, which also add
366 # each selected package to TARGETS if that package was selected
367 # in the .config file.
368 include toolchain/helpers.mk
369 include toolchain/*/*.mk
371 # Include the package override file if one has been provided in the
373 PACKAGE_OVERRIDE_FILE=$(call qstrip,$(BR2_PACKAGE_OVERRIDE_FILE))
374 ifneq ($(PACKAGE_OVERRIDE_FILE),)
375 -include $(PACKAGE_OVERRIDE_FILE)
378 include $(sort $(wildcard package/*/*.mk))
380 include boot/common.mk
381 include linux/linux.mk
382 include system/system.mk
384 include $(BR2_EXTERNAL)/external.mk
386 TARGETS+=target-finalize
388 ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
389 TARGETS+=target-purgelocales
392 ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),y)
393 ifneq ($(GENERATE_LOCALE),)
394 TARGETS+=target-generatelocales
398 ifeq ($(BR2_ECLIPSE_REGISTER),y)
399 TARGETS+=toolchain-eclipse-register
404 TARGETS+=target-post-image
406 TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS) $(BASE_TARGETS))
407 TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
408 TARGETS_ALL:=$(patsubst %,__real_tgt_%,$(TARGETS))
410 # host-* dependencies have to be handled specially, as those aren't
411 # visible in Kconfig and hence not added to a variable like TARGETS.
412 # instead, find all the host-* targets listed in each <PKG>_DEPENDENCIES
413 # variable for each enabled target.
414 # Notice: this only works for newstyle gentargets/autotargets packages
415 TARGETS_HOST_DEPS = $(sort $(filter host-%,$(foreach dep,\
416 $(addsuffix _DEPENDENCIES,$(call UPPERCASE,$(TARGETS))),\
418 # Host packages can in turn have their own dependencies. Likewise find
419 # all the package names listed in the HOST_<PKG>_DEPENDENCIES for each
420 # host package found above. Ideally this should be done recursively until
421 # no more packages are found, but that's hard to do in make, so limit to
423 HOST_DEPS = $(sort $(foreach dep,\
424 $(addsuffix _DEPENDENCIES,$(call UPPERCASE,$(TARGETS_HOST_DEPS))),\
426 HOST_SOURCE += $(addsuffix -source,$(sort $(TARGETS_HOST_DEPS) $(HOST_DEPS)))
428 TARGETS_LEGAL_INFO:=$(patsubst %,%-legal-info,\
429 $(TARGETS) $(BASE_TARGETS) $(TARGETS_HOST_DEPS) $(HOST_DEPS))))
431 # all targets depend on the crosscompiler and it's prerequisites
432 $(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) %
434 dirs: $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
435 $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR)
437 $(BUILD_DIR)/buildroot-config/auto.conf: $(BR2_CONFIG)
438 $(MAKE1) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig
440 prepare: $(BUILD_DIR)/buildroot-config/auto.conf
442 world: $(BASE_TARGETS) $(TARGETS_ALL)
444 .PHONY: all world toolchain dirs clean distclean source outputmakefile \
445 legal-info legal-info-prepare legal-info-clean printvars \
446 $(BASE_TARGETS) $(TARGETS) $(TARGETS_ALL) \
447 $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) $(TARGETS_LEGAL_INFO) \
448 $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
449 $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR)
451 ################################################################################
453 # staging and target directories do NOT list these as
454 # dependencies anywhere else
456 ################################################################################
457 $(BUILD_DIR) $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR) $(LEGAL_INFO_DIR) $(REDIST_SOURCES_DIR_TARGET) $(REDIST_SOURCES_DIR_HOST):
460 # We make a symlink lib32->lib or lib64->lib as appropriate
461 # MIPS64/n32 requires lib32 even though it's a 64-bit arch.
462 ifeq ($(BR2_ARCH_IS_64)$(BR2_MIPS_NABI32),y)
469 @mkdir -p $(STAGING_DIR)/bin
470 @mkdir -p $(STAGING_DIR)/lib
471 @ln -snf lib $(STAGING_DIR)/$(LIB_SYMLINK)
472 @mkdir -p $(STAGING_DIR)/usr/lib
473 @ln -snf lib $(STAGING_DIR)/usr/$(LIB_SYMLINK)
474 @mkdir -p $(STAGING_DIR)/usr/include
475 @mkdir -p $(STAGING_DIR)/usr/bin
476 @ln -snf $(STAGING_DIR) $(BASE_DIR)/staging
478 ifeq ($(BR2_ROOTFS_SKELETON_CUSTOM),y)
479 TARGET_SKELETON=$(BR2_ROOTFS_SKELETON_CUSTOM_PATH)
482 RSYNC_VCS_EXCLUSIONS = \
483 --exclude .svn --exclude .git --exclude .hg --exclude .bzr \
487 mkdir -p $(TARGET_DIR)
488 rsync -a --ignore-times $(RSYNC_VCS_EXCLUSIONS) \
489 --chmod=Du+w --exclude .empty --exclude '*~' \
490 $(TARGET_SKELETON)/ $(TARGET_DIR)/
491 $(INSTALL) -m 0644 support/misc/target-dir-warning.txt $(TARGET_DIR_WARNING_FILE)
492 @ln -snf lib $(TARGET_DIR)/$(LIB_SYMLINK)
493 @mkdir -p $(TARGET_DIR)/usr
494 @ln -snf lib $(TARGET_DIR)/usr/$(LIB_SYMLINK)
497 $(TARGET_DIR): $(BUILD_DIR)/.root
499 STRIP_FIND_CMD = find $(TARGET_DIR)
500 ifneq (,$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS)))
501 STRIP_FIND_CMD += \( $(call finddirclauses,$(TARGET_DIR),$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS))) \) -prune -o
503 STRIP_FIND_CMD += -type f \( -perm /111 -o -name '*.so*' \)
504 STRIP_FIND_CMD += -not \( $(call findfileclauses,libpthread*.so* $(call qstrip,$(BR2_STRIP_EXCLUDE_FILES))) \) -print
507 rm -rf $(TARGET_DIR)/usr/include $(TARGET_DIR)/usr/share/aclocal \
508 $(TARGET_DIR)/usr/lib/pkgconfig $(TARGET_DIR)/usr/share/pkgconfig \
509 $(TARGET_DIR)/usr/lib/cmake $(TARGET_DIR)/usr/share/cmake
510 find $(TARGET_DIR)/usr/{lib,share}/ -name '*.cmake' -print0 | xargs -0 rm -f
511 find $(TARGET_DIR)/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
512 find $(TARGET_DIR)/usr/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
513 ifneq ($(BR2_PACKAGE_GDB),y)
514 rm -rf $(TARGET_DIR)/usr/share/gdb
516 rm -rf $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/man
517 rm -rf $(TARGET_DIR)/usr/info $(TARGET_DIR)/usr/share/info
518 rm -rf $(TARGET_DIR)/usr/doc $(TARGET_DIR)/usr/share/doc
519 rm -rf $(TARGET_DIR)/usr/share/gtk-doc
520 -rmdir $(TARGET_DIR)/usr/share 2>/dev/null
521 ifeq ($(BR2_PACKAGE_PYTHON_PY_ONLY),y)
522 find $(TARGET_DIR)/usr/lib/ -name '*.pyc' -print0 | xargs -0 rm -f
524 ifeq ($(BR2_PACKAGE_PYTHON_PYC_ONLY),y)
525 find $(TARGET_DIR)/usr/lib/ -name '*.py' -print0 | xargs -0 rm -f
527 rm -rf $(TARGET_DIR)/usr/lib/luarocks
528 $(STRIP_FIND_CMD) | xargs $(STRIPCMD) 2>/dev/null || true
529 if test -d $(TARGET_DIR)/lib/modules; then \
530 find $(TARGET_DIR)/lib/modules -type f -name '*.ko' | \
531 xargs -r $(KSTRIPCMD); fi
533 # See http://sourceware.org/gdb/wiki/FAQ, "GDB does not see any threads
534 # besides the one in which crash occurred; or SIGTRAP kills my program when
535 # I set a breakpoint"
536 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
537 find $(TARGET_DIR)/lib -type f -name 'libpthread*.so*' | \
538 xargs -r $(STRIPCMD) $(STRIP_STRIP_DEBUG)
541 mkdir -p $(TARGET_DIR)/etc
542 # Mandatory configuration file and auxilliary cache directory
543 # for recent versions of ldconfig
544 touch $(TARGET_DIR)/etc/ld.so.conf
545 mkdir -p $(TARGET_DIR)/var/cache/ldconfig
546 if [ -x "$(TARGET_CROSS)ldconfig" ]; \
548 $(TARGET_CROSS)ldconfig -r $(TARGET_DIR); \
550 /sbin/ldconfig -r $(TARGET_DIR); \
553 echo "NAME=Buildroot"; \
554 echo "VERSION=$(BR2_VERSION_FULL)"; \
555 echo "ID=buildroot"; \
556 echo "VERSION_ID=$(BR2_VERSION)"; \
557 echo "PRETTY_NAME=\"Buildroot $(BR2_VERSION)\"" \
558 ) > $(TARGET_DIR)/etc/os-release
560 @$(foreach d, $(call qstrip,$(BR2_ROOTFS_OVERLAY)), \
561 $(call MESSAGE,"Copying overlay $(d)"); \
562 rsync -a --ignore-times $(RSYNC_VCS_EXCLUSIONS) \
563 --chmod=Du+w --exclude .empty --exclude '*~' \
564 $(d)/ $(TARGET_DIR)$(sep))
566 @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_BUILD_SCRIPT)), \
567 $(call MESSAGE,"Executing post-build script $(s)"); \
568 $(USER_HOOKS_EXTRA_ENV) $(s) $(TARGET_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
570 ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
571 LOCALE_WHITELIST=$(BUILD_DIR)/locales.nopurge
572 LOCALE_NOPURGE=$(call qstrip,$(BR2_ENABLE_LOCALE_WHITELIST))
575 rm -f $(LOCALE_WHITELIST)
576 for i in $(LOCALE_NOPURGE); do echo $$i >> $(LOCALE_WHITELIST); done
578 for dir in $(wildcard $(addprefix $(TARGET_DIR),/usr/share/locale /usr/share/X11/locale /usr/man /usr/share/man /usr/lib/locale)); \
580 for lang in $$(cd $$dir; ls .|grep -v man); \
582 grep -qx $$lang $(LOCALE_WHITELIST) || rm -rf $$dir/$$lang; \
587 ifneq ($(GENERATE_LOCALE),)
588 # Generate locale data. Basically, we call the localedef program
589 # (built by the host-localedef package) for each locale. The input
590 # data comes preferably from the toolchain, or if the toolchain does
591 # not have them (Linaro toolchains), we use the ones available on the
593 target-generatelocales: host-localedef
594 $(Q)mkdir -p $(TARGET_DIR)/usr/lib/locale/
595 $(Q)for locale in $(GENERATE_LOCALE) ; do \
596 inputfile=`echo $${locale} | cut -f1 -d'.'` ; \
597 charmap=`echo $${locale} | cut -f2 -d'.' -s` ; \
598 if test -z "$${charmap}" ; then \
601 echo "Generating locale $${inputfile}.$${charmap}" ; \
602 I18NPATH=$(STAGING_DIR)/usr/share/i18n:/usr/share/i18n \
603 $(HOST_DIR)/usr/bin/localedef \
604 --prefix=$(TARGET_DIR) \
605 --$(call LOWERCASE,$(BR2_ENDIAN))-endian \
606 -i $${inputfile} -f $${charmap} \
612 @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_IMAGE_SCRIPT)), \
613 $(call MESSAGE,"Executing post-image script $(s)"); \
614 $(USER_HOOKS_EXTRA_ENV) $(s) $(BINARIES_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
616 toolchain-eclipse-register:
617 ./support/scripts/eclipse-register-toolchain `readlink -f $(O)` $(notdir $(TARGET_CROSS)) $(BR2_ARCH)
619 source: dirs $(TARGETS_SOURCE) $(HOST_SOURCE)
622 @$(MAKE1) -Bs DL_MODE=SHOW_EXTERNAL_DEPS $(EXTRAMAKEARGS) source | sort -u
625 @rm -fr $(LEGAL_INFO_DIR)
627 legal-info-prepare: $(LEGAL_INFO_DIR)
628 @$(call MESSAGE,"Collecting legal info")
629 @$(call legal-license-file,buildroot,COPYING,COPYING,HOST)
630 @$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE,TARGET)
631 @$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE,HOST)
632 @$(call legal-manifest,buildroot,$(BR2_VERSION_FULL),GPLv2+,COPYING,not saved,HOST)
633 @$(call legal-warning,the Buildroot source code has not been saved)
634 @$(call legal-warning,the toolchain has not been saved)
635 @cp $(BR2_CONFIG) $(LEGAL_INFO_DIR)/buildroot.config
637 legal-info: dirs legal-info-clean legal-info-prepare $(TARGETS_LEGAL_INFO) \
638 $(REDIST_SOURCES_DIR_TARGET) $(REDIST_SOURCES_DIR_HOST)
639 @cat support/legal-info/README.header >>$(LEGAL_REPORT)
640 @if [ -r $(LEGAL_WARNINGS) ]; then \
641 cat support/legal-info/README.warnings-header \
642 $(LEGAL_WARNINGS) >>$(LEGAL_REPORT); \
643 cat $(LEGAL_WARNINGS); fi
644 @echo "Legal info produced in $(LEGAL_INFO_DIR)"
645 @rm -f $(LEGAL_WARNINGS)
650 graph-build: $(O)/build/build-time.log
651 @install -d $(O)/graphs
652 $(foreach o,name build duration,./support/scripts/graph-build-time \
653 --type=histogram --order=$(o) --input=$(<) \
654 --output=$(O)/graphs/build.hist-$(o).$(_BR2_GRAPH_OUT) \
655 $(if $(BR2_GRAPH_ALT),--alternate-colors)$(sep))
656 $(foreach t,packages steps,./support/scripts/graph-build-time \
657 --type=pie-$(t) --input=$(<) \
658 --output=$(O)/graphs/build.pie-$(t).$(_BR2_GRAPH_OUT) \
659 $(if $(BR2_GRAPH_ALT),--alternate-colors)$(sep))
662 @$(INSTALL) -d $(O)/graphs
663 @cd "$(CONFIG_DIR)"; \
664 $(TOPDIR)/support/scripts/graph-depends \
665 |dot -T$(_BR2_GRAPH_OUT) -o $(O)/graphs/$(@).$(_BR2_GRAPH_OUT)
667 else # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
671 endif # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
674 # ---------------------------------------------------------------------------
676 HOSTCFLAGS=$(CFLAGS_FOR_BUILD)
679 $(BUILD_DIR)/buildroot-config/%onf:
680 mkdir -p $(@D)/lxdialog
681 $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)
683 DEFCONFIG = $(call qstrip,$(BR2_DEFCONFIG))
685 # We don't want to fully expand BR2_DEFCONFIG here, so Kconfig will
686 # recognize that if it's still at its default $(CONFIG_DIR)/defconfig
687 COMMON_CONFIG_ENV = \
688 BR2_DEFCONFIG='$(call qstrip,$(value BR2_DEFCONFIG))' \
689 KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
690 KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
691 KCONFIG_TRISTATE=$(BUILD_DIR)/buildroot-config/tristate.config \
692 BR2_CONFIG=$(BR2_CONFIG) \
693 BR2_EXTERNAL=$(BR2_EXTERNAL)
695 xconfig: $(BUILD_DIR)/buildroot-config/qconf outputmakefile
696 @mkdir -p $(BUILD_DIR)/buildroot-config
697 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
699 gconfig: $(BUILD_DIR)/buildroot-config/gconf outputmakefile
700 @mkdir -p $(BUILD_DIR)/buildroot-config
701 @$(COMMON_CONFIG_ENV) srctree=$(TOPDIR) $< $(CONFIG_CONFIG_IN)
703 menuconfig: $(BUILD_DIR)/buildroot-config/mconf outputmakefile
704 @mkdir -p $(BUILD_DIR)/buildroot-config
705 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
707 nconfig: $(BUILD_DIR)/buildroot-config/nconf outputmakefile
708 @mkdir -p $(BUILD_DIR)/buildroot-config
709 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
711 config: $(BUILD_DIR)/buildroot-config/conf outputmakefile
712 @mkdir -p $(BUILD_DIR)/buildroot-config
713 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
715 oldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
716 mkdir -p $(BUILD_DIR)/buildroot-config
717 @$(COMMON_CONFIG_ENV) $< --oldconfig $(CONFIG_CONFIG_IN)
719 randconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
720 @mkdir -p $(BUILD_DIR)/buildroot-config
721 @$(COMMON_CONFIG_ENV) $< --randconfig $(CONFIG_CONFIG_IN)
723 allyesconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
724 @mkdir -p $(BUILD_DIR)/buildroot-config
725 @$(COMMON_CONFIG_ENV) $< --allyesconfig $(CONFIG_CONFIG_IN)
727 allnoconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
728 @mkdir -p $(BUILD_DIR)/buildroot-config
729 @$(COMMON_CONFIG_ENV) $< --allnoconfig $(CONFIG_CONFIG_IN)
731 randpackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
732 @mkdir -p $(BUILD_DIR)/buildroot-config
733 @grep -v BR2_PACKAGE_ $(BR2_CONFIG) > $(CONFIG_DIR)/.config.nopkg
734 @grep '^config BR2_PACKAGE_' Config.in.legacy | \
735 while read config pkg; do \
736 echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
737 @$(COMMON_CONFIG_ENV) \
738 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
739 $< --randconfig $(CONFIG_CONFIG_IN)
740 @rm -f $(CONFIG_DIR)/.config.nopkg
742 allyespackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
743 @mkdir -p $(BUILD_DIR)/buildroot-config
744 @grep -v BR2_PACKAGE_ $(BR2_CONFIG) > $(CONFIG_DIR)/.config.nopkg
745 @grep '^config BR2_PACKAGE_' Config.in.legacy | \
746 while read config pkg; do \
747 echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
748 @$(COMMON_CONFIG_ENV) \
749 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
750 $< --allyesconfig $(CONFIG_CONFIG_IN)
751 @rm -f $(CONFIG_DIR)/.config.nopkg
753 allnopackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
754 @mkdir -p $(BUILD_DIR)/buildroot-config
755 @grep -v BR2_PACKAGE_ $(BR2_CONFIG) > $(CONFIG_DIR)/.config.nopkg
756 @$(COMMON_CONFIG_ENV) \
757 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
758 $< --allnoconfig $(CONFIG_CONFIG_IN)
759 @rm -f $(CONFIG_DIR)/.config.nopkg
761 silentoldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
762 @mkdir -p $(BUILD_DIR)/buildroot-config
763 $(COMMON_CONFIG_ENV) $< --silentoldconfig $(CONFIG_CONFIG_IN)
765 olddefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
766 @mkdir -p $(BUILD_DIR)/buildroot-config
767 $(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN)
769 defconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
770 @mkdir -p $(BUILD_DIR)/buildroot-config
771 @$(COMMON_CONFIG_ENV) $< --defconfig$(if $(DEFCONFIG),=$(DEFCONFIG)) $(CONFIG_CONFIG_IN)
773 %_defconfig: $(BUILD_DIR)/buildroot-config/conf $(TOPDIR)/configs/%_defconfig outputmakefile
774 @mkdir -p $(BUILD_DIR)/buildroot-config
775 @$(COMMON_CONFIG_ENV) $< --defconfig=$(TOPDIR)/configs/$@ $(CONFIG_CONFIG_IN)
777 %_defconfig: $(BUILD_DIR)/buildroot-config/conf $(BR2_EXTERNAL)/configs/%_defconfig outputmakefile
778 @mkdir -p $(BUILD_DIR)/buildroot-config
779 @$(COMMON_CONFIG_ENV) $< --defconfig=$(BR2_EXTERNAL)/configs/$@ $(CONFIG_CONFIG_IN)
781 savedefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
782 @mkdir -p $(BUILD_DIR)/buildroot-config
783 @$(COMMON_CONFIG_ENV) $< \
784 --savedefconfig=$(if $(DEFCONFIG),$(DEFCONFIG),$(CONFIG_DIR)/defconfig) \
787 # check if download URLs are outdated
789 $(MAKE1) DL_MODE=SOURCE_CHECK $(EXTRAMAKEARGS) source
791 .PHONY: defconfig savedefconfig
793 ################################################################################
795 # Cleanup and misc junk
797 ################################################################################
799 # outputmakefile generates a Makefile in the output directory, if using a
800 # separate output directory. This allows convenient use of make in the
803 ifeq ($(NEED_WRAPPER),y)
804 $(Q)$(TOPDIR)/support/scripts/mkmakefile $(TOPDIR) $(O)
807 # printvars prints all the variables currently defined in our Makefiles
810 $(sort $(.VARIABLES)), \
811 $(if $(filter-out environment% default automatic, \
813 $(info $V=$($V) ($(value $V)))))
816 rm -rf $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
817 $(STAMP_DIR) $(BUILD_DIR) $(BASE_DIR)/staging \
821 ifeq ($(DL_DIR),$(TOPDIR)/dl)
827 rm -rf $(BR2_CONFIG) $(CONFIG_DIR)/.config.old $(CONFIG_DIR)/.auto.deps
831 @echo ' clean - delete all files created by build'
832 @echo ' distclean - delete all non-source files (including .config)'
835 @echo ' all - make world'
836 @echo ' toolchain - build toolchain'
837 @echo ' <package>-rebuild - force recompile <package>'
838 @echo ' <package>-reconfigure - force reconfigure <package>'
839 @echo ' <package>-graph-depends - generate graph of the dependency tree for package'
841 @echo 'Configuration:'
842 @echo ' menuconfig - interactive curses-based configurator'
843 @echo ' nconfig - interactive ncurses-based configurator'
844 @echo ' xconfig - interactive Qt-based configurator'
845 @echo ' gconfig - interactive GTK-based configurator'
846 @echo ' oldconfig - resolve any unresolved symbols in .config'
847 @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps'
848 @echo ' olddefconfig - Same as silentoldconfig but sets new symbols to their default value'
849 @echo ' randconfig - New config with random answer to all options'
850 @echo ' defconfig - New config with default answer to all options'
851 @echo ' BR2_DEFCONFIG, if set, is used as input'
852 @echo ' savedefconfig - Save current config as ./defconfig (minimal config)'
853 @echo ' allyesconfig - New config where all options are accepted with yes'
854 @echo ' allnoconfig - New config where all options are answered with no'
855 @echo ' randpackageconfig - New config with random answer to package options'
856 @echo ' allyespackageconfig - New config where pkg options are accepted with yes'
857 @echo ' allnopackageconfig - New config where package options are answered with no'
858 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
859 @echo ' busybox-menuconfig - Run BusyBox menuconfig'
861 ifeq ($(BR2_LINUX_KERNEL),y)
862 @echo ' linux-menuconfig - Run Linux kernel menuconfig'
863 @echo ' linux-savedefconfig - Run Linux kernel savedefconfig'
865 ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
866 @echo ' uclibc-menuconfig - Run uClibc menuconfig'
868 ifeq ($(BR2_TARGET_BAREBOX),y)
869 @echo ' barebox-menuconfig - Run barebox menuconfig'
870 @echo ' barebox-savedefconfig - Run barebox savedefconfig'
873 @echo 'Documentation:'
874 @echo ' manual - build manual in all formats'
875 @echo ' manual-html - build manual in HTML'
876 @echo ' manual-split-html - build manual in split HTML'
877 @echo ' manual-pdf - build manual in PDF'
878 @echo ' manual-text - build manual in text'
879 @echo ' manual-epub - build manual in ePub'
880 @echo ' graph-build - generate graphs of the build times'
881 @echo ' graph-depends - generate graph of the dependency tree'
883 @echo 'Miscellaneous:'
884 @echo ' source - download all sources needed for offline-build'
885 @echo ' source-check - check selected packages for valid download URLs'
886 @echo ' external-deps - list external packages used'
887 @echo ' legal-info - generate info about license compliance'
889 @echo ' make V=0|1 - 0 => quiet build (default), 1 => verbose build'
890 @echo ' make O=dir - Locate all output files in "dir", including .config'
892 @echo 'Built-in configs:'
893 @$(foreach b, $(sort $(notdir $(wildcard $(TOPDIR)/configs/*_defconfig))), \
894 printf " %-35s - Build for %s\\n" $(b) $(b:_defconfig=);)
895 ifneq ($(wildcard $(BR2_EXTERNAL)/configs/*_defconfig),)
897 @echo 'User-provided configs:'
898 @$(foreach b, $(sort $(notdir $(wildcard $(BR2_EXTERNAL)/configs/*_defconfig))), \
899 printf " %-35s - Build for %s\\n" $(b) $(b:_defconfig=);)
902 @echo 'See docs/README, or generate the Buildroot manual for further details'
905 release: OUT=buildroot-$(BR2_VERSION)
907 # Create release tarballs. We need to fiddle a bit to add the generated
908 # documentation to the git output
910 git archive --format=tar --prefix=$(OUT)/ HEAD > $(OUT).tar
911 $(MAKE) O=$(OUT) manual-html manual-text manual-pdf
912 tar rf $(OUT).tar $(OUT)
913 gzip -9 -c < $(OUT).tar > $(OUT).tar.gz
914 bzip2 -9 -c < $(OUT).tar > $(OUT).tar.bz2
915 rm -rf $(OUT) $(OUT).tar
918 @echo $(BR2_VERSION_FULL)
920 include docs/manual/manual.mk
922 .PHONY: $(noconfig_targets)