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