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