1 # Makefile for buildroot2
3 # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4 # Copyright (C) 2006-2012 by the Buildroot developers <buildroot@uclibc.org>
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.05-git
29 # Check for minimal make version (note: this check will break at make 10.x)
31 ifneq ($(firstword $(sort $(MAKE_VERSION
) $(MIN_MAKE_VERSION
))),$(MIN_MAKE_VERSION
))
32 $(error You have make
'$(MAKE_VERSION)' installed. GNU make
>= $(MIN_MAKE_VERSION
) is required
)
35 # This top-level Makefile can *not* be executed in parallel
40 CONFIG_CONFIG_IN
=Config.in
41 CONFIG
=support
/kconfig
42 DATE
:=$(shell date
+%Y
%m
%d
)
44 # Compute the full local version string so packages can use it as-is
45 # Need to export it, so it can be got from environment in children (eg. mconf)
46 export BR2_VERSION_FULL
:=$(BR2_VERSION
)$(shell $(TOPDIR
)/support
/scripts
/setlocalversion
)
48 noconfig_targets
:=menuconfig nconfig gconfig xconfig config oldconfig randconfig \
49 defconfig
%_defconfig savedefconfig allyesconfig allnoconfig silentoldconfig release \
50 randpackageconfig allyespackageconfig allnopackageconfig \
51 source-check print-version
53 # Strip quotes and then whitespaces
54 qstrip
=$(strip $(subst ",,$(1)))
57 # Variables for use in Make constructs
60 space
:=$(empty
) $(empty
)
62 ifneq ("$(origin O)", "command line")
67 # other packages might also support Linux-style out of tree builds
68 # with the O=<dir> syntax (E.G. Busybox does). As make automatically
69 # forwards command line variable definitions those packages get very
70 # confused. Fix this by telling make to not do so
72 # strangely enough O is still passed to submakes with MAKEOVERRIDES
73 # (with make 3.81 atleast), the only thing that changes is the output
74 # of the origin function (command line -> environment).
75 # Unfortunately some packages don't look at origin (E.G. uClibc 0.9.31+)
76 # To really make O go away, we have to override it.
79 # we need to pass O= everywhere we call back into the toplevel makefile
80 EXTRAMAKEARGS
= O
=$(O
)
84 # Pull in the user's configuration file
85 ifeq ($(filter $(noconfig_targets
),$(MAKECMDGOALS
)),)
86 -include $(CONFIG_DIR
)/.config
89 # Override BR2_DL_DIR if shell variable defined
90 ifneq ($(BUILDROOT_DL_DIR
),)
91 BR2_DL_DIR
:=$(BUILDROOT_DL_DIR
)
94 # To put more focus on warnings, be less verbose as default
95 # Use 'make V=1' to see the full commands
97 ifeq ("$(origin V)", "command line")
101 ifndef KBUILD_VERBOSE
105 ifeq ($(KBUILD_VERBOSE
),1)
116 # we want bash as shell
117 SHELL
:=$(shell if
[ -x
"$$BASH" ]; then echo
$$BASH; \
118 else if
[ -x
/bin
/bash
]; then echo
/bin
/bash
; \
119 else echo sh
; fi
; fi
)
121 # kconfig uses CONFIG_SHELL
122 CONFIG_SHELL
:=$(SHELL
)
124 export SHELL CONFIG_SHELL quiet Q KBUILD_VERBOSE VERBOSE
134 HOSTCC
:=$(shell which
$(HOSTCC
) || type
-p
$(HOSTCC
) || echo gcc
)
136 HOSTCC_NOCCACHE
:=$(HOSTCC
)
139 HOSTCXX
:=$(shell which
$(HOSTCXX
) || type
-p
$(HOSTCXX
) || echo g
++)
141 HOSTCXX_NOCCACHE
:=$(HOSTCXX
)
157 HOSTAR
:=$(shell which
$(HOSTAR
) || type
-p
$(HOSTAR
) || echo
ar)
158 HOSTAS
:=$(shell which
$(HOSTAS
) || type
-p
$(HOSTAS
) || echo
as)
159 HOSTFC
:=$(shell which
$(HOSTLD
) || type
-p
$(HOSTLD
) || echo || which g77 || type
-p g77 || echo gfortran
)
160 HOSTCPP
:=$(shell which
$(HOSTCPP
) || type
-p
$(HOSTCPP
) || echo
cpp)
161 HOSTLD
:=$(shell which
$(HOSTLD
) || type
-p
$(HOSTLD
) || echo
ld)
162 HOSTLN
:=$(shell which
$(HOSTLN
) || type
-p
$(HOSTLN
) || echo ln
)
163 HOSTNM
:=$(shell which
$(HOSTNM
) || type
-p
$(HOSTNM
) || echo nm
)
165 export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD
166 export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE
168 # bash prints the name of the directory on 'cd <dir>' if CDPATH is
169 # set, so unset it here to not cause problems. Notice that the export
170 # line doesn't affect the environment of $(shell ..) calls, so
171 # explictly throw away any output from 'cd' here.
173 BASE_DIR
:= $(shell mkdir
-p
$(O
) && cd
$(O
) >/dev
/null
&& pwd
)
174 $(if
$(BASE_DIR
),, $(error output directory
"$(O)" does not exist
))
176 BUILD_DIR
:=$(BASE_DIR
)/build
179 ifeq ($(BR2_HAVE_DOT_CONFIG
),y
)
182 # Usage: cflags-y+=$(call cc-option, -march=winchip-c6, -march=i586)
183 # sets -march=winchip-c6 if supported else falls back to -march=i586
184 # without checking the latter.
185 cc-option
=$(shell if
$(TARGET_CC
) $(TARGET_CFLAGS
) $(1) -S
-o
/dev
/null
-xc
/dev
/null \
186 > /dev
/null
2>&1; then echo
"$(1)"; else echo
"$(2)"; fi
;)
188 #############################################################
190 # Hide troublesome environment variables from sub processes
192 #############################################################
193 unexport CROSS_COMPILE
200 unexport GREP_OPTIONS
203 GNU_HOST_NAME
:=$(shell support
/gnuconfig
/config.guess
)
205 #############################################################
207 # Setup the proper filename extensions for the host
209 ##############################################################
210 ifneq ($(findstring linux
,$(GNU_HOST_NAME
)),)
215 ifneq ($(findstring apple
,$(GNU_HOST_NAME
)),)
220 ifneq ($(findstring cygwin
,$(GNU_HOST_NAME
)),)
224 HOST_LOADLIBES
=-lcurses
-lintl
225 export HOST_LOADLIBES
227 ifneq ($(findstring mingw
,$(GNU_HOST_NAME
)),)
233 ##############################################################
235 # The list of stuff to build for the target toolchain
236 # along with the packages to build for the target.
238 ##############################################################
240 ifeq ($(BR2_CCACHE
),y
)
241 BASE_TARGETS
+= host-ccache
244 ifeq ($(BR2_TOOLCHAIN_BUILDROOT
),y
)
245 BASE_TARGETS
+= uclibc-configured host-binutils cross_compiler uclibc-target-utils kernel-headers
247 BASE_TARGETS
+= uclibc
251 # silent mode requested?
252 QUIET
:=$(if
$(findstring s
,$(MAKEFLAGS
)),-q
)
254 # Strip off the annoying quoting
255 ARCH
:=$(call qstrip
,$(BR2_ARCH
))
256 ifeq ($(ARCH
),xtensa
)
257 ARCH
:=$(ARCH
)_
$(call qstrip
,$(BR2_xtensa_core_name
))
260 KERNEL_ARCH
:=$(shell echo
"$(ARCH)" | sed
-e
"s/-.*//" \
261 -e s
/i
.86/i386
/ -e s
/sun4u
/sparc64
/ \
262 -e s
/arm.
*/arm
/ -e s
/sa110
/arm
/ \
263 -e s
/bfin
/blackfin
/ \
264 -e s
/parisc64
/parisc
/ \
265 -e s
/powerpc64
/powerpc
/ \
266 -e s
/ppc.
*/powerpc
/ -e s
/mips.
*/mips
/ \
269 ZCAT
:=$(call qstrip
,$(BR2_ZCAT
))
270 BZCAT
:=$(call qstrip
,$(BR2_BZCAT
))
271 XZCAT
:=$(call qstrip
,$(BR2_XZCAT
))
272 TAR_OPTIONS
=$(call qstrip
,$(BR2_TAR_OPTIONS
)) -xf
274 GNU_TARGET_SUFFIX
:=-$(call qstrip
,$(BR2_GNU_TARGET_SUFFIX
))
276 # packages compiled for the host go here
277 HOST_DIR
:=$(call qstrip
,$(BR2_HOST_DIR
))
279 # stamp (dependency) files go here
280 STAMP_DIR
:=$(BASE_DIR
)/stamps
282 BINARIES_DIR
:=$(BASE_DIR
)/images
283 TARGET_DIR
:=$(BASE_DIR
)/target
284 TOOLCHAIN_DIR
=$(BASE_DIR
)/toolchain
285 TARGET_SKELETON
=$(TOPDIR
)/fs
/skeleton
287 ifeq ($(BR2_CCACHE
),y
)
288 CCACHE
:=$(HOST_DIR
)/usr
/bin
/ccache
289 CCACHE_CACHE_DIR
=$(HOME
)/.buildroot-ccache
290 HOSTCC
:= $(CCACHE
) $(HOSTCC
)
291 HOSTCXX
:= $(CCACHE
) $(HOSTCXX
)
294 include toolchain
/Makefile.in
295 include package
/Makefile.in
297 #############################################################
299 # You should probably leave this stuff alone unless you know
300 # what you are doing.
302 #############################################################
306 include support
/dependencies
/dependencies.mk
308 # We also need the various per-package makefiles, which also add
309 # each selected package to TARGETS if that package was selected
310 # in the .config file.
311 ifeq ($(BR2_TOOLCHAIN_BUILDROOT
),y
)
312 include toolchain
/toolchain-buildroot.mk
313 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL
),y
)
314 include toolchain
/toolchain-external.mk
315 else ifeq ($(BR2_TOOLCHAIN_CTNG
),y
)
316 include toolchain
/toolchain-crosstool-ng.mk
319 # Include the package override file if one has been provided in the
321 PACKAGE_OVERRIDE_FILE
=$(call qstrip
,$(BR2_PACKAGE_OVERRIDE_FILE
))
322 ifneq ($(PACKAGE_OVERRIDE_FILE
),)
323 -include $(PACKAGE_OVERRIDE_FILE
)
326 include package
/*/*.mk
328 include boot
/common.mk
329 include target
/Makefile.in
330 include linux
/linux.mk
332 TARGETS
+=target-finalize
334 ifeq ($(BR2_ENABLE_LOCALE_PURGE
),y
)
335 TARGETS
+=target-purgelocales
340 TARGETS
+=erase-fakeroots
342 TARGETS_CLEAN
:=$(patsubst %,%-clean,$(TARGETS
))
343 TARGETS_SOURCE
:=$(patsubst %,%-source
,$(TARGETS
) $(BASE_TARGETS
))
344 TARGETS_DIRCLEAN
:=$(patsubst %,%-dirclean
,$(TARGETS
))
345 TARGETS_ALL
:=$(patsubst %,__real_tgt_
%,$(TARGETS
))
347 # host-* dependencies have to be handled specially, as those aren't
348 # visible in Kconfig and hence not added to a variable like TARGETS.
349 # instead, find all the host-* targets listed in each <PKG>_DEPENDENCIES
350 # variable for each enabled target.
351 # Notice: this only works for newstyle gentargets/autotargets packages
352 TARGETS_HOST_DEPS
= $(sort $(filter host-
%,$(foreach dep
,\
353 $(addsuffix _DEPENDENCIES
,$(call UPPERCASE
,$(TARGETS
))),\
355 # Host packages can in turn have their own dependencies. Likewise find
356 # all the package names listed in the HOST_<PKG>_DEPENDENCIES for each
357 # host package found above. Ideally this should be done recursively until
358 # no more packages are found, but that's hard to do in make, so limit to
360 HOST_DEPS
= $(sort $(foreach dep
,\
361 $(addsuffix _DEPENDENCIES
,$(call UPPERCASE
,$(TARGETS_HOST_DEPS
))),\
363 HOST_SOURCE
+= $(addsuffix -source
,$(sort $(TARGETS_HOST_DEPS
) $(HOST_DEPS
)))
365 # all targets depend on the crosscompiler and it's prerequisites
366 $(TARGETS_ALL
): __real_tgt_
%: $(BASE_TARGETS
) %
368 dirs
: $(DL_DIR
) $(TOOLCHAIN_DIR
) $(BUILD_DIR
) $(STAGING_DIR
) $(TARGET_DIR
) \
369 $(HOST_DIR
) $(BINARIES_DIR
) $(STAMP_DIR
)
371 $(BASE_TARGETS
): dirs
$(HOST_DIR
)/usr
/share
/buildroot
/toolchainfile.cmake
373 $(BUILD_DIR
)/buildroot-config
/auto.conf
: $(CONFIG_DIR
)/.config
374 $(MAKE
) $(EXTRAMAKEARGS
) HOSTCC
="$(HOSTCC_NOCCACHE)" HOSTCXX
="$(HOSTCXX_NOCCACHE)" silentoldconfig
376 prepare
: $(BUILD_DIR
)/buildroot-config
/auto.conf
378 world
: prepare dirs dependencies
$(BASE_TARGETS
) $(TARGETS_ALL
)
380 $(HOST_DIR
)/usr
/share
/buildroot
/toolchainfile.cmake
:
383 set(CMAKE_SYSTEM_NAME Linux)\n\
384 set(CMAKE_C_COMPILER $(TARGET_CC_NOCCACHE))\n\
385 set(CMAKE_CXX_COMPILER $(TARGET_CXX_NOCCACHE))\n\
386 set(CMAKE_C_FLAGS \"\$${CMAKE_C_FLAGS} $(TARGET_CFLAGS)\" CACHE STRING \"Buildroot CFLAGS\" FORCE)\n\
387 set(CMAKE_CXX_FLAGS \"\$${CMAKE_CXX_FLAGS} $(TARGET_CXXFLAGS)\" CACHE STRING \"Buildroot CXXFLAGS\" FORCE)\n\
388 set(CMAKE_INSTALL_SO_NO_EXE 0)\n\
389 set(CMAKE_PROGRAM_PATH \"$(HOST_DIR)/usr/bin\")\n\
390 set(CMAKE_FIND_ROOT_PATH \"$(STAGING_DIR)\")\n\
391 set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n\
392 set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)\n\
393 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)\n\
394 set(ENV{PKG_CONFIG_SYSROOT_DIR} \"$(STAGING_DIR)\")\n\
397 .PHONY
: all world dirs
clean distclean source outputmakefile \
398 $(BASE_TARGETS
) $(TARGETS
) $(TARGETS_ALL
) \
399 $(TARGETS_CLEAN
) $(TARGETS_DIRCLEAN
) $(TARGETS_SOURCE
) \
400 $(DL_DIR
) $(TOOLCHAIN_DIR
) $(BUILD_DIR
) $(STAGING_DIR
) $(TARGET_DIR
) \
401 $(HOST_DIR
) $(BINARIES_DIR
) $(STAMP_DIR
)
403 #############################################################
405 # staging and target directories do NOT list these as
406 # dependencies anywhere else
408 #############################################################
409 $(DL_DIR
) $(TOOLCHAIN_DIR
) $(BUILD_DIR
) $(HOST_DIR
) $(BINARIES_DIR
) $(STAMP_DIR
):
413 @mkdir
-p
$(STAGING_DIR
)/bin
414 @mkdir
-p
$(STAGING_DIR
)/lib
415 @mkdir
-p
$(STAGING_DIR
)/usr
/lib
416 @mkdir
-p
$(STAGING_DIR
)/usr
/include
417 @mkdir
-p
$(STAGING_DIR
)/usr
/bin
418 @ln
-snf
$(STAGING_DIR
) $(BASE_DIR
)/staging
420 ifeq ($(BR2_ROOTFS_SKELETON_CUSTOM
),y
)
421 TARGET_SKELETON
=$(BR2_ROOTFS_SKELETON_CUSTOM_PATH
)
425 mkdir
-p
$(TARGET_DIR
)
426 if
! [ -d
"$(TARGET_DIR)/bin" ]; then \
427 if
[ -d
"$(TARGET_SKELETON)" ]; then \
428 cp
-fa
$(TARGET_SKELETON
)/* $(TARGET_DIR
)/; \
430 touch
$(STAGING_DIR
)/.fakeroot
.00000; \
432 -find
$(TARGET_DIR
) -type d
-name CVS
-print0
-o
-name .svn
-print0 | xargs
-0 rm -rf
433 -find
$(TARGET_DIR
) -type f \
( -name .empty
-o
-name
'*~' \
) -print0 | xargs
-0 rm -rf
436 $(TARGET_DIR
): $(BUILD_DIR
)/.root
439 rm -f
$(BUILD_DIR
)/.fakeroot
*
442 ifeq ($(BR2_HAVE_DEVFILES
),y
)
443 ( support
/scripts
/copy.sh
$(STAGING_DIR
) $(TARGET_DIR
) )
445 rm -rf
$(TARGET_DIR
)/usr
/include $(TARGET_DIR
)/usr
/lib
/pkgconfig
$(TARGET_DIR
)/usr
/share
/aclocal
446 find
$(TARGET_DIR
)/lib \
( -name
'*.a' -o
-name
'*.la' \
) -print0 | xargs
-0 rm -f
447 find
$(TARGET_DIR
)/usr
/lib \
( -name
'*.a' -o
-name
'*.la' \
) -print0 | xargs
-0 rm -f
449 ifneq ($(BR2_PACKAGE_GDB
),y
)
450 rm -rf
$(TARGET_DIR
)/usr
/share
/gdb
452 ifneq ($(BR2_HAVE_DOCUMENTATION
),y
)
453 rm -rf
$(TARGET_DIR
)/usr
/man
$(TARGET_DIR
)/usr
/share
/man
454 rm -rf
$(TARGET_DIR
)/usr
/info $(TARGET_DIR
)/usr
/share
/info
455 rm -rf
$(TARGET_DIR
)/usr
/doc
$(TARGET_DIR
)/usr
/share
/doc
456 rm -rf
$(TARGET_DIR
)/usr
/share
/gtk-doc
457 -rmdir
$(TARGET_DIR
)/usr
/share
2>/dev
/null
459 ifeq ($(BR2_PACKAGE_PYTHON_PY_ONLY
),y
)
460 find
$(TARGET_DIR
)/usr
/lib
/ -name
'*.pyc' -print0 | xargs
-0 rm -f
462 ifeq ($(BR2_PACKAGE_PYTHON_PYC_ONLY
),y
)
463 find
$(TARGET_DIR
)/usr
/lib
/ -name
'*.py' -print0 | xargs
-0 rm -f
465 find
$(TARGET_DIR
) -type f
-perm
+111 '!' -name
'libthread_db*.so*' | \
466 xargs
$(STRIPCMD
) 2>/dev
/null || true
467 find
$(TARGET_DIR
)/lib
/modules
-type f
-name
'*.ko' | \
468 xargs
-r
$(KSTRIPCMD
) || true
470 mkdir
-p
$(TARGET_DIR
)/etc
471 # Mandatory configuration file and auxilliary cache directory
472 # for recent versions of ldconfig
473 touch
$(TARGET_DIR
)/etc
/ld.so.conf
474 mkdir
-p
$(TARGET_DIR
)/var
/cache
/ldconfig
475 if
[ -x
"$(TARGET_CROSS)ldconfig" ]; \
477 $(TARGET_CROSS
)ldconfig
-r
$(TARGET_DIR
); \
479 /sbin
/ldconfig
-r
$(TARGET_DIR
); \
482 echo
"NAME=Buildroot"; \
483 echo
"VERSION=$(BR2_VERSION_FULL)"; \
484 echo
"ID=buildroot"; \
485 echo
"VERSION_ID=$(BR2_VERSION)"; \
486 echo
"PRETTY_NAME=\"Buildroot $(BR2_VERSION)\"" \
487 ) > $(TARGET_DIR
)/etc
/os-release
489 ifneq ($(BR2_ROOTFS_POST_BUILD_SCRIPT
),"")
490 @
$(call MESSAGE
,"Executing post-build script")
491 $(BR2_ROOTFS_POST_BUILD_SCRIPT
) $(TARGET_DIR
)
494 ifeq ($(BR2_ENABLE_LOCALE_PURGE
),y
)
495 LOCALE_WHITELIST
=$(BUILD_DIR
)/locales.nopurge
496 LOCALE_NOPURGE
=$(call qstrip
,$(BR2_ENABLE_LOCALE_WHITELIST
))
499 rm -f
$(LOCALE_WHITELIST
)
500 for i in
$(LOCALE_NOPURGE
); do echo
$$i >> $(LOCALE_WHITELIST
); done
502 for
dir in
$(wildcard $(addprefix $(TARGET_DIR
),/usr
/share
/locale
/usr
/share
/X11
/locale
/usr
/man
/usr
/share
/man
)); \
504 for lang in
$$(cd
$$dir; ls .|grep
-v man
); \
506 grep
-qx
$$lang $(LOCALE_WHITELIST
) ||
rm -rf
$$dir/$$lang; \
511 source
: dirs
$(TARGETS_SOURCE
) $(HOST_SOURCE
)
514 @
$(MAKE
) -Bs DL_MODE
=SHOW_EXTERNAL_DEPS
$(EXTRAMAKEARGS
) source |
sort -u
519 else # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
524 # ---------------------------------------------------------------------------
526 HOSTCFLAGS
=$(CFLAGS_FOR_BUILD
)
529 $(BUILD_DIR
)/buildroot-config
/%onf
:
530 mkdir
-p
$(@D
)/lxdialog
531 $(MAKE
) CC
="$(HOSTCC_NOCCACHE)" HOSTCC
="$(HOSTCC_NOCCACHE)" obj
=$(@D
) -C
$(CONFIG
) -f Makefile.br
$(@F
)
533 COMMON_CONFIG_ENV
= \
534 KCONFIG_AUTOCONFIG
=$(BUILD_DIR
)/buildroot-config
/auto.conf \
535 KCONFIG_AUTOHEADER
=$(BUILD_DIR
)/buildroot-config
/autoconf.h \
536 KCONFIG_TRISTATE
=$(BUILD_DIR
)/buildroot-config
/tristate.config \
537 BUILDROOT_CONFIG
=$(CONFIG_DIR
)/.config
539 xconfig
: $(BUILD_DIR
)/buildroot-config
/qconf outputmakefile
540 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
541 @
$(COMMON_CONFIG_ENV
) $< $(CONFIG_CONFIG_IN
)
543 gconfig
: $(BUILD_DIR
)/buildroot-config
/gconf outputmakefile
544 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
545 @
$(COMMON_CONFIG_ENV
) srctree
=$(TOPDIR
) $< $(CONFIG_CONFIG_IN
)
547 menuconfig
: $(BUILD_DIR
)/buildroot-config
/mconf outputmakefile
548 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
549 @
$(COMMON_CONFIG_ENV
) $< $(CONFIG_CONFIG_IN
)
551 nconfig
: $(BUILD_DIR
)/buildroot-config
/nconf outputmakefile
552 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
553 @
$(COMMON_CONFIG_ENV
) $< $(CONFIG_CONFIG_IN
)
555 config
: $(BUILD_DIR
)/buildroot-config
/conf outputmakefile
556 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
557 @
$(COMMON_CONFIG_ENV
) $< $(CONFIG_CONFIG_IN
)
559 oldconfig
: $(BUILD_DIR
)/buildroot-config
/conf outputmakefile
560 mkdir
-p
$(BUILD_DIR
)/buildroot-config
561 @
$(COMMON_CONFIG_ENV
) $< --oldconfig
$(CONFIG_CONFIG_IN
)
563 randconfig
: $(BUILD_DIR
)/buildroot-config
/conf outputmakefile
564 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
565 @
$(COMMON_CONFIG_ENV
) $< --randconfig
$(CONFIG_CONFIG_IN
)
567 allyesconfig
: $(BUILD_DIR
)/buildroot-config
/conf outputmakefile
568 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
569 @
$(COMMON_CONFIG_ENV
) $< --allyesconfig
$(CONFIG_CONFIG_IN
)
571 allnoconfig
: $(BUILD_DIR
)/buildroot-config
/conf outputmakefile
572 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
573 @
$(COMMON_CONFIG_ENV
) $< --allnoconfig
$(CONFIG_CONFIG_IN
)
575 randpackageconfig
: $(BUILD_DIR
)/buildroot-config
/conf outputmakefile
576 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
577 @grep
-v BR2_PACKAGE_
$(CONFIG_DIR
)/.config
> $(CONFIG_DIR
)/.config.nopkg
578 @
$(COMMON_CONFIG_ENV
) \
579 KCONFIG_ALLCONFIG
=$(CONFIG_DIR
)/.config.nopkg \
580 $< --randconfig
$(CONFIG_CONFIG_IN
)
581 @
rm -f
$(CONFIG_DIR
)/.config.nopkg
583 allyespackageconfig
: $(BUILD_DIR
)/buildroot-config
/conf outputmakefile
584 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
585 @grep
-v BR2_PACKAGE_
$(CONFIG_DIR
)/.config
> $(CONFIG_DIR
)/.config.nopkg
586 @
$(COMMON_CONFIG_ENV
) \
587 KCONFIG_ALLCONFIG
=$(CONFIG_DIR
)/.config.nopkg \
588 $< --allyesconfig
$(CONFIG_CONFIG_IN
)
589 @
rm -f
$(CONFIG_DIR
)/.config.nopkg
591 allnopackageconfig
: $(BUILD_DIR
)/buildroot-config
/conf outputmakefile
592 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
593 @grep
-v BR2_PACKAGE_
$(CONFIG_DIR
)/.config
> $(CONFIG_DIR
)/.config.nopkg
594 @
$(COMMON_CONFIG_ENV
) \
595 KCONFIG_ALLCONFIG
=$(CONFIG_DIR
)/.config.nopkg \
596 $< --allnoconfig
$(CONFIG_CONFIG_IN
)
597 @
rm -f
$(CONFIG_DIR
)/.config.nopkg
599 silentoldconfig
: $(BUILD_DIR
)/buildroot-config
/conf outputmakefile
600 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
601 $(COMMON_CONFIG_ENV
) $< --silentoldconfig
$(CONFIG_CONFIG_IN
)
603 defconfig
: $(BUILD_DIR
)/buildroot-config
/conf outputmakefile
604 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
605 @
$(COMMON_CONFIG_ENV
) $< --defconfig
$(CONFIG_CONFIG_IN
)
607 %_defconfig
: $(BUILD_DIR
)/buildroot-config
/conf
$(TOPDIR
)/configs
/%_defconfig outputmakefile
608 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
609 @
$(COMMON_CONFIG_ENV
) $< --defconfig
=$(TOPDIR
)/configs
/$@
$(CONFIG_CONFIG_IN
)
611 savedefconfig
: $(BUILD_DIR
)/buildroot-config
/conf outputmakefile
612 @mkdir
-p
$(BUILD_DIR
)/buildroot-config
613 @
$(COMMON_CONFIG_ENV
) $< --savedefconfig
=$(CONFIG_DIR
)/defconfig
$(CONFIG_CONFIG_IN
)
615 # check if download URLs are outdated
616 source-check
: allyesconfig
617 $(MAKE
) DL_MODE
=SOURCE_CHECK
$(EXTRAMAKEARGS
) source
619 endif # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
621 #############################################################
623 # Cleanup and misc junk
625 #############################################################
627 # outputmakefile generates a Makefile in the output directory, if using a
628 # separate output directory. This allows convenient use of make in the
631 ifeq ($(NEED_WRAPPER
),y
)
632 $(Q
)$(TOPDIR
)/support
/scripts
/mkmakefile
$(TOPDIR
) $(O
)
636 rm -rf
$(STAGING_DIR
) $(TARGET_DIR
) $(BINARIES_DIR
) $(HOST_DIR
) \
637 $(STAMP_DIR
) $(BUILD_DIR
) $(TOOLCHAIN_DIR
) $(BASE_DIR
)/staging
640 ifeq ($(DL_DIR
),$(TOPDIR
)/dl
)
646 rm -rf
$(CONFIG_DIR
)/.config
$(CONFIG_DIR
)/.config.old
$(CONFIG_DIR
)/.auto.deps
648 cross
: $(BASE_TARGETS
)
652 @echo
' clean - delete all files created by build'
653 @echo
' distclean - delete all non-source files (including .config)'
656 @echo
' all - make world'
658 @echo
'Configuration:'
659 @echo
' menuconfig - interactive curses-based configurator'
660 @echo
' nconfig - interactive ncurses-based configurator'
661 @echo
' xconfig - interactive Qt-based configurator'
662 @echo
' gconfig - interactive GTK-based configurator'
663 @echo
' oldconfig - resolve any unresolved symbols in .config'
664 @echo
' randconfig - New config with random answer to all options'
665 @echo
' defconfig - New config with default answer to all options'
666 @echo
' savedefconfig - Save current config as ./defconfig (minimal config)'
667 @echo
' allyesconfig - New config where all options are accepted with yes'
668 @echo
' allnoconfig - New config where all options are answered with no'
669 @echo
' randpackageconfig - New config with random answer to package options'
670 @echo
' allyespackageconfig - New config where pkg options are accepted with yes'
671 @echo
' allnopackageconfig - New config where package options are answered with no'
672 ifeq ($(BR2_PACKAGE_BUSYBOX
),y
)
673 @echo
' busybox-menuconfig - Run BusyBox menuconfig'
675 ifeq ($(BR2_LINUX_KERNEL
),y
)
676 @echo
' linux-menuconfig - Run Linux kernel menuconfig'
677 @echo
' linux-savedefconfig - Run Linux kernel savedefconfig'
679 ifeq ($(BR2_TOOLCHAIN_BUILDROOT
),y
)
680 @echo
' uclibc-menuconfig - Run uClibc menuconfig'
682 ifeq ($(BR2_TOOLCHAIN_CTNG
),y
)
683 @echo
' ctng-menuconfig - Run crosstool-NG menuconfig'
685 ifeq ($(BR2_TARGET_BAREBOX
),y
)
686 @echo
' barebox-menuconfig - Run barebox menuconfig'
687 @echo
' barebox-savedefconfig - Run barebox savedefconfig'
690 @echo
'Documentation:'
691 @echo
' manual - build manual in HTML, split HTML, PDF and txt'
692 @echo
' manual-html - build manual in HTML'
693 @echo
' manual-split-html - build manual in split HTML'
694 @echo
' manual-pdf - build manual in PDF'
695 @echo
' manual-txt - build manual in txt'
696 @echo
' manual-epub - build manual in ePub'
698 @echo
'Miscellaneous:'
699 @echo
' source - download all sources needed for offline-build'
700 @echo
' source-check - check all packages for valid download URLs'
701 @echo
' external-deps - list external packages used'
703 @echo
' make V=0|1 - 0 => quiet build (default), 1 => verbose build'
704 @echo
' make O=dir - Locate all output files in "dir", including .config'
706 @
$(foreach b
, $(sort $(notdir $(wildcard $(TOPDIR
)/configs
/*_defconfig
))), \
707 printf
" %-35s - Build for %s\\n" $(b
) $(b
:_defconfig
=);)
709 @echo
'See docs/README, or generate the Buildroot manual for further details'
712 release
: OUT
=buildroot-
$(BR2_VERSION
)
714 # Create release tarballs. We need to fiddle a bit to add the generated
715 # documentation to the git output
717 git archive
--format
=tar --prefix=$(OUT
)/ master
> $(OUT
).
tar
718 $(MAKE
) O
=$(OUT
) manual-html manual-txt manual-pdf
719 tar rf
$(OUT
).
tar $(OUT
)
720 gzip
-9 -c
< $(OUT
).
tar > $(OUT
).
tar.gz
721 bzip2
-9 -c
< $(OUT
).
tar > $(OUT
).
tar.bz2
722 rm -rf
$(OUT
) $(OUT
).
tar
725 @echo
$(BR2_VERSION_FULL
)
727 ################################################################################
728 # GENDOC -- generates the make targets needed to build a specific type of
729 # asciidoc documentation.
731 # argument 1 is the name of the document and must be a subdirectory of docs/;
732 # the top-level asciidoc file must have the same name
733 # argument 2 is the type of document to generate (-f argument of a2x)
734 # argument 3 is the document type as used in the make target
735 # argument 4 is the output file extension for the document type
736 # argument 5 is the human text for the document type
737 # argument 6 (optional) are extra arguments for a2x
739 # The variable <DOCUMENT_NAME>_SOURCES defines the dependencies.
740 ################################################################################
744 $(1)-$(3): $$(O
)/docs
/$(1)/$(1).
$(4)
746 $$(O
)/docs
/$(1)/$(1).
$(4): docs
/$(1)/$(1).txt
$$($(call UPPERCASE
,$(1))_SOURCES
)
747 @echo
"Generating $(5) $(1)..."
749 $(Q
)a2x
$(6) -f
$(2) -d book
-L
-r
$(TOPDIR
)/docs
/images \
753 ################################################################################
754 # GENDOC -- generates the make targets needed to build asciidoc documentation.
756 # argument 1 is the name of the document and must be a subdirectory of docs/;
757 # the top-level asciidoc file must have the same name
759 # The variable <DOCUMENT_NAME>_SOURCES defines the dependencies.
760 ################################################################################
762 $(call GENDOC_INNER
,$(1),xhtml
,html
,html
,HTML
)
763 $(call GENDOC_INNER
,$(1),chunked
,split-html
,chunked
,Split HTML
)
764 $(call GENDOC_INNER
,$(1),pdf
,pdf
,pdf
,PDF
,--dblatex-opts
"-P latex.output.revhistory=0")
765 $(call GENDOC_INNER
,$(1),text
,txt
,text
,Text
)
766 $(call GENDOC_INNER
,$(1),epub
,epub
,epub
,EPUB
)
769 $(Q
)$(RM
) -rf
$(O
)/docs
/$(1)
770 .PHONY
: $(1) clean-
$(1)
773 MANUAL_SOURCES
= $(wildcard docs
/manual
/*.txt
) $(wildcard docs
/images
/*)
774 $(eval
$(call GENDOC
,manual
))
776 .PHONY
: $(noconfig_targets
)