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