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.05-git
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 # Parallel execution of this Makefile is disabled because it changes
47 # the packages building order, that can be a problem for two reasons:
48 # - If a package has an unspecified optional dependency and that
49 # dependency is present when the package is built, it is used,
50 # otherwise it isn't (but compilation happily proceeds) so the end
51 # result will differ if the order is swapped due to parallel
53 # - Also changing the building order can be a problem if two packages
54 # manipulate the same file in the target directory.
56 # Taking into account the above considerations, if you still want to execute
57 # this top-level Makefile in parallel comment the ".NOTPARALLEL" line and
58 # build using the following command:
59 # make BR2_JLEVEL= -j$((`getconf _NPROCESSORS_ONLN`+1))
64 CONFIG_CONFIG_IN
=Config.in
65 CONFIG
=support
/kconfig
66 DATE
:=$(shell date
+%Y
%m
%d
)
68 # Compute the full local version string so packages can use it as-is
69 # Need to export it, so it can be got from environment in children (eg. mconf)
70 export BR2_VERSION_FULL
:=$(BR2_VERSION
)$(shell $(TOPDIR
)/support
/scripts
/setlocalversion
)
72 noconfig_targets
:=menuconfig nconfig gconfig xconfig config oldconfig randconfig \
73 defconfig
%_defconfig allyesconfig allnoconfig silentoldconfig release \
74 randpackageconfig allyespackageconfig allnopackageconfig \
75 source-check print-version olddefconfig
77 # Strip quotes and then whitespaces
78 qstrip
=$(strip $(subst ",,$(1)))
81 # Variables for use in Make constructs
84 space
:=$(empty
) $(empty
)
86 ifneq ("$(origin O)", "command line")
91 # other packages might also support Linux-style out of tree builds
92 # with the O=<dir> syntax (E.G. Busybox does). As make automatically
93 # forwards command line variable definitions those packages get very
94 # confused. Fix this by telling make to not do so
96 # strangely enough O is still passed to submakes with MAKEOVERRIDES
97 # (with make 3.81 atleast), the only thing that changes is the output
98 # of the origin function (command line -> environment).
99 # Unfortunately some packages don't look at origin (E.G. uClibc 0.9.31+)
100 # To really make O go away, we have to override it.
103 # we need to pass O= everywhere we call back into the toplevel makefile
104 EXTRAMAKEARGS
= O
=$(O
)
108 # bash prints the name of the directory on 'cd <dir>' if CDPATH is
109 # set, so unset it here to not cause problems. Notice that the export
110 # line doesn't affect the environment of $(shell ..) calls, so
111 # explictly throw away any output from 'cd' here.
113 BASE_DIR
:= $(shell mkdir
-p
$(O
) && cd
$(O
) >/dev
/null
&& pwd
)
114 $(if
$(BASE_DIR
),, $(error output directory
"$(O)" does not exist
))
117 # Handling of BR2_EXTERNAL.
119 # The value of BR2_EXTERNAL is stored in .br-external in the output directory.
120 # On subsequent invocations of make, it is read in. It can still be overridden
121 # on the command line, therefore the file is re-created every time make is run.
123 # When BR2_EXTERNAL is not set, the .br-external file is removed and we point
124 # to support/dummy-external. This makes sure we can unconditionally include the
125 # Config.in and external.mk from the BR2_EXTERNAL directory. In this case,
126 # override is necessary so the user can clear BR2_EXTERNAL from the command
127 # line, but the dummy path is still used internally.
129 BR2_EXTERNAL_FILE
= $(BASE_DIR
)/.br-external
130 -include $(BR2_EXTERNAL_FILE
)
131 ifeq ($(BR2_EXTERNAL
),)
132 override BR2_EXTERNAL
= support
/dummy-external
133 $(shell rm -f
$(BR2_EXTERNAL_FILE
))
135 _BR2_EXTERNAL
= $(shell cd
$(BR2_EXTERNAL
) >/dev
/null
2>&1 && pwd
)
136 ifeq ($(_BR2_EXTERNAL
),)
137 $(error BR2_EXTERNAL
='$(BR2_EXTERNAL)' does not exist
, relative to
$(TOPDIR
))
139 override BR2_EXTERNAL
:= $(_BR2_EXTERNAL
)
140 $(shell echo BR2_EXTERNAL ?
= $(BR2_EXTERNAL
) > $(BR2_EXTERNAL_FILE
))
143 # To make sure the the environment variable overrides the .config option,
144 # set this before including .config.
145 ifneq ($(BR2_DL_DIR
),)
146 DL_DIR
:= $(BR2_DL_DIR
)
150 # Need that early, before we scan packages
151 # Avoids doing the $(or...) everytime
152 _BR2_GRAPH_OUT
:= $(or
$(BR2_GRAPH_OUT
),pdf
)
154 BUILD_DIR
:=$(BASE_DIR
)/build
155 BINARIES_DIR
:=$(BASE_DIR
)/images
156 TARGET_DIR
:=$(BASE_DIR
)/target
157 # initial definition so that 'make clean' works for most users, even without
158 # .config. HOST_DIR will be overwritten later when .config is included.
159 HOST_DIR
:=$(BASE_DIR
)/host
161 LEGAL_INFO_DIR
=$(BASE_DIR
)/legal-info
162 REDIST_SOURCES_DIR_TARGET
=$(LEGAL_INFO_DIR
)/sources
163 REDIST_SOURCES_DIR_HOST
=$(LEGAL_INFO_DIR
)/host-sources
164 LICENSE_FILES_DIR_TARGET
=$(LEGAL_INFO_DIR
)/licenses
165 LICENSE_FILES_DIR_HOST
=$(LEGAL_INFO_DIR
)/host-licenses
166 LEGAL_MANIFEST_CSV_TARGET
=$(LEGAL_INFO_DIR
)/manifest.csv
167 LEGAL_MANIFEST_CSV_HOST
=$(LEGAL_INFO_DIR
)/host-manifest.csv
168 LEGAL_LICENSES_TXT_TARGET
=$(LEGAL_INFO_DIR
)/licenses.txt
169 LEGAL_LICENSES_TXT_HOST
=$(LEGAL_INFO_DIR
)/host-licenses.txt
170 LEGAL_WARNINGS
=$(LEGAL_INFO_DIR
)/.warnings
171 LEGAL_REPORT
=$(LEGAL_INFO_DIR
)/README
173 BR2_CONFIG
=$(CONFIG_DIR
)/.config
175 # Pull in the user's configuration file
176 ifeq ($(filter $(noconfig_targets
),$(MAKECMDGOALS
)),)
177 -include $(BR2_CONFIG
)
180 # To put more focus on warnings, be less verbose as default
181 # Use 'make V=1' to see the full commands
183 ifeq ("$(origin V)", "command line")
187 ifndef KBUILD_VERBOSE
191 ifeq ($(KBUILD_VERBOSE
),1)
202 # we want bash as shell
203 SHELL
:=$(shell if
[ -x
"$$BASH" ]; then echo
$$BASH; \
204 else if
[ -x
/bin
/bash
]; then echo
/bin
/bash
; \
205 else echo sh
; fi
; fi
)
207 # kconfig uses CONFIG_SHELL
208 CONFIG_SHELL
:=$(SHELL
)
210 export SHELL CONFIG_SHELL quiet Q KBUILD_VERBOSE VERBOSE
220 HOSTCC
:=$(shell which
$(HOSTCC
) || type
-p
$(HOSTCC
) || echo gcc
)
222 HOSTCC_NOCCACHE
:=$(HOSTCC
)
225 HOSTCXX
:=$(shell which
$(HOSTCXX
) || type
-p
$(HOSTCXX
) || echo g
++)
227 HOSTCXX_NOCCACHE
:=$(HOSTCXX
)
249 HOSTAR
:=$(shell which
$(HOSTAR
) || type
-p
$(HOSTAR
) || echo
ar)
250 HOSTAS
:=$(shell which
$(HOSTAS
) || type
-p
$(HOSTAS
) || echo
as)
251 HOSTFC
:=$(shell which
$(HOSTLD
) || type
-p
$(HOSTLD
) || echo || which g77 || type
-p g77 || echo gfortran
)
252 HOSTCPP
:=$(shell which
$(HOSTCPP
) || type
-p
$(HOSTCPP
) || echo
cpp)
253 HOSTLD
:=$(shell which
$(HOSTLD
) || type
-p
$(HOSTLD
) || echo
ld)
254 HOSTLN
:=$(shell which
$(HOSTLN
) || type
-p
$(HOSTLN
) || echo ln
)
255 HOSTNM
:=$(shell which
$(HOSTNM
) || type
-p
$(HOSTNM
) || echo nm
)
256 HOSTOBJCOPY
:=$(shell which
$(HOSTOBJCOPY
) || type
-p
$(HOSTOBJCOPY
) || echo objcopy
)
257 HOSTRANLIB
:=$(shell which
$(HOSTRANLIB
) || type
-p
$(HOSTRANLIB
) || echo ranlib
)
259 export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD
260 export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE
262 # Make sure pkg-config doesn't look outside the buildroot tree
263 unexport PKG_CONFIG_PATH
264 unexport PKG_CONFIG_SYSROOT_DIR
265 unexport PKG_CONFIG_LIBDIR
267 # Having DESTDIR set in the environment confuses the installation
268 # steps of some packages.
271 # Causes breakage with packages that needs host-ruby
274 ifeq ($(BR2_HAVE_DOT_CONFIG
),y
)
276 ################################################################################
278 # Hide troublesome environment variables from sub processes
280 ################################################################################
281 unexport CROSS_COMPILE
288 unexport GREP_OPTIONS
294 GNU_HOST_NAME
:=$(shell support
/gnuconfig
/config.guess
)
296 ################################################################################
298 # The list of stuff to build for the target toolchain
299 # along with the packages to build for the target.
301 ################################################################################
305 # silent mode requested?
306 QUIET
:=$(if
$(findstring s
,$(MAKEFLAGS
)),-q
)
308 # Strip off the annoying quoting
309 ARCH
:=$(call qstrip
,$(BR2_ARCH
))
311 KERNEL_ARCH
:=$(shell echo
"$(ARCH)" | sed
-e
"s/-.*//" \
312 -e s
/i
.86/i386
/ -e s
/sun4u
/sparc64
/ \
315 -e s
/arm.
*/arm
/ -e s
/sa110
/arm
/ \
316 -e s
/aarch64
/arm64
/ \
317 -e s
/bfin
/blackfin
/ \
318 -e s
/parisc64
/parisc
/ \
319 -e s
/powerpc64
/powerpc
/ \
320 -e s
/ppc.
*/powerpc
/ -e s
/mips.
*/mips
/ \
322 -e s
/microblazeel
/microblaze
/)
324 ZCAT
:=$(call qstrip
,$(BR2_ZCAT
))
325 BZCAT
:=$(call qstrip
,$(BR2_BZCAT
))
326 XZCAT
:=$(call qstrip
,$(BR2_XZCAT
))
327 TAR_OPTIONS
=$(call qstrip
,$(BR2_TAR_OPTIONS
)) -xf
329 # packages compiled for the host go here
330 HOST_DIR
:=$(call qstrip
,$(BR2_HOST_DIR
))
332 # locales to generate
333 GENERATE_LOCALE
=$(call qstrip
,$(BR2_GENERATE_LOCALE
))
335 TARGET_SKELETON
=$(TOPDIR
)/system
/skeleton
337 # Location of a file giving a big fat warning that output/target
338 # should not be used as the root filesystem.
339 TARGET_DIR_WARNING_FILE
=$(TARGET_DIR
)/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
341 ifeq ($(BR2_CCACHE
),y
)
342 CCACHE
:=$(HOST_DIR
)/usr
/bin
/ccache
343 BR_CACHE_DIR
= $(call qstrip
,$(BR2_CCACHE_DIR
))
345 HOSTCC
:= $(CCACHE
) $(HOSTCC
)
346 HOSTCXX
:= $(CCACHE
) $(HOSTCXX
)
349 # Scripts in support/ or post-build scripts may need to reference
350 # these locations, so export them so it is easier to use
358 ################################################################################
360 # You should probably leave this stuff alone unless you know
361 # what you are doing.
363 ################################################################################
367 # Include legacy before the other things, because package .mk files
369 ifneq ($(BR2_DEPRECATED
),y
)
370 include Makefile.legacy
373 include package
/Makefile.in
374 include support
/dependencies
/dependencies.mk
376 # We also need the various per-package makefiles, which also add
377 # each selected package to TARGETS if that package was selected
378 # in the .config file.
379 include toolchain
/helpers.mk
380 include toolchain
/*/*.mk
382 # Include the package override file if one has been provided in the
384 PACKAGE_OVERRIDE_FILE
=$(call qstrip
,$(BR2_PACKAGE_OVERRIDE_FILE
))
385 ifneq ($(PACKAGE_OVERRIDE_FILE
),)
386 -include $(PACKAGE_OVERRIDE_FILE
)
389 include $(sort $(wildcard package
/*/*.mk
))
391 include boot
/common.mk
392 include linux
/linux.mk
393 include system
/system.mk
395 include $(BR2_EXTERNAL
)/external.mk
397 ifeq ($(BR2_ENABLE_LOCALE_PURGE
),y
)
398 TARGETS
+=target-purgelocales
401 ifeq ($(BR2_TOOLCHAIN_USES_GLIBC
),y
)
402 ifneq ($(GENERATE_LOCALE
),)
403 TARGETS
+=target-generatelocales
407 ifeq ($(BR2_ECLIPSE_REGISTER
),y
)
408 TARGETS
+=toolchain-eclipse-register
413 TARGETS_SOURCE
:=$(patsubst %,%-source
,$(TARGETS
))
414 TARGETS_DIRCLEAN
:=$(patsubst %,%-dirclean
,$(TARGETS
))
416 # host-* dependencies have to be handled specially, as those aren't
417 # visible in Kconfig and hence not added to a variable like TARGETS.
418 # instead, find all the host-* targets listed in each <PKG>_DEPENDENCIES
419 # variable for each enabled target.
420 # Notice: this only works for newstyle gentargets/autotargets packages
421 TARGETS_HOST_DEPS
= $(sort $(filter host-
%,$(foreach dep
,\
422 $(addsuffix _DEPENDENCIES
,\
423 $(call UPPERCASE
,$(TARGETS
) $(TARGETS_ROOTFS
))),\
425 # Host packages can in turn have their own dependencies. Likewise find
426 # all the package names listed in the HOST_<PKG>_DEPENDENCIES for each
427 # host package found above. Ideally this should be done recursively until
428 # no more packages are found, but that's hard to do in make, so limit to
430 HOST_DEPS
= $(sort $(foreach dep
,\
431 $(addsuffix _DEPENDENCIES
,$(call UPPERCASE
,$(TARGETS_HOST_DEPS
))),\
433 HOST_SOURCE
+= $(addsuffix -source
,$(sort $(TARGETS_HOST_DEPS
) $(HOST_DEPS
)))
435 TARGETS_LEGAL_INFO
:=$(patsubst %,%-legal-info
,\
436 $(TARGETS
) $(TARGETS_HOST_DEPS
) $(HOST_DEPS
))))
438 dirs
: $(BUILD_DIR
) $(STAGING_DIR
) $(TARGET_DIR
) \
439 $(HOST_DIR
) $(BINARIES_DIR
)
441 $(BUILD_DIR
)/buildroot-config
/auto.conf
: $(BR2_CONFIG
)
442 $(MAKE1
) $(EXTRAMAKEARGS
) HOSTCC
="$(HOSTCC_NOCCACHE)" HOSTCXX
="$(HOSTCXX_NOCCACHE)" silentoldconfig
444 prepare
: $(BUILD_DIR
)/buildroot-config
/auto.conf
446 # Add base dependencies to all targets even on those not based on the
448 $(TARGETS
): dirs prepare dependencies
450 world
: target-post-image
452 .PHONY
: all world toolchain dirs
clean distclean source outputmakefile \
453 legal-info legal-info-prepare legal-info-clean printvars \
454 target-finalize target-post-image \
455 $(TARGETS
) $(TARGETS_ROOTFS
) \
456 $(TARGETS_DIRCLEAN
) $(TARGETS_SOURCE
) $(TARGETS_LEGAL_INFO
) \
457 $(BUILD_DIR
) $(STAGING_DIR
) $(TARGET_DIR
) \
458 $(HOST_DIR
) $(BINARIES_DIR
)
460 ################################################################################
462 # staging and target directories do NOT list these as
463 # dependencies anywhere else
465 ################################################################################
466 $(BUILD_DIR
) $(HOST_DIR
) $(BINARIES_DIR
) $(LEGAL_INFO_DIR
) $(REDIST_SOURCES_DIR_TARGET
) $(REDIST_SOURCES_DIR_HOST
):
469 # We make a symlink lib32->lib or lib64->lib as appropriate
470 # MIPS64/n32 requires lib32 even though it's a 64-bit arch.
471 ifeq ($(BR2_ARCH_IS_64
)$(BR2_MIPS_NABI32
),y
)
478 @mkdir
-p
$(STAGING_DIR
)/bin
479 @mkdir
-p
$(STAGING_DIR
)/lib
480 @ln
-snf lib
$(STAGING_DIR
)/$(LIB_SYMLINK
)
481 @mkdir
-p
$(STAGING_DIR
)/usr
/lib
482 @ln
-snf lib
$(STAGING_DIR
)/usr
/$(LIB_SYMLINK
)
483 @mkdir
-p
$(STAGING_DIR
)/usr
/include
484 @mkdir
-p
$(STAGING_DIR
)/usr
/bin
485 @ln
-snf
$(STAGING_DIR
) $(BASE_DIR
)/staging
487 ifeq ($(BR2_ROOTFS_SKELETON_CUSTOM
),y
)
488 TARGET_SKELETON
=$(BR2_ROOTFS_SKELETON_CUSTOM_PATH
)
491 RSYNC_VCS_EXCLUSIONS
= \
492 --exclude .svn
--exclude .git
--exclude .hg
--exclude .bzr \
496 mkdir
-p
$(TARGET_DIR
)
497 rsync
-a
--ignore-times
$(RSYNC_VCS_EXCLUSIONS
) \
498 --chmod
=Du
+w
--exclude .empty
--exclude
'*~' \
499 $(TARGET_SKELETON
)/ $(TARGET_DIR
)/
500 $(INSTALL
) -m
0644 support
/misc
/target-dir-warning.txt
$(TARGET_DIR_WARNING_FILE
)
501 @ln
-snf lib
$(TARGET_DIR
)/$(LIB_SYMLINK
)
502 @mkdir
-p
$(TARGET_DIR
)/usr
503 @ln
-snf lib
$(TARGET_DIR
)/usr
/$(LIB_SYMLINK
)
506 $(TARGET_DIR
): $(BUILD_DIR
)/.root
508 STRIP_FIND_CMD
= find
$(TARGET_DIR
)
509 ifneq (,$(call qstrip
,$(BR2_STRIP_EXCLUDE_DIRS
)))
510 STRIP_FIND_CMD
+= \
( $(call finddirclauses
,$(TARGET_DIR
),$(call qstrip
,$(BR2_STRIP_EXCLUDE_DIRS
))) \
) -prune
-o
512 STRIP_FIND_CMD
+= -type f \
( -perm
/111 -o
-name
'*.so*' \
)
513 STRIP_FIND_CMD
+= -not \
( $(call findfileclauses
,libpthread
*.so
* $(call qstrip
,$(BR2_STRIP_EXCLUDE_FILES
))) \
) -print
515 $(TARGETS_ROOTFS
): target-finalize
517 target-finalize
: $(TARGETS
)
518 rm -rf
$(TARGET_DIR
)/usr
/include $(TARGET_DIR
)/usr
/share
/aclocal \
519 $(TARGET_DIR
)/usr
/lib
/pkgconfig
$(TARGET_DIR
)/usr
/share
/pkgconfig \
520 $(TARGET_DIR
)/usr
/lib
/cmake
$(TARGET_DIR
)/usr
/share
/cmake
521 find
$(TARGET_DIR
)/usr
/{lib
,share
}/ -name
'*.cmake' -print0 | xargs
-0 rm -f
522 find
$(TARGET_DIR
)/lib \
( -name
'*.a' -o
-name
'*.la' \
) -print0 | xargs
-0 rm -f
523 find
$(TARGET_DIR
)/usr
/lib \
( -name
'*.a' -o
-name
'*.la' \
) -print0 | xargs
-0 rm -f
524 ifneq ($(BR2_PACKAGE_GDB
),y
)
525 rm -rf
$(TARGET_DIR
)/usr
/share
/gdb
527 rm -rf
$(TARGET_DIR
)/usr
/man
$(TARGET_DIR
)/usr
/share
/man
528 rm -rf
$(TARGET_DIR
)/usr
/info $(TARGET_DIR
)/usr
/share
/info
529 rm -rf
$(TARGET_DIR
)/usr
/doc
$(TARGET_DIR
)/usr
/share
/doc
530 rm -rf
$(TARGET_DIR
)/usr
/share
/gtk-doc
531 -rmdir
$(TARGET_DIR
)/usr
/share
2>/dev
/null
532 ifeq ($(BR2_PACKAGE_PYTHON_PY_ONLY
)$(BR2_PACKAGE_PYTHON3_PY_ONLY
),y
)
533 find
$(TARGET_DIR
)/usr
/lib
/ -name
'*.pyc' -print0 | xargs
-0 rm -f
535 ifeq ($(BR2_PACKAGE_PYTHON_PYC_ONLY
)$(BR2_PACKAGE_PYTHON3_PYC_ONLY
),y
)
536 find
$(TARGET_DIR
)/usr
/lib
/ -name
'*.py' -print0 | xargs
-0 rm -f
538 rm -rf
$(TARGET_DIR
)/usr
/lib
/luarocks
539 $(STRIP_FIND_CMD
) | xargs
$(STRIPCMD
) 2>/dev
/null || true
540 if
test -d
$(TARGET_DIR
)/lib
/modules
; then \
541 find
$(TARGET_DIR
)/lib
/modules
-type f
-name
'*.ko' | \
542 xargs
-r
$(KSTRIPCMD
); fi
544 # See http://sourceware.org/gdb/wiki/FAQ, "GDB does not see any threads
545 # besides the one in which crash occurred; or SIGTRAP kills my program when
546 # I set a breakpoint"
547 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS
),y
)
548 find
$(TARGET_DIR
)/lib
-type f
-name
'libpthread*.so*' | \
549 xargs
-r
$(STRIPCMD
) $(STRIP_STRIP_DEBUG
)
552 mkdir
-p
$(TARGET_DIR
)/etc
553 # Mandatory configuration file and auxilliary cache directory
554 # for recent versions of ldconfig
555 touch
$(TARGET_DIR
)/etc
/ld.so.conf
556 mkdir
-p
$(TARGET_DIR
)/var
/cache
/ldconfig
557 if
[ -x
"$(TARGET_CROSS)ldconfig" ]; \
559 $(TARGET_CROSS
)ldconfig
-r
$(TARGET_DIR
); \
561 /sbin
/ldconfig
-r
$(TARGET_DIR
); \
564 echo
"NAME=Buildroot"; \
565 echo
"VERSION=$(BR2_VERSION_FULL)"; \
566 echo
"ID=buildroot"; \
567 echo
"VERSION_ID=$(BR2_VERSION)"; \
568 echo
"PRETTY_NAME=\"Buildroot $(BR2_VERSION)\"" \
569 ) > $(TARGET_DIR
)/etc
/os-release
571 @
$(foreach d
, $(call qstrip
,$(BR2_ROOTFS_OVERLAY
)), \
572 $(call MESSAGE
,"Copying overlay $(d)"); \
573 rsync
-a
--ignore-times
$(RSYNC_VCS_EXCLUSIONS
) \
574 --chmod
=Du
+w
--exclude .empty
--exclude
'*~' \
575 $(d
)/ $(TARGET_DIR
)$(sep
))
577 @
$(foreach s
, $(call qstrip
,$(BR2_ROOTFS_POST_BUILD_SCRIPT
)), \
578 $(call MESSAGE
,"Executing post-build script $(s)"); \
579 $(USER_HOOKS_EXTRA_ENV
) $(s
) $(TARGET_DIR
) $(call qstrip
,$(BR2_ROOTFS_POST_SCRIPT_ARGS
))$(sep
))
581 ifeq ($(BR2_ENABLE_LOCALE_PURGE
),y
)
582 LOCALE_WHITELIST
=$(BUILD_DIR
)/locales.nopurge
583 LOCALE_NOPURGE
=$(call qstrip
,$(BR2_ENABLE_LOCALE_WHITELIST
))
586 rm -f
$(LOCALE_WHITELIST
)
587 for i in
$(LOCALE_NOPURGE
); do echo
$$i >> $(LOCALE_WHITELIST
); done
589 for
dir in
$(wildcard $(addprefix $(TARGET_DIR
),/usr
/share
/locale
/usr
/share
/X11
/locale
/usr
/man
/usr
/share
/man
/usr
/lib
/locale
)); \
591 for lang in
$$(cd
$$dir; ls .|grep
-v man
); \
593 grep
-qx
$$lang $(LOCALE_WHITELIST
) ||
rm -rf
$$dir/$$lang; \
598 ifneq ($(GENERATE_LOCALE
),)
599 # Generate locale data. Basically, we call the localedef program
600 # (built by the host-localedef package) for each locale. The input
601 # data comes preferably from the toolchain, or if the toolchain does
602 # not have them (Linaro toolchains), we use the ones available on the
604 target-generatelocales
: host-localedef
605 $(Q
)mkdir
-p
$(TARGET_DIR
)/usr
/lib
/locale
/
606 $(Q
)for locale in
$(GENERATE_LOCALE
) ; do \
607 inputfile
=`echo $${locale} | cut -f1 -d'.'` ; \
608 charmap
=`echo $${locale} | cut -f2 -d'.' -s` ; \
609 if
test -z
"$${charmap}" ; then \
612 echo
"Generating locale $${inputfile}.$${charmap}" ; \
613 I18NPATH
=$(STAGING_DIR
)/usr
/share
/i18n
:/usr
/share
/i18n \
614 $(HOST_DIR
)/usr
/bin
/localedef \
615 --prefix=$(TARGET_DIR
) \
616 --$(call LOWERCASE
,$(BR2_ENDIAN
))-endian \
617 -i
$${inputfile} -f
$${charmap} \
622 target-post-image
: $(TARGETS_ROOTFS
) target-finalize
623 @
$(foreach s
, $(call qstrip
,$(BR2_ROOTFS_POST_IMAGE_SCRIPT
)), \
624 $(call MESSAGE
,"Executing post-image script $(s)"); \
625 $(USER_HOOKS_EXTRA_ENV
) $(s
) $(BINARIES_DIR
) $(call qstrip
,$(BR2_ROOTFS_POST_SCRIPT_ARGS
))$(sep
))
627 toolchain-eclipse-register
:
628 .
/support
/scripts
/eclipse-register-toolchain
`readlink -f $(O)` $(notdir $(TARGET_CROSS
)) $(BR2_ARCH
)
630 source
: $(TARGETS_SOURCE
) $(HOST_SOURCE
)
633 @
$(MAKE1
) -Bs DL_MODE
=SHOW_EXTERNAL_DEPS
$(EXTRAMAKEARGS
) source |
sort -u
636 @
rm -fr
$(LEGAL_INFO_DIR
)
638 legal-info-prepare
: $(LEGAL_INFO_DIR
)
639 @
$(call MESSAGE
,"Collecting legal info")
640 @
$(call legal-license-file
,buildroot
,COPYING
,COPYING
,HOST
)
641 @
$(call legal-manifest
,PACKAGE
,VERSION
,LICENSE
,LICENSE FILES
,SOURCE ARCHIVE
,TARGET
)
642 @
$(call legal-manifest
,PACKAGE
,VERSION
,LICENSE
,LICENSE FILES
,SOURCE ARCHIVE
,HOST
)
643 @
$(call legal-manifest
,buildroot
,$(BR2_VERSION_FULL
),GPLv2
+,COPYING
,not saved
,HOST
)
644 @
$(call legal-warning
,the Buildroot source code has not been saved
)
645 @
$(call legal-warning
,the toolchain has not been saved
)
646 @cp
$(BR2_CONFIG
) $(LEGAL_INFO_DIR
)/buildroot.config
648 legal-info
: dirs legal-info-clean legal-info-prepare
$(TARGETS_LEGAL_INFO
) \
649 $(REDIST_SOURCES_DIR_TARGET
) $(REDIST_SOURCES_DIR_HOST
)
650 @cat support
/legal-info
/README.header
>>$(LEGAL_REPORT
)
651 @if
[ -r
$(LEGAL_WARNINGS
) ]; then \
652 cat support
/legal-info
/README.warnings-header \
653 $(LEGAL_WARNINGS
) >>$(LEGAL_REPORT
); \
654 cat
$(LEGAL_WARNINGS
); fi
655 @echo
"Legal info produced in $(LEGAL_INFO_DIR)"
656 @
rm -f
$(LEGAL_WARNINGS
)
659 @echo
$(TARGETS
) $(TARGETS_ROOTFS
)
661 graph-build
: $(O
)/build
/build-time.log
662 @
install -d
$(O
)/graphs
663 $(foreach o
,name build duration
,.
/support
/scripts
/graph-build-time \
664 --type
=histogram
--order
=$(o
) --input
=$(<) \
665 --output
=$(O
)/graphs
/build.hist-
$(o
).
$(_BR2_GRAPH_OUT
) \
666 $(if
$(BR2_GRAPH_ALT
),--alternate-colors
)$(sep
))
667 $(foreach t
,packages steps
,.
/support
/scripts
/graph-build-time \
668 --type
=pie-
$(t
) --input
=$(<) \
669 --output
=$(O
)/graphs
/build.pie-
$(t
).
$(_BR2_GRAPH_OUT
) \
670 $(if
$(BR2_GRAPH_ALT
),--alternate-colors
)$(sep
))
673 @
$(INSTALL
) -d
$(O
)/graphs
674 @cd
"$(CONFIG_DIR)"; \
675 $(TOPDIR
)/support
/scripts
/graph-depends \
676 |dot
-T
$(_BR2_GRAPH_OUT
) -o
$(O
)/graphs
/$(@
).
$(_BR2_GRAPH_OUT
)
678 else # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
682 endif # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
685 # ---------------------------------------------------------------------------
687 HOSTCFLAGS
=$(CFLAGS_FOR_BUILD
)
690 $(BUILD_DIR
)/buildroot-config
/%onf
:
691 mkdir
-p
$(@D
)/lxdialog
692 $(MAKE
) CC
="$(HOSTCC_NOCCACHE)" HOSTCC
="$(HOSTCC_NOCCACHE)" obj
=$(@D
) -C
$(CONFIG
) -f Makefile.br
$(@F
)
694 DEFCONFIG
= $(call qstrip
,$(BR2_DEFCONFIG
))
696 # We don't want to fully expand BR2_DEFCONFIG here, so Kconfig will
697 # recognize that if it's still at its default $(CONFIG_DIR)/defconfig
698 COMMON_CONFIG_ENV
= \
699 BR2_DEFCONFIG
='$(call qstrip,$(value BR2_DEFCONFIG))' \
700 KCONFIG_AUTOCONFIG
=$(BUILD_DIR
)/buildroot-config
/auto.conf \
701 KCONFIG_AUTOHEADER
=$(BUILD_DIR
)/buildroot-config
/autoconf.h \
702 KCONFIG_TRISTATE
=$(BUILD_DIR
)/buildroot-config
/tristate.config \
703 BR2_CONFIG
=$(BR2_CONFIG
) \
704 BR2_EXTERNAL
=$(BR2_EXTERNAL
)
706 xconfig
: $(BUILD_DIR
)/buildroot-config
/qconf outputmakefile
707 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
708 @
$(COMMON_CONFIG_ENV
) $< $(CONFIG_CONFIG_IN
)
710 gconfig
: $(BUILD_DIR
)/buildroot-config
/gconf outputmakefile
711 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
712 @
$(COMMON_CONFIG_ENV
) srctree
=$(TOPDIR
) $< $(CONFIG_CONFIG_IN
)
714 menuconfig
: $(BUILD_DIR
)/buildroot-config
/mconf outputmakefile
715 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
716 @
$(COMMON_CONFIG_ENV
) $< $(CONFIG_CONFIG_IN
)
718 nconfig
: $(BUILD_DIR
)/buildroot-config
/nconf outputmakefile
719 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
720 @
$(COMMON_CONFIG_ENV
) $< $(CONFIG_CONFIG_IN
)
722 config
: $(BUILD_DIR
)/buildroot-config
/conf outputmakefile
723 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
724 @
$(COMMON_CONFIG_ENV
) $< $(CONFIG_CONFIG_IN
)
726 oldconfig
: $(BUILD_DIR
)/buildroot-config
/conf outputmakefile
727 mkdir
-p
$(BUILD_DIR
)/buildroot-config
728 @
$(COMMON_CONFIG_ENV
) $< --oldconfig
$(CONFIG_CONFIG_IN
)
730 randconfig
: $(BUILD_DIR
)/buildroot-config
/conf outputmakefile
731 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
732 @
$(COMMON_CONFIG_ENV
) $< --randconfig
$(CONFIG_CONFIG_IN
)
734 allyesconfig
: $(BUILD_DIR
)/buildroot-config
/conf outputmakefile
735 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
736 @
$(COMMON_CONFIG_ENV
) $< --allyesconfig
$(CONFIG_CONFIG_IN
)
738 allnoconfig
: $(BUILD_DIR
)/buildroot-config
/conf outputmakefile
739 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
740 @
$(COMMON_CONFIG_ENV
) $< --allnoconfig
$(CONFIG_CONFIG_IN
)
742 randpackageconfig
: $(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 $< --randconfig
$(CONFIG_CONFIG_IN
)
751 @
rm -f
$(CONFIG_DIR
)/.config.nopkg
753 allyespackageconfig
: $(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 @grep
'^config BR2_PACKAGE_' Config.in.legacy | \
757 while read config pkg
; do \
758 echo
"# $$pkg is not set" >> $(CONFIG_DIR
)/.config.nopkg
; done
759 @
$(COMMON_CONFIG_ENV
) \
760 KCONFIG_ALLCONFIG
=$(CONFIG_DIR
)/.config.nopkg \
761 $< --allyesconfig
$(CONFIG_CONFIG_IN
)
762 @
rm -f
$(CONFIG_DIR
)/.config.nopkg
764 allnopackageconfig
: $(BUILD_DIR
)/buildroot-config
/conf outputmakefile
765 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
766 @grep
-v BR2_PACKAGE_
$(BR2_CONFIG
) > $(CONFIG_DIR
)/.config.nopkg
767 @
$(COMMON_CONFIG_ENV
) \
768 KCONFIG_ALLCONFIG
=$(CONFIG_DIR
)/.config.nopkg \
769 $< --allnoconfig
$(CONFIG_CONFIG_IN
)
770 @
rm -f
$(CONFIG_DIR
)/.config.nopkg
772 silentoldconfig
: $(BUILD_DIR
)/buildroot-config
/conf outputmakefile
773 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
774 $(COMMON_CONFIG_ENV
) $< --silentoldconfig
$(CONFIG_CONFIG_IN
)
776 olddefconfig
: $(BUILD_DIR
)/buildroot-config
/conf outputmakefile
777 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
778 $(COMMON_CONFIG_ENV
) $< --olddefconfig
$(CONFIG_CONFIG_IN
)
780 defconfig
: $(BUILD_DIR
)/buildroot-config
/conf outputmakefile
781 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
782 @
$(COMMON_CONFIG_ENV
) $< --defconfig
$(if
$(DEFCONFIG
),=$(DEFCONFIG
)) $(CONFIG_CONFIG_IN
)
784 %_defconfig
: $(BUILD_DIR
)/buildroot-config
/conf
$(TOPDIR
)/configs
/%_defconfig outputmakefile
785 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
786 @
$(COMMON_CONFIG_ENV
) $< --defconfig
=$(TOPDIR
)/configs
/$@
$(CONFIG_CONFIG_IN
)
788 %_defconfig
: $(BUILD_DIR
)/buildroot-config
/conf
$(BR2_EXTERNAL
)/configs
/%_defconfig outputmakefile
789 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
790 @
$(COMMON_CONFIG_ENV
) $< --defconfig
=$(BR2_EXTERNAL
)/configs
/$@
$(CONFIG_CONFIG_IN
)
792 savedefconfig
: $(BUILD_DIR
)/buildroot-config
/conf outputmakefile
793 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
794 @
$(COMMON_CONFIG_ENV
) $< \
795 --savedefconfig
=$(if
$(DEFCONFIG
),$(DEFCONFIG
),$(CONFIG_DIR
)/defconfig
) \
798 # check if download URLs are outdated
800 $(MAKE1
) DL_MODE
=SOURCE_CHECK
$(EXTRAMAKEARGS
) source
802 .PHONY
: defconfig savedefconfig
804 ################################################################################
806 # Cleanup and misc junk
808 ################################################################################
810 # outputmakefile generates a Makefile in the output directory, if using a
811 # separate output directory. This allows convenient use of make in the
814 ifeq ($(NEED_WRAPPER
),y
)
815 $(Q
)$(TOPDIR
)/support
/scripts
/mkmakefile
$(TOPDIR
) $(O
)
818 # printvars prints all the variables currently defined in our Makefiles
821 $(sort $(.VARIABLES
)), \
822 $(if
$(filter-out environment
% default automatic
, \
824 $(info $V=$($V) ($(value
$V)))))
827 rm -rf
$(TARGET_DIR
) $(BINARIES_DIR
) $(HOST_DIR
) \
828 $(BUILD_DIR
) $(BASE_DIR
)/staging \
832 ifeq ($(DL_DIR
),$(TOPDIR
)/dl
)
838 rm -rf
$(BR2_CONFIG
) $(CONFIG_DIR
)/.config.old
$(CONFIG_DIR
)/.auto.deps
842 @echo
' clean - delete all files created by build'
843 @echo
' distclean - delete all non-source files (including .config)'
846 @echo
' all - make world'
847 @echo
' toolchain - build toolchain'
848 @echo
' <package>-rebuild - force recompile <package>'
849 @echo
' <package>-reconfigure - force reconfigure <package>'
850 @echo
' <package>-graph-depends - generate graph of the dependency tree for package'
852 @echo
'Configuration:'
853 @echo
' menuconfig - interactive curses-based configurator'
854 @echo
' nconfig - interactive ncurses-based configurator'
855 @echo
' xconfig - interactive Qt-based configurator'
856 @echo
' gconfig - interactive GTK-based configurator'
857 @echo
' oldconfig - resolve any unresolved symbols in .config'
858 @echo
' silentoldconfig - Same as oldconfig, but quietly, additionally update deps'
859 @echo
' olddefconfig - Same as silentoldconfig but sets new symbols to their default value'
860 @echo
' randconfig - New config with random answer to all options'
861 @echo
' defconfig - New config with default answer to all options'
862 @echo
' BR2_DEFCONFIG, if set, is used as input'
863 @echo
' savedefconfig - Save current config as ./defconfig (minimal config)'
864 @echo
' allyesconfig - New config where all options are accepted with yes'
865 @echo
' allnoconfig - New config where all options are answered with no'
866 @echo
' randpackageconfig - New config with random answer to package options'
867 @echo
' allyespackageconfig - New config where pkg options are accepted with yes'
868 @echo
' allnopackageconfig - New config where package options are answered with no'
869 ifeq ($(BR2_PACKAGE_BUSYBOX
),y
)
870 @echo
' busybox-menuconfig - Run BusyBox menuconfig'
872 ifeq ($(BR2_LINUX_KERNEL
),y
)
873 @echo
' linux-menuconfig - Run Linux kernel menuconfig'
874 @echo
' linux-savedefconfig - Run Linux kernel savedefconfig'
876 ifeq ($(BR2_TOOLCHAIN_BUILDROOT
),y
)
877 @echo
' uclibc-menuconfig - Run uClibc menuconfig'
879 ifeq ($(BR2_TARGET_BAREBOX
),y
)
880 @echo
' barebox-menuconfig - Run barebox menuconfig'
881 @echo
' barebox-savedefconfig - Run barebox savedefconfig'
884 @echo
'Documentation:'
885 @echo
' manual - build manual in all formats'
886 @echo
' manual-html - build manual in HTML'
887 @echo
' manual-split-html - build manual in split HTML'
888 @echo
' manual-pdf - build manual in PDF'
889 @echo
' manual-text - build manual in text'
890 @echo
' manual-epub - build manual in ePub'
891 @echo
' graph-build - generate graphs of the build times'
892 @echo
' graph-depends - generate graph of the dependency tree'
894 @echo
'Miscellaneous:'
895 @echo
' source - download all sources needed for offline-build'
896 @echo
' source-check - check selected packages for valid download URLs'
897 @echo
' external-deps - list external packages used'
898 @echo
' legal-info - generate info about license compliance'
900 @echo
' make V=0|1 - 0 => quiet build (default), 1 => verbose build'
901 @echo
' make O=dir - Locate all output files in "dir", including .config'
903 @echo
'Built-in configs:'
904 @
$(foreach b
, $(sort $(notdir $(wildcard $(TOPDIR
)/configs
/*_defconfig
))), \
905 printf
" %-35s - Build for %s\\n" $(b
) $(b
:_defconfig
=);)
906 ifneq ($(wildcard $(BR2_EXTERNAL
)/configs
/*_defconfig
),)
908 @echo
'User-provided configs:'
909 @
$(foreach b
, $(sort $(notdir $(wildcard $(BR2_EXTERNAL
)/configs
/*_defconfig
))), \
910 printf
" %-35s - Build for %s\\n" $(b
) $(b
:_defconfig
=);)
913 @echo
'See docs/README, or generate the Buildroot manual for further details'
916 release
: OUT
=buildroot-
$(BR2_VERSION
)
918 # Create release tarballs. We need to fiddle a bit to add the generated
919 # documentation to the git output
921 git archive
--format
=tar --prefix=$(OUT
)/ HEAD
> $(OUT
).
tar
922 $(MAKE
) O
=$(OUT
) manual-html manual-text manual-pdf
923 tar rf
$(OUT
).
tar $(OUT
)
924 gzip
-9 -c
< $(OUT
).
tar > $(OUT
).
tar.gz
925 bzip2
-9 -c
< $(OUT
).
tar > $(OUT
).
tar.bz2
926 rm -rf
$(OUT
) $(OUT
).
tar
929 @echo
$(BR2_VERSION_FULL
)
931 include docs
/manual
/manual.mk
933 .PHONY
: $(noconfig_targets
)