]> Git Repo - buildroot-mgba.git/blame - Makefile
zic: use <PKG>_STRIP_COMPONENTS
[buildroot-mgba.git] / Makefile
CommitLineData
6cbdfb64 1# Makefile for buildroot
ffde94bd 2#
15b26aee 3# Copyright (C) 1999-2005 by Erik Andersen <[email protected]>
e580ce84 4# Copyright (C) 2006-2014 by the Buildroot developers <[email protected]>
2f78767b 5# Copyright (C) 2014 by the Buildroot developers <[email protected]>
ffde94bd 6#
08782ae7 7# This program is free software; you can redistribute it and/or modify
2d523c23
EA
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.
ffde94bd 11#
2d523c23
EA
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
08782ae7 14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2d523c23 15# General Public License for more details.
b30d673c 16#
2d523c23
EA
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
3ad3d8a1 20#
02bf5816 21
2d523c23
EA
22#--------------------------------------------------------------
23# Just run 'make menuconfig', configure stuff, then run 'make'.
24# You shouldn't need to mess with anything beyond this point...
25#--------------------------------------------------------------
2d239bbe 26
5309e2e1
YM
27# This is our default rule, so must come first
28all:
29
e5e8fae8 30# Set and export the version string
841d3ac7 31export BR2_VERSION := 2015.08-git
e5e8fae8 32
0edfb24c 33# Check for minimal make version (note: this check will break at make 10.x)
c3e49d69 34MIN_MAKE_VERSION = 3.81
8139e21c 35ifneq ($(firstword $(sort $(MAKE_VERSION) $(MIN_MAKE_VERSION))),$(MIN_MAKE_VERSION))
0edfb24c
TDS
36$(error You have make '$(MAKE_VERSION)' installed. GNU make >= $(MIN_MAKE_VERSION) is required)
37endif
38
1d4104f0
FP
39export HOSTARCH := $(shell uname -m | \
40 sed -e s/i.86/x86/ \
41 -e s/sun4u/sparc64/ \
42 -e s/arm.*/arm/ \
43 -e s/sa110/arm/ \
7e674dfa 44 -e s/ppc64/powerpc64/ \
1d4104f0
FP
45 -e s/ppc/powerpc/ \
46 -e s/macppc/powerpc/\
47 -e s/sh.*/sh/)
48
2afb23a7
FP
49# Parallel execution of this Makefile is disabled because it changes
50# the packages building order, that can be a problem for two reasons:
51# - If a package has an unspecified optional dependency and that
52# dependency is present when the package is built, it is used,
53# otherwise it isn't (but compilation happily proceeds) so the end
54# result will differ if the order is swapped due to parallel
55# building.
56# - Also changing the building order can be a problem if two packages
57# manipulate the same file in the target directory.
58#
59# Taking into account the above considerations, if you still want to execute
60# this top-level Makefile in parallel comment the ".NOTPARALLEL" line and
1668e1da
FP
61# use the -j<jobs> option when building, e.g:
62# make -j$((`getconf _NPROCESSORS_ONLN`+1))
2d239bbe
YM
63.NOTPARALLEL:
64
6b1dd45b 65# absolute path
c3e49d69
FP
66TOPDIR := $(shell pwd)
67CONFIG_CONFIG_IN = Config.in
68CONFIG = support/kconfig
69DATE := $(shell date +%Y%m%d)
a0aef7c4 70
8258df27
YM
71# Compute the full local version string so packages can use it as-is
72# Need to export it, so it can be got from environment in children (eg. mconf)
c3e49d69 73export BR2_VERSION_FULL := $(BR2_VERSION)$(shell $(TOPDIR)/support/scripts/setlocalversion)
8258df27 74
c3e49d69 75noconfig_targets := menuconfig nconfig gconfig xconfig config oldconfig randconfig \
063f4ee3 76 defconfig %_defconfig allyesconfig allnoconfig silentoldconfig release \
6652770f 77 randpackageconfig allyespackageconfig allnopackageconfig \
7800b961 78 print-version olddefconfig
9e250356 79
256f142b
TP
80# Some global targets do not trigger a build, but are used to collect
81# metadata, or do various checks. When such targets are triggered,
82# some packages should not do their configuration sanity
83# checks. Provide them a BR_BUILDING variable set to 'y' when we're
84# actually building and they should do their sanity checks.
85#
86# We're building in two situations: when MAKECMDGOALS is empty
87# (default target is to build), or when MAKECMDGOALS contains
88# something else than one of the nobuild_targets.
4feeb2db
TP
89nobuild_targets := source source-check \
90 legal-info external-deps _external-deps \
91 clean distclean
256f142b
TP
92ifeq ($(MAKECMDGOALS),)
93BR_BUILDING = y
94else ifneq ($(filter-out $(nobuild_targets),$(MAKECMDGOALS)),)
95BR_BUILDING = y
96endif
97
580c6d9b 98# Strip quotes and then whitespaces
c3e49d69 99qstrip = $(strip $(subst ",,$(1)))
580c6d9b
TP
100#"))
101
f85f2de1 102# Variables for use in Make constructs
c3e49d69
FP
103comma := ,
104empty :=
105space := $(empty) $(empty)
f85f2de1 106
39ca6d50 107ifneq ("$(origin O)", "command line")
c3e49d69
FP
108O := output
109CONFIG_DIR := $(TOPDIR)
110NEED_WRAPPER =
39ca6d50
WW
111else
112# other packages might also support Linux-style out of tree builds
0be303ca 113# with the O=<dir> syntax (E.G. BusyBox does). As make automatically
39ca6d50
WW
114# forwards command line variable definitions those packages get very
115# confused. Fix this by telling make to not do so
116MAKEOVERRIDES =
117# strangely enough O is still passed to submakes with MAKEOVERRIDES
118# (with make 3.81 atleast), the only thing that changes is the output
119# of the origin function (command line -> environment).
120# Unfortunately some packages don't look at origin (E.G. uClibc 0.9.31+)
121# To really make O go away, we have to override it.
c3e49d69
FP
122override O := $(O)
123CONFIG_DIR := $(O)
de846f6e
PK
124# we need to pass O= everywhere we call back into the toplevel makefile
125EXTRAMAKEARGS = O=$(O)
c3e49d69 126NEED_WRAPPER = y
39ca6d50
WW
127endif
128
bb335175
TDS
129# bash prints the name of the directory on 'cd <dir>' if CDPATH is
130# set, so unset it here to not cause problems. Notice that the export
131# line doesn't affect the environment of $(shell ..) calls, so
132# explictly throw away any output from 'cd' here.
c3e49d69 133export CDPATH :=
bb335175
TDS
134BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && pwd)
135$(if $(BASE_DIR),, $(error output directory "$(O)" does not exist))
136
a4239f7f
TP
137
138# Handling of BR2_EXTERNAL.
139#
140# The value of BR2_EXTERNAL is stored in .br-external in the output directory.
141# On subsequent invocations of make, it is read in. It can still be overridden
142# on the command line, therefore the file is re-created every time make is run.
143#
f6e77103
BS
144# When BR2_EXTERNAL is set to an empty value (e.g. explicitly in command
145# line), the .br-external file is removed and we point to
146# support/dummy-external. This makes sure we can unconditionally include the
a4239f7f
TP
147# Config.in and external.mk from the BR2_EXTERNAL directory. In this case,
148# override is necessary so the user can clear BR2_EXTERNAL from the command
149# line, but the dummy path is still used internally.
150
151BR2_EXTERNAL_FILE = $(BASE_DIR)/.br-external
152-include $(BR2_EXTERNAL_FILE)
153ifeq ($(BR2_EXTERNAL),)
154 override BR2_EXTERNAL = support/dummy-external
155 $(shell rm -f $(BR2_EXTERNAL_FILE))
156else
5f5e5f29
YM
157 _BR2_EXTERNAL = $(shell cd $(BR2_EXTERNAL) >/dev/null 2>&1 && pwd)
158 ifeq ($(_BR2_EXTERNAL),)
159 $(error BR2_EXTERNAL='$(BR2_EXTERNAL)' does not exist, relative to $(TOPDIR))
160 endif
161 override BR2_EXTERNAL := $(_BR2_EXTERNAL)
a4239f7f
TP
162 $(shell echo BR2_EXTERNAL ?= $(BR2_EXTERNAL) > $(BR2_EXTERNAL_FILE))
163endif
164
5b686a06 165# To make sure that the environment variable overrides the .config option,
6768021c
AV
166# set this before including .config.
167ifneq ($(BR2_DL_DIR),)
168DL_DIR := $(BR2_DL_DIR)
169endif
170
171
f1fedbb2
YM
172# Need that early, before we scan packages
173# Avoids doing the $(or...) everytime
22d05901 174BR_GRAPH_OUT := $(or $(BR2_GRAPH_OUT),pdf)
a4239f7f 175
c3e49d69
FP
176BUILD_DIR := $(BASE_DIR)/build
177BINARIES_DIR := $(BASE_DIR)/images
178TARGET_DIR := $(BASE_DIR)/target
bb335175
TDS
179# initial definition so that 'make clean' works for most users, even without
180# .config. HOST_DIR will be overwritten later when .config is included.
c3e49d69 181HOST_DIR := $(BASE_DIR)/host
4a9a21b9 182GRAPHS_DIR := $(BASE_DIR)/graphs
c3e49d69
FP
183
184LEGAL_INFO_DIR = $(BASE_DIR)/legal-info
185REDIST_SOURCES_DIR_TARGET = $(LEGAL_INFO_DIR)/sources
186REDIST_SOURCES_DIR_HOST = $(LEGAL_INFO_DIR)/host-sources
187LICENSE_FILES_DIR_TARGET = $(LEGAL_INFO_DIR)/licenses
188LICENSE_FILES_DIR_HOST = $(LEGAL_INFO_DIR)/host-licenses
189LEGAL_MANIFEST_CSV_TARGET = $(LEGAL_INFO_DIR)/manifest.csv
190LEGAL_MANIFEST_CSV_HOST = $(LEGAL_INFO_DIR)/host-manifest.csv
191LEGAL_LICENSES_TXT_TARGET = $(LEGAL_INFO_DIR)/licenses.txt
192LEGAL_LICENSES_TXT_HOST = $(LEGAL_INFO_DIR)/host-licenses.txt
193LEGAL_WARNINGS = $(LEGAL_INFO_DIR)/.warnings
194LEGAL_REPORT = $(LEGAL_INFO_DIR)/README
195
196BR2_CONFIG = $(CONFIG_DIR)/.config
2b0f4552 197
a1b0651a
US
198# Pull in the user's configuration file
199ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
4113b3c3 200-include $(BR2_CONFIG)
7521f373 201endif
9741a49e 202
afc61c6e
BRF
203# To put more focus on warnings, be less verbose as default
204# Use 'make V=1' to see the full commands
6bf9e233
MY
205ifeq ("$(origin V)", "command line")
206 KBUILD_VERBOSE = $(V)
afc61c6e
BRF
207endif
208ifndef KBUILD_VERBOSE
c3e49d69 209 KBUILD_VERBOSE = 0
afc61c6e
BRF
210endif
211
212ifeq ($(KBUILD_VERBOSE),1)
c3e49d69
FP
213 quiet =
214 Q =
1669b6ed 215ifndef VERBOSE
c3e49d69 216 VERBOSE = 1
1669b6ed 217endif
30702986 218export VERBOSE
afc61c6e 219else
c3e49d69
FP
220 quiet = quiet_
221 Q = @
afc61c6e
BRF
222endif
223
69f85924 224# we want bash as shell
c3e49d69
FP
225SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
226 else if [ -x /bin/bash ]; then echo /bin/bash; \
227 else echo sh; fi; fi)
afc61c6e 228
69f85924 229# kconfig uses CONFIG_SHELL
c3e49d69 230CONFIG_SHELL := $(SHELL)
69f85924 231
30702986 232export SHELL CONFIG_SHELL quiet Q KBUILD_VERBOSE
afc61c6e
BRF
233
234ifndef HOSTAR
c3e49d69 235HOSTAR := ar
afc61c6e
BRF
236endif
237ifndef HOSTAS
c3e49d69 238HOSTAS := as
afc61c6e
BRF
239endif
240ifndef HOSTCC
c3e49d69
FP
241HOSTCC := gcc
242HOSTCC := $(shell which $(HOSTCC) || type -p $(HOSTCC) || echo gcc)
afc61c6e 243endif
c3e49d69 244HOSTCC_NOCCACHE := $(HOSTCC)
afc61c6e 245ifndef HOSTCXX
c3e49d69
FP
246HOSTCXX := g++
247HOSTCXX := $(shell which $(HOSTCXX) || type -p $(HOSTCXX) || echo g++)
afc61c6e 248endif
c3e49d69 249HOSTCXX_NOCCACHE := $(HOSTCXX)
356133b4 250ifndef HOSTCPP
c3e49d69 251HOSTCPP := cpp
356133b4 252endif
afc61c6e 253ifndef HOSTLD
c3e49d69 254HOSTLD := ld
afc61c6e 255endif
0f9c5b11 256ifndef HOSTLN
c3e49d69 257HOSTLN := ln
0f9c5b11 258endif
356133b4 259ifndef HOSTNM
c3e49d69 260HOSTNM := nm
356133b4 261endif
f1f4451a 262ifndef HOSTOBJCOPY
c3e49d69 263HOSTOBJCOPY := objcopy
f1f4451a
TP
264endif
265ifndef HOSTRANLIB
c3e49d69
FP
266HOSTRANLIB := ranlib
267endif
268HOSTAR := $(shell which $(HOSTAR) || type -p $(HOSTAR) || echo ar)
269HOSTAS := $(shell which $(HOSTAS) || type -p $(HOSTAS) || echo as)
c3e49d69
FP
270HOSTCPP := $(shell which $(HOSTCPP) || type -p $(HOSTCPP) || echo cpp)
271HOSTLD := $(shell which $(HOSTLD) || type -p $(HOSTLD) || echo ld)
272HOSTLN := $(shell which $(HOSTLN) || type -p $(HOSTLN) || echo ln)
273HOSTNM := $(shell which $(HOSTNM) || type -p $(HOSTNM) || echo nm)
274HOSTOBJCOPY := $(shell which $(HOSTOBJCOPY) || type -p $(HOSTOBJCOPY) || echo objcopy)
275HOSTRANLIB := $(shell which $(HOSTRANLIB) || type -p $(HOSTRANLIB) || echo ranlib)
54e93328 276
a9847d14 277export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTLD
17b66aff 278export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE
afc61c6e 279
670cb306 280# Make sure pkg-config doesn't look outside the buildroot tree
0515fe45 281HOST_PKG_CONFIG_PATH := $(PKG_CONFIG_PATH)
670cb306 282unexport PKG_CONFIG_PATH
4f607edf 283unexport PKG_CONFIG_SYSROOT_DIR
bdf472d5 284unexport PKG_CONFIG_LIBDIR
670cb306 285
91123a6f
TP
286# Having DESTDIR set in the environment confuses the installation
287# steps of some packages.
288unexport DESTDIR
289
bed61a7b
GZ
290# Causes breakage with packages that needs host-ruby
291unexport RUBYOPT
292
3ed0eada 293include package/pkg-utils.mk
ab6a6212 294include package/doc-asciidoc.mk
3ed0eada 295
cfe511b2 296ifeq ($(BR2_HAVE_DOT_CONFIG),y)
54e098e4 297
95442bb3 298################################################################################
2c649045
PK
299#
300# Hide troublesome environment variables from sub processes
301#
95442bb3 302################################################################################
2c649045
PK
303unexport CROSS_COMPILE
304unexport ARCH
2bf3c166
DN
305unexport CC
306unexport CXX
307unexport CPP
308unexport CFLAGS
309unexport CXXFLAGS
310unexport GREP_OPTIONS
f5437a65 311unexport TAR_OPTIONS
12c9f7dd 312unexport CONFIG_SITE
32314b44 313unexport QMAKESPEC
20ca008d 314unexport TERMINFO
6d3b9756 315unexport MACHINE
27bc59d4 316
c3e49d69 317GNU_HOST_NAME := $(shell support/gnuconfig/config.guess)
60281cbf 318
8a58e023 319PACKAGES :=
acc706b7 320
89464a96 321# silent mode requested?
fffb68a8 322QUIET := $(if $(findstring s,$(filter-out --%,$(MAKEFLAGS))),-q)
89464a96 323
397fe5cc 324# Strip off the annoying quoting
c3e49d69 325ARCH := $(call qstrip,$(BR2_ARCH))
65e80a0b 326
c3e49d69 327KERNEL_ARCH := $(shell echo "$(ARCH)" | sed -e "s/-.*//" \
891973f5 328 -e s/i.86/i386/ -e s/sun4u/sparc64/ \
f59aeca6 329 -e s/arcle/arc/ \
8332ffab 330 -e s/arceb/arc/ \
891973f5 331 -e s/arm.*/arm/ -e s/sa110/arm/ \
b90a1030 332 -e s/aarch64/arm64/ \
871db074 333 -e s/bfin/blackfin/ \
891973f5 334 -e s/parisc64/parisc/ \
a426a919 335 -e s/powerpc64.*/powerpc/ \
891973f5 336 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
c220581c
JD
337 -e s/sh.*/sh/ \
338 -e s/microblazeel/microblaze/)
891973f5 339
c3e49d69
FP
340ZCAT := $(call qstrip,$(BR2_ZCAT))
341BZCAT := $(call qstrip,$(BR2_BZCAT))
342XZCAT := $(call qstrip,$(BR2_XZCAT))
343TAR_OPTIONS = $(call qstrip,$(BR2_TAR_OPTIONS)) -xf
397fe5cc 344
a2b4f7fb 345# packages compiled for the host go here
c3e49d69 346HOST_DIR := $(call qstrip,$(BR2_HOST_DIR))
397fe5cc 347
caa329bf 348# Quotes are needed for spaces and all in the original PATH content.
c7d660b1 349BR_PATH = "$(HOST_DIR)/bin:$(HOST_DIR)/sbin:$(HOST_DIR)/usr/bin:$(HOST_DIR)/usr/sbin:$(PATH)"
caa329bf 350
c3e49d69 351TARGET_SKELETON = $(TOPDIR)/system/skeleton
397fe5cc 352
9226a990
TP
353# Location of a file giving a big fat warning that output/target
354# should not be used as the root filesystem.
c3e49d69 355TARGET_DIR_WARNING_FILE = $(TARGET_DIR)/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
9226a990 356
17b66aff 357ifeq ($(BR2_CCACHE),y)
c3e49d69 358CCACHE := $(HOST_DIR)/usr/bin/ccache
e7ab4b49
AV
359BR_CACHE_DIR = $(call qstrip,$(BR2_CCACHE_DIR))
360export BR_CACHE_DIR
c3e49d69 361HOSTCC := $(CCACHE) $(HOSTCC)
17b66aff
TP
362HOSTCXX := $(CCACHE) $(HOSTCXX)
363endif
364
2b0f4552
YM
365# Scripts in support/ or post-build scripts may need to reference
366# these locations, so export them so it is easier to use
4113b3c3 367export BR2_CONFIG
2b0f4552
YM
368export TARGET_DIR
369export STAGING_DIR
370export HOST_DIR
371export BINARIES_DIR
1300cb55 372export BASE_DIR
2b0f4552 373
95442bb3 374################################################################################
7dcbbfbb
BRF
375#
376# You should probably leave this stuff alone unless you know
377# what you are doing.
378#
95442bb3 379################################################################################
7dcbbfbb 380
6547bced 381all: world
ffde94bd 382
ebcfa987
AVEM
383# Include legacy before the other things, because package .mk files
384# may rely on it.
385ifneq ($(BR2_DEPRECATED),y)
386include Makefile.legacy
387endif
388
486253db 389include package/Makefile.in
a792668b
TDS
390include support/dependencies/dependencies.mk
391
11c1076d 392include toolchain/*.mk
8b0905bf 393include toolchain/*/*.mk
acc706b7 394
ee0246e1
TP
395# Include the package override file if one has been provided in the
396# configuration.
c3e49d69 397PACKAGE_OVERRIDE_FILE = $(call qstrip,$(BR2_PACKAGE_OVERRIDE_FILE))
ee0246e1
TP
398ifneq ($(PACKAGE_OVERRIDE_FILE),)
399-include $(PACKAGE_OVERRIDE_FILE)
400endif
401
741cbccb 402include $(sort $(wildcard package/*/*.mk))
d06645d8 403
64d8e9a0 404include boot/common.mk
64d8e9a0 405include linux/linux.mk
ec100c7e 406include system/system.mk
00b1ff61 407include fs/common.mk
64d8e9a0 408
8eb8aaf9
TP
409include $(BR2_EXTERNAL)/external.mk
410
d21a176b 411dirs: $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
e0c60677 412 $(HOST_DIR) $(BINARIES_DIR)
f958d897 413
4113b3c3 414$(BUILD_DIR)/buildroot-config/auto.conf: $(BR2_CONFIG)
879058a1 415 $(MAKE1) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig
0b368800
TP
416
417prepare: $(BUILD_DIR)/buildroot-config/auto.conf
418
a2487758 419world: target-post-image
2a786415
FP
420
421.PHONY: all world toolchain dirs clean distclean source outputmakefile \
df79e35a 422 legal-info legal-info-prepare legal-info-clean printvars help \
7800b961 423 list-defconfigs target-finalize target-post-image source-check
ffde94bd 424
95442bb3 425################################################################################
08782ae7 426#
ef407d3d 427# staging and target directories do NOT list these as
d99c31c6 428# dependencies anywhere else
08782ae7 429#
95442bb3 430################################################################################
e0c60677 431$(BUILD_DIR) $(HOST_DIR) $(BINARIES_DIR) $(LEGAL_INFO_DIR) $(REDIST_SOURCES_DIR_TARGET) $(REDIST_SOURCES_DIR_HOST):
8d583fc0 432 @mkdir -p $@
3ad3d8a1 433
5628776c
SM
434# We make a symlink lib32->lib or lib64->lib as appropriate
435# MIPS64/n32 requires lib32 even though it's a 64-bit arch.
436ifeq ($(BR2_ARCH_IS_64)$(BR2_MIPS_NABI32),y)
437LIB_SYMLINK = lib64
438else
439LIB_SYMLINK = lib32
440endif
441
08782ae7 442$(STAGING_DIR):
9c865d75 443 @mkdir -p $(STAGING_DIR)/bin
bf38723f 444 @mkdir -p $(STAGING_DIR)/lib
5628776c 445 @ln -snf lib $(STAGING_DIR)/$(LIB_SYMLINK)
8027784c 446 @mkdir -p $(STAGING_DIR)/usr/lib
5628776c 447 @ln -snf lib $(STAGING_DIR)/usr/$(LIB_SYMLINK)
8027784c 448 @mkdir -p $(STAGING_DIR)/usr/include
a05c337d 449 @mkdir -p $(STAGING_DIR)/usr/bin
5ad139eb 450 @ln -snf $(STAGING_DIR) $(BASE_DIR)/staging
ffde94bd 451
2b3a43f4 452ifeq ($(BR2_ROOTFS_SKELETON_CUSTOM),y)
c3e49d69 453TARGET_SKELETON = $(BR2_ROOTFS_SKELETON_CUSTOM_PATH)
2b3a43f4
DM
454endif
455
7ad28656
TDS
456RSYNC_VCS_EXCLUSIONS = \
457 --exclude .svn --exclude .git --exclude .hg --exclude .bzr \
458 --exclude CVS
459
397fe5cc 460$(BUILD_DIR)/.root:
7547c7eb 461 mkdir -p $(TARGET_DIR)
2f865405 462 rsync -a --ignore-times $(RSYNC_VCS_EXCLUSIONS) \
5f52d7a8 463 --chmod=Du+w --exclude .empty --exclude '*~' \
13c07c79 464 $(TARGET_SKELETON)/ $(TARGET_DIR)/
984524fd 465 $(INSTALL) -m 0644 support/misc/target-dir-warning.txt $(TARGET_DIR_WARNING_FILE)
6f1882de 466 @ln -snf lib $(TARGET_DIR)/$(LIB_SYMLINK)
5628776c 467 @mkdir -p $(TARGET_DIR)/usr
6f1882de 468 @ln -snf lib $(TARGET_DIR)/usr/$(LIB_SYMLINK)
7547c7eb 469 touch $@
08782ae7 470
397fe5cc 471$(TARGET_DIR): $(BUILD_DIR)/.root
c6771dfb 472
2a97045d
TDS
473STRIP_FIND_CMD = find $(TARGET_DIR)
474ifneq (,$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS)))
475STRIP_FIND_CMD += \( $(call finddirclauses,$(TARGET_DIR),$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS))) \) -prune -o
476endif
12d15072 477STRIP_FIND_CMD += -type f \( -perm /111 -o -name '*.so*' \)
06635916
TDS
478# file exclusions:
479# - libpthread.so: a non-stripped libpthread shared library is needed for
480# proper debugging of pthread programs using gdb.
481# - kernel modules (*.ko): do not function properly when stripped like normal
482# applications and libraries. Normally kernel modules are already excluded
483# by the executable permission check above, so the explicit exclusion is only
484# done for kernel modules with incorrect permissions.
26f215d1 485STRIP_FIND_CMD += -not \( $(call findfileclauses,libpthread*.so* *.ko $(call qstrip,$(BR2_STRIP_EXCLUDE_FILES))) \) -print0
2a97045d 486
28685d5f
FP
487ifeq ($(BR2_ECLIPSE_REGISTER),y)
488define TOOLCHAIN_ECLIPSE_REGISTER
489 ./support/scripts/eclipse-register-toolchain `readlink -f $(O)` \
490 $(notdir $(TARGET_CROSS)) $(BR2_ARCH)
491endef
492TARGET_FINALIZE_HOOKS += TOOLCHAIN_ECLIPSE_REGISTER
493endif
494
33de7401
FP
495# Generate locale data. Basically, we call the localedef program
496# (built by the host-localedef package) for each locale. The input
497# data comes preferably from the toolchain, or if the toolchain does
498# not have them (Linaro toolchains), we use the ones available on the
499# host machine.
500ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),y)
404f4933
TP
501GLIBC_GENERATE_LOCALES = $(call qstrip,$(BR2_GENERATE_LOCALE))
502ifneq ($(GLIBC_GENERATE_LOCALES),)
8a58e023 503PACKAGES += host-localedef
33de7401 504
404f4933 505define GENERATE_GLIBC_LOCALES
33de7401 506 $(Q)mkdir -p $(TARGET_DIR)/usr/lib/locale/
404f4933 507 $(Q)for locale in $(GLIBC_GENERATE_LOCALES) ; do \
33de7401
FP
508 inputfile=`echo $${locale} | cut -f1 -d'.'` ; \
509 charmap=`echo $${locale} | cut -f2 -d'.' -s` ; \
510 if test -z "$${charmap}" ; then \
511 charmap="UTF-8" ; \
512 fi ; \
513 echo "Generating locale $${inputfile}.$${charmap}" ; \
514 I18NPATH=$(STAGING_DIR)/usr/share/i18n:/usr/share/i18n \
515 $(HOST_DIR)/usr/bin/localedef \
516 --prefix=$(TARGET_DIR) \
517 --$(call LOWERCASE,$(BR2_ENDIAN))-endian \
518 -i $${inputfile} -f $${charmap} \
519 $${locale} ; \
520 done
521endef
404f4933 522TARGET_FINALIZE_HOOKS += GENERATE_GLIBC_LOCALES
33de7401
FP
523endif
524endif
525
58d82dda
FP
526ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
527LOCALE_WHITELIST = $(BUILD_DIR)/locales.nopurge
528LOCALE_NOPURGE = $(call qstrip,$(BR2_ENABLE_LOCALE_WHITELIST))
529
8d384fa8 530define PURGE_LOCALES
58d82dda 531 rm -f $(LOCALE_WHITELIST)
201adefb 532 for i in $(LOCALE_NOPURGE) locale-archive; do echo $$i >> $(LOCALE_WHITELIST); done
58d82dda
FP
533
534 for dir in $(wildcard $(addprefix $(TARGET_DIR),/usr/share/locale /usr/share/X11/locale /usr/man /usr/share/man /usr/lib/locale)); \
535 do \
536 for lang in $$(cd $$dir; ls .|grep -v man); \
537 do \
538 grep -qx $$lang $(LOCALE_WHITELIST) || rm -rf $$dir/$$lang; \
539 done; \
540 done
541endef
8d384fa8 542TARGET_FINALIZE_HOOKS += PURGE_LOCALES
58d82dda
FP
543endif
544
d4c0c642
FP
545$(TARGETS_ROOTFS): target-finalize
546
8a58e023 547target-finalize: $(PACKAGES)
6f6a2cfd 548 @$(call MESSAGE,"Finalizing target directory")
8d384fa8 549 $(foreach hook,$(TARGET_FINALIZE_HOOKS),$($(hook))$(sep))
94d3aa17 550 rm -rf $(TARGET_DIR)/usr/include $(TARGET_DIR)/usr/share/aclocal \
df99efb3
LC
551 $(TARGET_DIR)/usr/lib/pkgconfig $(TARGET_DIR)/usr/share/pkgconfig \
552 $(TARGET_DIR)/usr/lib/cmake $(TARGET_DIR)/usr/share/cmake
553 find $(TARGET_DIR)/usr/{lib,share}/ -name '*.cmake' -print0 | xargs -0 rm -f
027aa1d2
WB
554 find $(TARGET_DIR)/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
555 find $(TARGET_DIR)/usr/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
e48a72e5
MS
556ifneq ($(BR2_PACKAGE_GDB),y)
557 rm -rf $(TARGET_DIR)/usr/share/gdb
558endif
32faf351 559 rm -rf $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/man
32faf351 560 rm -rf $(TARGET_DIR)/usr/info $(TARGET_DIR)/usr/share/info
87b0637b 561 rm -rf $(TARGET_DIR)/usr/doc $(TARGET_DIR)/usr/share/doc
d701a823 562 rm -rf $(TARGET_DIR)/usr/share/gtk-doc
68ad6d4e 563 -rmdir $(TARGET_DIR)/usr/share 2>/dev/null
26f215d1 564 $(STRIP_FIND_CMD) | xargs -0 $(STRIPCMD) 2>/dev/null || true
f627ebeb 565 if test -d $(TARGET_DIR)/lib/modules; then \
e4dde253 566 find $(TARGET_DIR)/lib/modules -type f -name '*.ko' -print0 | \
567 xargs -0 -r $(KSTRIPCMD); fi
8101c9a3 568
6ae7886f
RB
569# See http://sourceware.org/gdb/wiki/FAQ, "GDB does not see any threads
570# besides the one in which crash occurred; or SIGTRAP kills my program when
571# I set a breakpoint"
572ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
573 find $(TARGET_DIR)/lib -type f -name 'libpthread*.so*' | \
52e7073a 574 xargs -r $(STRIPCMD) $(STRIP_STRIP_DEBUG)
6ae7886f
RB
575endif
576
4ccde7fa 577 mkdir -p $(TARGET_DIR)/etc
60e9a793 578 # Mandatory configuration file and auxiliary cache directory
4ccde7fa
TP
579 # for recent versions of ldconfig
580 touch $(TARGET_DIR)/etc/ld.so.conf
581 mkdir -p $(TARGET_DIR)/var/cache/ldconfig
e49e2fed
PK
582 if [ -x "$(TARGET_CROSS)ldconfig" ]; \
583 then \
1c4d3555
YM
584 $(TARGET_CROSS)ldconfig -r $(TARGET_DIR) \
585 -f $(TARGET_DIR)/etc/ld.so.conf; \
e49e2fed 586 else \
1c4d3555
YM
587 /sbin/ldconfig -r $(TARGET_DIR) \
588 -f $(TARGET_DIR)/etc/ld.so.conf; \
e49e2fed 589 fi
451a8878
PK
590 ( \
591 echo "NAME=Buildroot"; \
592 echo "VERSION=$(BR2_VERSION_FULL)"; \
593 echo "ID=buildroot"; \
594 echo "VERSION_ID=$(BR2_VERSION)"; \
595 echo "PRETTY_NAME=\"Buildroot $(BR2_VERSION)\"" \
596 ) > $(TARGET_DIR)/etc/os-release
912ea81a 597
e9b77128
LC
598 @$(foreach d, $(call qstrip,$(BR2_ROOTFS_OVERLAY)), \
599 $(call MESSAGE,"Copying overlay $(d)"); \
99e82b0d 600 rsync -a --ignore-times $(RSYNC_VCS_EXCLUSIONS) \
5f52d7a8 601 --chmod=Du+w --exclude .empty --exclude '*~' \
e9b77128 602 $(d)/ $(TARGET_DIR)$(sep))
7f860892 603
dbf4978e 604 @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_BUILD_SCRIPT)), \
1b9b1685 605 $(call MESSAGE,"Executing post-build script $(s)"); \
9806bf5a 606 $(EXTRA_ENV) $(s) $(TARGET_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
eed7d873 607
fbb3b862 608target-post-image: $(TARGETS_ROOTFS) target-finalize
9fa32ba0 609 @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_IMAGE_SCRIPT)), \
6d90a69f 610 $(call MESSAGE,"Executing post-image script $(s)"); \
9806bf5a 611 $(EXTRA_ENV) $(s) $(BINARIES_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
9fa32ba0 612
17dcad06 613source: $(foreach p,$(PACKAGES),$(p)-all-source)
08782ae7 614
7e679ccb 615_external-deps: $(foreach p,$(PACKAGES),$(p)-all-external-deps)
155971e0 616external-deps:
7e679ccb 617 @$(MAKE1) -Bs $(EXTRAMAKEARGS) _external-deps | sort -u
155971e0 618
7800b961 619# check if download URLs are outdated
f9b92824 620source-check: $(foreach p,$(PACKAGES),$(p)-all-source-check)
7800b961 621
7e76f904
LC
622legal-info-clean:
623 @rm -fr $(LEGAL_INFO_DIR)
624
625legal-info-prepare: $(LEGAL_INFO_DIR)
626 @$(call MESSAGE,"Collecting legal info")
366f17f7 627 @$(call legal-license-file,buildroot,COPYING,COPYING,HOST)
af629e49
CS
628 @$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE,SOURCE SITE,TARGET)
629 @$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE,SOURCE SITE,HOST)
630 @$(call legal-manifest,buildroot,$(BR2_VERSION_FULL),GPLv2+,COPYING,not saved,not saved,HOST)
7e76f904
LC
631 @$(call legal-warning,the Buildroot source code has not been saved)
632 @$(call legal-warning,the toolchain has not been saved)
4113b3c3 633 @cp $(BR2_CONFIG) $(LEGAL_INFO_DIR)/buildroot.config
7e76f904 634
5db22b36 635legal-info: dirs legal-info-clean legal-info-prepare $(foreach p,$(PACKAGES),$(p)-all-legal-info) \
858334c2 636 $(REDIST_SOURCES_DIR_TARGET) $(REDIST_SOURCES_DIR_HOST)
7e76f904
LC
637 @cat support/legal-info/README.header >>$(LEGAL_REPORT)
638 @if [ -r $(LEGAL_WARNINGS) ]; then \
639 cat support/legal-info/README.warnings-header \
640 $(LEGAL_WARNINGS) >>$(LEGAL_REPORT); \
641 cat $(LEGAL_WARNINGS); fi
642 @echo "Legal info produced in $(LEGAL_INFO_DIR)"
643 @rm -f $(LEGAL_WARNINGS)
644
b7d6c8ad 645show-targets:
adc88b86 646 @echo $(PACKAGES) $(TARGETS_ROOTFS)
b7d6c8ad 647
e16bf922 648graph-build: $(O)/build/build-time.log
4a9a21b9 649 @install -d $(GRAPHS_DIR)
e16bf922
YM
650 $(foreach o,name build duration,./support/scripts/graph-build-time \
651 --type=histogram --order=$(o) --input=$(<) \
4a9a21b9 652 --output=$(GRAPHS_DIR)/build.hist-$(o).$(BR_GRAPH_OUT) \
8ae7838c 653 $(if $(BR2_GRAPH_ALT),--alternate-colors)$(sep))
e16bf922
YM
654 $(foreach t,packages steps,./support/scripts/graph-build-time \
655 --type=pie-$(t) --input=$(<) \
4a9a21b9 656 --output=$(GRAPHS_DIR)/build.pie-$(t).$(BR_GRAPH_OUT) \
8ae7838c 657 $(if $(BR2_GRAPH_ALT),--alternate-colors)$(sep))
e16bf922 658
d3c1c647 659graph-depends-requirements:
664f2707 660 @dot -? >/dev/null 2>&1 || \
d3c1c647
FP
661 { echo "ERROR: The 'dot' program from Graphviz is needed for graph-depends" >&2; exit 1; }
662
663graph-depends: graph-depends-requirements
4a9a21b9 664 @$(INSTALL) -d $(GRAPHS_DIR)
56eb3944 665 @cd "$(CONFIG_DIR)"; \
287a8828 666 $(TOPDIR)/support/scripts/graph-depends $(BR2_GRAPH_DEPS_OPTS) \
4a9a21b9
TP
667 |tee $(GRAPHS_DIR)/$(@).dot \
668 |dot $(BR2_GRAPH_DOT_OPTS) -T$(BR_GRAPH_OUT) -o $(GRAPHS_DIR)/$(@).$(BR_GRAPH_OUT)
0cfe3ab8 669
cfe511b2 670else # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
2d523c23
EA
671
672all: menuconfig
673
1ed49963
AVEM
674endif # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
675
2d523c23
EA
676# configuration
677# ---------------------------------------------------------------------------
678
c3e49d69 679HOSTCFLAGS = $(CFLAGS_FOR_BUILD)
c0d7d4e0
BRF
680export HOSTCFLAGS
681
2cc210c9
PK
682$(BUILD_DIR)/buildroot-config/%onf:
683 mkdir -p $(@D)/lxdialog
0515fe45
BF
684 PKG_CONFIG_PATH="$(HOST_PKG_CONFIG_PATH)" $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" \
685 obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)
2d523c23 686
1ed49963
AVEM
687DEFCONFIG = $(call qstrip,$(BR2_DEFCONFIG))
688
689# We don't want to fully expand BR2_DEFCONFIG here, so Kconfig will
690# recognize that if it's still at its default $(CONFIG_DIR)/defconfig
1039eb74 691COMMON_CONFIG_ENV = \
1ed49963 692 BR2_DEFCONFIG='$(call qstrip,$(value BR2_DEFCONFIG))' \
1039eb74
TP
693 KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
694 KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
0b368800 695 KCONFIG_TRISTATE=$(BUILD_DIR)/buildroot-config/tristate.config \
4113b3c3 696 BR2_CONFIG=$(BR2_CONFIG) \
53903a15
AV
697 BR2_EXTERNAL=$(BR2_EXTERNAL) \
698 SKIP_LEGACY=
2d523c23 699
aefad531 700xconfig: $(BUILD_DIR)/buildroot-config/qconf outputmakefile
610255e7 701 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
b0df9df3 702
aefad531 703gconfig: $(BUILD_DIR)/buildroot-config/gconf outputmakefile
610255e7 704 @$(COMMON_CONFIG_ENV) srctree=$(TOPDIR) $< $(CONFIG_CONFIG_IN)
2b42aae7 705
aefad531 706menuconfig: $(BUILD_DIR)/buildroot-config/mconf outputmakefile
610255e7 707 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
2d523c23 708
aefad531 709nconfig: $(BUILD_DIR)/buildroot-config/nconf outputmakefile
610255e7 710 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
2d523c23 711
aefad531 712config: $(BUILD_DIR)/buildroot-config/conf outputmakefile
1039eb74 713 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
2d523c23 714
53903a15
AV
715# For the config targets that automatically select options, we pass
716# SKIP_LEGACY=y to disable the legacy options. However, in that case
717# no values are set for the legacy options so a subsequent oldconfig
718# will query them. Therefore, run an additional olddefconfig.
719
aefad531 720oldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
1039eb74 721 @$(COMMON_CONFIG_ENV) $< --oldconfig $(CONFIG_CONFIG_IN)
2d523c23 722
aefad531 723randconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
53903a15
AV
724 @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y $< --randconfig $(CONFIG_CONFIG_IN)
725 @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
2d523c23 726
aefad531 727allyesconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
53903a15
AV
728 @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y $< --allyesconfig $(CONFIG_CONFIG_IN)
729 @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
2d523c23 730
aefad531 731allnoconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
53903a15
AV
732 @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y $< --allnoconfig $(CONFIG_CONFIG_IN)
733 @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
2d523c23 734
aefad531 735randpackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
4113b3c3 736 @grep -v BR2_PACKAGE_ $(BR2_CONFIG) > $(CONFIG_DIR)/.config.nopkg
53903a15 737 @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y \
39ca6d50 738 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
1039eb74 739 $< --randconfig $(CONFIG_CONFIG_IN)
39ca6d50 740 @rm -f $(CONFIG_DIR)/.config.nopkg
53903a15 741 @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
6652770f 742
aefad531 743allyespackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
4113b3c3 744 @grep -v BR2_PACKAGE_ $(BR2_CONFIG) > $(CONFIG_DIR)/.config.nopkg
53903a15 745 @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y \
39ca6d50 746 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
1039eb74 747 $< --allyesconfig $(CONFIG_CONFIG_IN)
39ca6d50 748 @rm -f $(CONFIG_DIR)/.config.nopkg
53903a15 749 @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
6652770f 750
aefad531 751allnopackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
4113b3c3 752 @grep -v BR2_PACKAGE_ $(BR2_CONFIG) > $(CONFIG_DIR)/.config.nopkg
53903a15 753 @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y \
39ca6d50 754 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
1039eb74 755 $< --allnoconfig $(CONFIG_CONFIG_IN)
39ca6d50 756 @rm -f $(CONFIG_DIR)/.config.nopkg
53903a15 757 @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
6652770f 758
aefad531 759silentoldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
0b368800
TP
760 $(COMMON_CONFIG_ENV) $< --silentoldconfig $(CONFIG_CONFIG_IN)
761
9db3b47e 762olddefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
9db3b47e
TP
763 $(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN)
764
aefad531 765defconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
1ed49963 766 @$(COMMON_CONFIG_ENV) $< --defconfig$(if $(DEFCONFIG),=$(DEFCONFIG)) $(CONFIG_CONFIG_IN)
2d523c23 767
32babbf9 768# Override the BR2_DEFCONFIG from COMMON_CONFIG_ENV with the new defconfig
aefad531 769%_defconfig: $(BUILD_DIR)/buildroot-config/conf $(TOPDIR)/configs/%_defconfig outputmakefile
32babbf9
AV
770 @$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$(TOPDIR)/configs/$@ \
771 $< --defconfig=$(TOPDIR)/configs/$@ $(CONFIG_CONFIG_IN)
6f38119c 772
ff9d6e30 773%_defconfig: $(BUILD_DIR)/buildroot-config/conf $(BR2_EXTERNAL)/configs/%_defconfig outputmakefile
32babbf9
AV
774 @$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$(BR2_EXTERNAL)/configs/$@ \
775 $< --defconfig=$(BR2_EXTERNAL)/configs/$@ $(CONFIG_CONFIG_IN)
ff9d6e30 776
aefad531 777savedefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
1ed49963
AVEM
778 @$(COMMON_CONFIG_ENV) $< \
779 --savedefconfig=$(if $(DEFCONFIG),$(DEFCONFIG),$(CONFIG_DIR)/defconfig) \
780 $(CONFIG_CONFIG_IN)
f71a621d 781 @$(SED) '/BR2_DEFCONFIG=/d' $(if $(DEFCONFIG),$(DEFCONFIG),$(CONFIG_DIR)/defconfig)
2d523c23 782
1ed49963 783.PHONY: defconfig savedefconfig
406053d5 784
95442bb3 785################################################################################
2d523c23
EA
786#
787# Cleanup and misc junk
788#
95442bb3 789################################################################################
aefad531
YM
790
791# outputmakefile generates a Makefile in the output directory, if using a
792# separate output directory. This allows convenient use of make in the
793# output directory.
794outputmakefile:
795ifeq ($(NEED_WRAPPER),y)
f082c7c5 796 $(Q)$(TOPDIR)/support/scripts/mkmakefile $(TOPDIR) $(O)
aefad531
YM
797endif
798
98b616d7
ÉV
799# printvars prints all the variables currently defined in our Makefiles
800printvars:
801 @$(foreach V, \
802 $(sort $(.VARIABLES)), \
803 $(if $(filter-out environment% default automatic, \
804 $(origin $V)), \
805 $(info $V=$($V) ($(value $V)))))
806
2d523c23 807clean:
300eb6b7 808 rm -rf $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
e0c60677 809 $(BUILD_DIR) $(BASE_DIR)/staging \
4a9a21b9 810 $(LEGAL_INFO_DIR) $(GRAPHS_DIR)
2d523c23
EA
811
812distclean: clean
406053d5
PK
813ifeq ($(DL_DIR),$(TOPDIR)/dl)
814 rm -rf $(DL_DIR)
815endif
816ifeq ($(O),output)
817 rm -rf $(O)
818endif
ad24d833
YM
819 rm -rf $(BR2_CONFIG) $(CONFIG_DIR)/.config.old $(CONFIG_DIR)/..config.tmp \
820 $(CONFIG_DIR)/.auto.deps
2d523c23 821
e491fba2
BRF
822help:
823 @echo 'Cleaning:'
406053d5 824 @echo ' clean - delete all files created by build'
e491fba2
BRF
825 @echo ' distclean - delete all non-source files (including .config)'
826 @echo
827 @echo 'Build:'
828 @echo ' all - make world'
2a786415 829 @echo ' toolchain - build toolchain'
e491fba2
BRF
830 @echo
831 @echo 'Configuration:'
832 @echo ' menuconfig - interactive curses-based configurator'
15f5bef0 833 @echo ' nconfig - interactive ncurses-based configurator'
c48bbb8c 834 @echo ' xconfig - interactive Qt-based configurator'
2b42aae7 835 @echo ' gconfig - interactive GTK-based configurator'
e491fba2 836 @echo ' oldconfig - resolve any unresolved symbols in .config'
9db3b47e
TP
837 @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps'
838 @echo ' olddefconfig - Same as silentoldconfig but sets new symbols to their default value'
c48bbb8c
PK
839 @echo ' randconfig - New config with random answer to all options'
840 @echo ' defconfig - New config with default answer to all options'
33f454bb 841 @echo ' BR2_DEFCONFIG, if set, is used as input'
5c1a75c0 842 @echo ' savedefconfig - Save current config to BR2_DEFCONFIG (minimal config)'
c48bbb8c
PK
843 @echo ' allyesconfig - New config where all options are accepted with yes'
844 @echo ' allnoconfig - New config where all options are answered with no'
6652770f
PK
845 @echo ' randpackageconfig - New config with random answer to package options'
846 @echo ' allyespackageconfig - New config where pkg options are accepted with yes'
847 @echo ' allnopackageconfig - New config where package options are answered with no'
b1e0b6d7
AV
848 @echo
849 @echo 'Package-specific:'
850 @echo ' <pkg> - Build and install <pkg> and all its dependencies'
851 @echo ' <pkg>-source - Only download the source files for <pkg>'
852 @echo ' <pkg>-extract - Extract <pkg> sources'
853 @echo ' <pkg>-patch - Apply patches to <pkg>'
854 @echo ' <pkg>-depends - Build <pkg>'\''s dependencies'
855 @echo ' <pkg>-configure - Build <pkg> up to the configure step'
856 @echo ' <pkg>-build - Build <pkg> up to the build step'
857 @echo ' <pkg>-graph-depends - Generate a graph of <pkg>'\''s dependencies'
858 @echo ' <pkg>-dirclean - Remove <pkg> build directory'
859 @echo ' <pkg>-reconfigure - Restart the build from the configure step'
860 @echo ' <pkg>-rebuild - Restart the build from the build step'
861 @echo ' <pkg>-legal-info - Generate license information for <pkg>'
4bb33dce
PK
862ifeq ($(BR2_PACKAGE_BUSYBOX),y)
863 @echo ' busybox-menuconfig - Run BusyBox menuconfig'
864endif
865ifeq ($(BR2_LINUX_KERNEL),y)
866 @echo ' linux-menuconfig - Run Linux kernel menuconfig'
f5777ce8 867 @echo ' linux-savedefconfig - Run Linux kernel savedefconfig'
7916b975
YY
868 @echo ' linux-update-defconfig - Save the Linux configuration to the path specified'
869 @echo ' by BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE'
4bb33dce
PK
870endif
871ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
872 @echo ' uclibc-menuconfig - Run uClibc menuconfig'
873endif
83f1bf9e
JCPV
874ifeq ($(BR2_TARGET_BAREBOX),y)
875 @echo ' barebox-menuconfig - Run barebox menuconfig'
876 @echo ' barebox-savedefconfig - Run barebox savedefconfig'
4bb33dce 877endif
8792cf9e
TP
878 @echo
879 @echo 'Documentation:'
55ecab1b 880 @echo ' manual - build manual in all formats'
8792cf9e
TP
881 @echo ' manual-html - build manual in HTML'
882 @echo ' manual-split-html - build manual in split HTML'
883 @echo ' manual-pdf - build manual in PDF'
462e9915 884 @echo ' manual-text - build manual in text'
8792cf9e 885 @echo ' manual-epub - build manual in ePub'
e16bf922 886 @echo ' graph-build - generate graphs of the build times'
0cfe3ab8 887 @echo ' graph-depends - generate graph of the dependency tree'
de6377e8 888 @echo ' list-defconfigs - list all defconfigs (pre-configured minimal systems)'
e491fba2
BRF
889 @echo
890 @echo 'Miscellaneous:'
891 @echo ' source - download all sources needed for offline-build'
07bae756 892 @echo ' source-check - check selected packages for valid download URLs'
155971e0 893 @echo ' external-deps - list external packages used'
7e76f904 894 @echo ' legal-info - generate info about license compliance'
e491fba2 895 @echo
15f5bef0
PK
896 @echo ' make V=0|1 - 0 => quiet build (default), 1 => verbose build'
897 @echo ' make O=dir - Locate all output files in "dir", including .config'
898 @echo
f42a580a
AV
899 @echo 'For further details, see README, generate the Buildroot manual, or consult'
900 @echo 'it on-line at http://buildroot.org/docs.html'
901 @echo
902
903list-defconfigs:
ff9d6e30 904 @echo 'Built-in configs:'
b9796199 905 @$(foreach b, $(sort $(notdir $(wildcard $(TOPDIR)/configs/*_defconfig))), \
58fd779a 906 printf " %-35s - Build for %s\\n" $(b) $(b:_defconfig=);)
ff9d6e30
TP
907ifneq ($(wildcard $(BR2_EXTERNAL)/configs/*_defconfig),)
908 @echo
909 @echo 'User-provided configs:'
910 @$(foreach b, $(sort $(notdir $(wildcard $(BR2_EXTERNAL)/configs/*_defconfig))), \
911 printf " %-35s - Build for %s\\n" $(b) $(b:_defconfig=);)
912endif
58fd779a 913 @echo
ba2e7e02 914
c3e49d69 915release: OUT = buildroot-$(BR2_VERSION)
0dca7065 916
134ab1ce
PK
917# Create release tarballs. We need to fiddle a bit to add the generated
918# documentation to the git output
0dca7065 919release:
c6715b69 920 git archive --format=tar --prefix=$(OUT)/ HEAD > $(OUT).tar
462e9915 921 $(MAKE) O=$(OUT) manual-html manual-text manual-pdf
134ab1ce
PK
922 tar rf $(OUT).tar $(OUT)
923 gzip -9 -c < $(OUT).tar > $(OUT).tar.gz
924 bzip2 -9 -c < $(OUT).tar > $(OUT).tar.bz2
925 rm -rf $(OUT) $(OUT).tar
e62d2ecd 926
2b91ab7a
AVEM
927print-version:
928 @echo $(BR2_VERSION_FULL)
929
b7285d00 930include docs/manual/manual.mk
f70d6411 931-include $(BR2_EXTERNAL)/docs/*/*.mk
8792cf9e 932
6652770f 933.PHONY: $(noconfig_targets)
This page took 0.618462 seconds and 4 git commands to generate.