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