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