blob: 1e257e97e272b24d53b8d1b86d68e30a78457a27 [file] [log] [blame]
Eric Andersen2d523c22004-10-09 01:06:03 +00001# Makefile for buildroot2
Eric Andersenffde94b2001-12-22 00:56:11 +00002#
Eric Andersen15b26ae2005-02-07 22:19:26 +00003# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
Peter Korsgaard9fc43592012-03-01 14:04:54 +01004# Copyright (C) 2006-2012 by the Buildroot developers <buildroot@uclibc.org>
Eric Andersenffde94b2001-12-22 00:56:11 +00005#
Eric Andersen08782ae2002-04-26 11:45:55 +00006# This program is free software; you can redistribute it and/or modify
Eric Andersen2d523c22004-10-09 01:06:03 +00007# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2 of the License, or
9# (at your option) any later version.
Eric Andersenffde94b2001-12-22 00:56:11 +000010#
Eric Andersen2d523c22004-10-09 01:06:03 +000011# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
Eric Andersen08782ae2002-04-26 11:45:55 +000013# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Eric Andersen2d523c22004-10-09 01:06:03 +000014# General Public License for more details.
Peter Korsgaardb30d6732009-01-26 19:42:47 +000015#
Eric Andersen2d523c22004-10-09 01:06:03 +000016# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
18# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19#
Eric Andersenffde94b2001-12-22 00:56:11 +000020
Eric Andersen2d523c22004-10-09 01:06:03 +000021#--------------------------------------------------------------
22# Just run 'make menuconfig', configure stuff, then run 'make'.
23# You shouldn't need to mess with anything beyond this point...
24#--------------------------------------------------------------
Yann E. MORIN2d239bb2010-10-31 17:35:09 +010025
Yann E. MORINe5e8fae2010-10-31 17:35:10 +010026# Set and export the version string
Peter Korsgaard47ee3052012-11-17 23:15:45 +010027export BR2_VERSION:=2012.11-rc1
Yann E. MORINe5e8fae2010-10-31 17:35:10 +010028
Thomas De Schampheleire0edfb242012-02-08 17:22:17 +010029# Check for minimal make version (note: this check will break at make 10.x)
30MIN_MAKE_VERSION=3.81
Peter Korsgaard8139e212012-02-09 22:58:05 +010031ifneq ($(firstword $(sort $(MAKE_VERSION) $(MIN_MAKE_VERSION))),$(MIN_MAKE_VERSION))
Thomas De Schampheleire0edfb242012-02-08 17:22:17 +010032$(error You have make '$(MAKE_VERSION)' installed. GNU make >= $(MIN_MAKE_VERSION) is required)
33endif
34
Francois Perrad1d4104f2012-07-18 15:59:09 +020035export HOSTARCH := $(shell uname -m | \
36 sed -e s/i.86/x86/ \
37 -e s/sun4u/sparc64/ \
38 -e s/arm.*/arm/ \
39 -e s/sa110/arm/ \
40 -e s/ppc64/powerpc/ \
41 -e s/ppc/powerpc/ \
42 -e s/macppc/powerpc/\
43 -e s/sh.*/sh/)
44
Yann E. MORIN2d239bb2010-10-31 17:35:09 +010045# This top-level Makefile can *not* be executed in parallel
46.NOTPARALLEL:
47
Peter Korsgaard6b1dd452009-11-30 17:29:01 +010048# absolute path
49TOPDIR:=$(shell pwd)
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +000050CONFIG_CONFIG_IN=Config.in
Thomas Petazzoni56da3852011-08-31 23:35:05 +020051CONFIG=support/kconfig
Ulf Samuelssona8ee1242008-05-11 06:55:04 +000052DATE:=$(shell date +%Y%m%d)
Eric Andersen2d523c22004-10-09 01:06:03 +000053
Yann E. MORIN8258df22010-10-31 17:35:12 +010054# Compute the full local version string so packages can use it as-is
55# Need to export it, so it can be got from environment in children (eg. mconf)
Thomas Petazzonif082c7c2011-08-31 23:35:02 +020056export BR2_VERSION_FULL:=$(BR2_VERSION)$(shell $(TOPDIR)/support/scripts/setlocalversion)
Yann E. MORIN8258df22010-10-31 17:35:12 +010057
Thomas Petazzoni8b6585a2010-08-21 17:21:40 +020058noconfig_targets:=menuconfig nconfig gconfig xconfig config oldconfig randconfig \
Thomas Petazzoni0b368802010-08-22 07:27:09 +020059 defconfig %_defconfig savedefconfig allyesconfig allnoconfig silentoldconfig release \
Peter Korsgaard66527702009-10-04 21:57:12 +020060 randpackageconfig allyespackageconfig allnopackageconfig \
Arnout Vandecappelle (Essensium/Mind)2b91ab72012-03-11 12:16:39 +010061 source-check print-version
Bernhard Reutner-Fischer9e250352006-12-02 19:01:10 +000062
Thomas Petazzoni580c6d92009-07-30 17:26:49 +020063# Strip quotes and then whitespaces
64qstrip=$(strip $(subst ",,$(1)))
65#"))
66
Peter Korsgaardf85f2de2009-01-25 20:19:01 +000067# Variables for use in Make constructs
68comma:=,
69empty:=
70space:=$(empty) $(empty)
71
Will Wagner39ca6d52010-01-11 12:28:50 +000072ifneq ("$(origin O)", "command line")
73O:=output
74CONFIG_DIR:=$(TOPDIR)
Yann E. MORINaefad532010-09-26 10:56:12 +020075NEED_WRAPPER=
Will Wagner39ca6d52010-01-11 12:28:50 +000076else
77# other packages might also support Linux-style out of tree builds
78# with the O=<dir> syntax (E.G. Busybox does). As make automatically
79# forwards command line variable definitions those packages get very
80# confused. Fix this by telling make to not do so
81MAKEOVERRIDES =
82# strangely enough O is still passed to submakes with MAKEOVERRIDES
83# (with make 3.81 atleast), the only thing that changes is the output
84# of the origin function (command line -> environment).
85# Unfortunately some packages don't look at origin (E.G. uClibc 0.9.31+)
86# To really make O go away, we have to override it.
87override O:=$(O)
88CONFIG_DIR:=$(O)
Peter Korsgaardde846f62010-08-29 23:24:07 +020089# we need to pass O= everywhere we call back into the toplevel makefile
90EXTRAMAKEARGS = O=$(O)
Yann E. MORINaefad532010-09-26 10:56:12 +020091NEED_WRAPPER=y
Will Wagner39ca6d52010-01-11 12:28:50 +000092endif
93
Ulf Samuelssona1b06512008-03-28 07:31:28 +000094# Pull in the user's configuration file
95ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
Will Wagner39ca6d52010-01-11 12:28:50 +000096-include $(CONFIG_DIR)/.config
Ulf Samuelsson7521f372007-09-12 04:34:16 +000097endif
Eric Andersen2d523c22004-10-09 01:06:03 +000098
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +000099# To put more focus on warnings, be less verbose as default
100# Use 'make V=1' to see the full commands
101ifdef V
102 ifeq ("$(origin V)", "command line")
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000103 KBUILD_VERBOSE=$(V)
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +0000104 endif
105endif
106ifndef KBUILD_VERBOSE
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000107 KBUILD_VERBOSE=0
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +0000108endif
109
110ifeq ($(KBUILD_VERBOSE),1)
Ulf Samuelsson4df454e2007-07-06 12:19:35 +0000111 quiet=
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000112 Q=
Bernhard Reutner-Fischer1669b6e2007-09-22 14:19:22 +0000113ifndef VERBOSE
114 VERBOSE=1
115endif
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +0000116else
117 quiet=quiet_
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000118 Q=@
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +0000119endif
120
Peter Korsgaard69f85922009-01-01 21:20:35 +0000121# we want bash as shell
122SHELL:=$(shell if [ -x "$$BASH" ]; then echo $$BASH; \
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +0000123 else if [ -x /bin/bash ]; then echo /bin/bash; \
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000124 else echo sh; fi; fi)
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +0000125
Peter Korsgaard69f85922009-01-01 21:20:35 +0000126# kconfig uses CONFIG_SHELL
127CONFIG_SHELL:=$(SHELL)
128
129export SHELL CONFIG_SHELL quiet Q KBUILD_VERBOSE VERBOSE
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +0000130
131ifndef HOSTAR
132HOSTAR:=ar
133endif
134ifndef HOSTAS
135HOSTAS:=as
136endif
137ifndef HOSTCC
138HOSTCC:=gcc
Thomas Petazzoni17b66af2010-12-07 21:09:56 +0100139HOSTCC:=$(shell which $(HOSTCC) || type -p $(HOSTCC) || echo gcc)
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +0000140endif
Mike Frysinger0df02e12011-03-28 03:18:47 -0400141HOSTCC_NOCCACHE:=$(HOSTCC)
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +0000142ifndef HOSTCXX
143HOSTCXX:=g++
Thomas Petazzoni17b66af2010-12-07 21:09:56 +0100144HOSTCXX:=$(shell which $(HOSTCXX) || type -p $(HOSTCXX) || echo g++)
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +0000145endif
Mike Frysinger0df02e12011-03-28 03:18:47 -0400146HOSTCXX_NOCCACHE:=$(HOSTCXX)
Bernhard Reutner-Fischer5f975802007-09-28 20:10:22 +0000147ifndef HOSTFC
148HOSTFC:=gfortran
149endif
Ulf Samuelsson356133b2007-09-28 19:46:58 +0000150ifndef HOSTCPP
151HOSTCPP:=cpp
152endif
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +0000153ifndef HOSTLD
154HOSTLD:=ld
155endif
Ulf Samuelsson0f9c5b12007-07-15 21:54:11 +0000156ifndef HOSTLN
157HOSTLN:=ln
158endif
Ulf Samuelsson356133b2007-09-28 19:46:58 +0000159ifndef HOSTNM
160HOSTNM:=nm
161endif
Peter Korsgaard69f85922009-01-01 21:20:35 +0000162HOSTAR:=$(shell which $(HOSTAR) || type -p $(HOSTAR) || echo ar)
163HOSTAS:=$(shell which $(HOSTAS) || type -p $(HOSTAS) || echo as)
Peter Korsgaard69f85922009-01-01 21:20:35 +0000164HOSTFC:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo || which g77 || type -p g77 || echo gfortran)
165HOSTCPP:=$(shell which $(HOSTCPP) || type -p $(HOSTCPP) || echo cpp)
166HOSTLD:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo ld)
167HOSTLN:=$(shell which $(HOSTLN) || type -p $(HOSTLN) || echo ln)
168HOSTNM:=$(shell which $(HOSTNM) || type -p $(HOSTNM) || echo nm)
Ulf Samuelsson54e93322008-07-06 07:34:41 +0000169
Bernhard Reutner-Fischer5f975802007-09-28 20:10:22 +0000170export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD
Thomas Petazzoni17b66af2010-12-07 21:09:56 +0100171export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +0000172
Arnout Vandecappelle670cb302012-06-30 10:29:22 +0000173# Make sure pkg-config doesn't look outside the buildroot tree
174unexport PKG_CONFIG_PATH
175
Thomas Petazzoni91123a62012-07-02 04:21:14 +0000176# Having DESTDIR set in the environment confuses the installation
177# steps of some packages.
178unexport DESTDIR
179
Will Wagner39ca6d52010-01-11 12:28:50 +0000180# bash prints the name of the directory on 'cd <dir>' if CDPATH is
181# set, so unset it here to not cause problems. Notice that the export
182# line doesn't affect the environment of $(shell ..) calls, so
183# explictly throw away any output from 'cd' here.
184export CDPATH:=
185BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && pwd)
186$(if $(BASE_DIR),, $(error output directory "$(O)" does not exist))
187
188BUILD_DIR:=$(BASE_DIR)/build
189
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +0000190
Bernhard Reutner-Fischercfe511b2007-09-29 13:58:30 +0000191ifeq ($(BR2_HAVE_DOT_CONFIG),y)
Eric Andersenffde94b2001-12-22 00:56:11 +0000192
Peter Korsgaard2c649042007-06-19 15:19:27 +0000193#############################################################
194#
195# Hide troublesome environment variables from sub processes
196#
197#############################################################
198unexport CROSS_COMPILE
199unexport ARCH
Daniel Nyström2bf3c162010-12-26 00:29:42 +0100200unexport CC
201unexport CXX
202unexport CPP
203unexport CFLAGS
204unexport CXXFLAGS
205unexport GREP_OPTIONS
Peter Korsgaard12c9f7d2011-12-12 10:25:50 +0100206unexport CONFIG_SITE
Stephan Hoffmann32314b42012-08-17 13:54:16 +0200207unexport QMAKESPEC
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000208
Thomas Petazzoni102a93b2011-08-31 23:35:06 +0200209GNU_HOST_NAME:=$(shell support/gnuconfig/config.guess)
Thomas Petazzoni60281cb2010-04-10 23:17:25 +0200210
Bernhard Reutner-Fischer6ad07202007-07-31 15:02:06 +0000211##############################################################
Eric Andersen08782ae2002-04-26 11:45:55 +0000212#
Eric Andersen2d523c22004-10-09 01:06:03 +0000213# The list of stuff to build for the target toolchain
214# along with the packages to build for the target.
Eric Andersen08782ae2002-04-26 11:45:55 +0000215#
Eric Andersen2d523c22004-10-09 01:06:03 +0000216##############################################################
Thomas Petazzoni17b66af2010-12-07 21:09:56 +0100217
218ifeq ($(BR2_CCACHE),y)
219BASE_TARGETS += host-ccache
220endif
221
Thomas Petazzonibc994c52009-12-14 12:10:12 +0100222ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
Gustavo Zacarias009407e2010-12-31 08:39:01 -0300223BASE_TARGETS += uclibc-configured host-binutils cross_compiler uclibc-target-utils kernel-headers
Yann E. MORIN10c1eec2010-09-19 21:54:09 +0200224else
Thomas Petazzoni17b66af2010-12-07 21:09:56 +0100225BASE_TARGETS += uclibc
"Steven J. Hill"02f71aa2007-02-06 18:19:38 +0000226endif
Bernhard Reutner-Fischeracc706b2007-07-23 11:29:38 +0000227TARGETS:=
228
Peter Korsgaard89464a92009-09-30 17:39:44 +0200229# silent mode requested?
230QUIET:=$(if $(findstring s,$(MAKEFLAGS)),-q)
231
Thomas Petazzoni397fe5c2009-09-05 15:49:30 +0200232# Strip off the annoying quoting
233ARCH:=$(call qstrip,$(BR2_ARCH))
Thomas Petazzoni65e80a02010-04-28 23:40:57 +0200234
Peter Korsgaard891973f2010-10-17 23:32:37 +0200235KERNEL_ARCH:=$(shell echo "$(ARCH)" | sed -e "s/-.*//" \
236 -e s/i.86/i386/ -e s/sun4u/sparc64/ \
237 -e s/arm.*/arm/ -e s/sa110/arm/ \
Thomas Petazzonib90a1032012-10-28 17:40:35 +0100238 -e s/aarch64/arm64/ \
Mike Frysinger871db072011-02-07 00:49:11 -0500239 -e s/bfin/blackfin/ \
Peter Korsgaard891973f2010-10-17 23:32:37 +0200240 -e s/parisc64/parisc/ \
241 -e s/powerpc64/powerpc/ \
242 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
243 -e s/sh.*/sh/)
244
Thomas Petazzoni397fe5c2009-09-05 15:49:30 +0200245ZCAT:=$(call qstrip,$(BR2_ZCAT))
246BZCAT:=$(call qstrip,$(BR2_BZCAT))
Allan W. Nielsen177b4b42011-05-10 08:17:05 +0200247XZCAT:=$(call qstrip,$(BR2_XZCAT))
Thomas Petazzoni397fe5c2009-09-05 15:49:30 +0200248TAR_OPTIONS=$(call qstrip,$(BR2_TAR_OPTIONS)) -xf
Bernhard Reutner-Fischer1dbe6e32007-08-21 17:56:47 +0000249
Gustavo Zacariasa2b4f7f2011-02-02 10:05:56 -0300250# packages compiled for the host go here
251HOST_DIR:=$(call qstrip,$(BR2_HOST_DIR))
Thomas Petazzoni397fe5c2009-09-05 15:49:30 +0200252
Thomas Petazzoniaebf1992012-05-08 04:39:22 +0000253# locales to generate
254GENERATE_LOCALE=$(call qstrip,$(BR2_GENERATE_LOCALE))
255
Thomas Petazzoni397fe5c2009-09-05 15:49:30 +0200256# stamp (dependency) files go here
Thomas Petazzoni3b2a8032009-07-31 10:31:39 +0200257STAMP_DIR:=$(BASE_DIR)/stamps
Thomas Petazzoni397fe5c2009-09-05 15:49:30 +0200258
Thomas Petazzoni3b2a8032009-07-31 10:31:39 +0200259BINARIES_DIR:=$(BASE_DIR)/images
260TARGET_DIR:=$(BASE_DIR)/target
Thomas Petazzoni4c5bf462010-04-28 23:40:52 +0200261TOOLCHAIN_DIR=$(BASE_DIR)/toolchain
Thomas Petazzoni6c3e3ad2012-11-03 08:27:58 +0000262TARGET_SKELETON=$(TOPDIR)/system/skeleton
Thomas Petazzoni397fe5c2009-09-05 15:49:30 +0200263
Luca Ceresoli7e76f902012-05-17 19:33:00 +0200264LEGAL_INFO_DIR=$(BASE_DIR)/legal-info
265REDIST_SOURCES_DIR=$(LEGAL_INFO_DIR)/sources
266LICENSE_FILES_DIR=$(LEGAL_INFO_DIR)/licenses
267LEGAL_MANIFEST_CSV=$(LEGAL_INFO_DIR)/manifest.csv
268LEGAL_LICENSES_TXT=$(LEGAL_INFO_DIR)/licenses.txt
269LEGAL_WARNINGS=$(LEGAL_INFO_DIR)/.warnings
270LEGAL_REPORT=$(LEGAL_INFO_DIR)/README
271
Thomas Petazzoni9226a992012-11-17 03:52:14 +0000272# Location of a file giving a big fat warning that output/target
273# should not be used as the root filesystem.
274TARGET_DIR_WARNING_FILE=$(TARGET_DIR)/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
275
Thomas Petazzoni17b66af2010-12-07 21:09:56 +0100276ifeq ($(BR2_CCACHE),y)
277CCACHE:=$(HOST_DIR)/usr/bin/ccache
Thomas De Schampheleire43329072012-05-16 21:39:28 +0200278BUILDROOT_CACHE_DIR = $(call qstrip,$(BR2_CCACHE_DIR))
279export BUILDROOT_CACHE_DIR
Thomas Petazzoni17b66af2010-12-07 21:09:56 +0100280HOSTCC := $(CCACHE) $(HOSTCC)
281HOSTCXX := $(CCACHE) $(HOSTCXX)
282endif
283
Eric Andersen08782ae2002-04-26 11:45:55 +0000284#############################################################
285#
Eric Andersenef407d32004-01-29 23:21:00 +0000286# You should probably leave this stuff alone unless you know
Eric Andersen08782ae2002-04-26 11:45:55 +0000287# what you are doing.
288#
289#############################################################
Manuel Novoa III d632d422003-11-01 05:34:41 +0000290
Bernhard Reutner-Fischer6547bce2007-08-22 12:35:41 +0000291all: world
Eric Andersenffde94b2001-12-22 00:56:11 +0000292
Arnout Vandecappelle (Essensium/Mind)ebcfa982012-11-12 10:08:28 +0000293# Include legacy before the other things, because package .mk files
294# may rely on it.
295ifneq ($(BR2_DEPRECATED),y)
296include Makefile.legacy
297endif
298
Thomas Petazzoni486253d2012-04-17 16:45:23 +0200299include package/Makefile.in
Thomas De Schampheleirea7926682012-02-08 17:22:16 +0100300include support/dependencies/dependencies.mk
301
Eric Andersend06645d2005-02-10 03:06:39 +0000302# We also need the various per-package makefiles, which also add
303# each selected package to TARGETS if that package was selected
304# in the .config file.
Thomas Petazzonibc994c52009-12-14 12:10:12 +0100305ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
Yann E. MORINed020092010-07-28 00:08:15 +0200306include toolchain/toolchain-buildroot.mk
Yann E. MORIN26b44b22010-03-26 20:46:37 +0100307else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
Yann E. MORINed020092010-07-28 00:08:15 +0200308include toolchain/toolchain-external.mk
Yann E. MORIN10c1eec2010-09-19 21:54:09 +0200309else ifeq ($(BR2_TOOLCHAIN_CTNG),y)
310include toolchain/toolchain-crosstool-ng.mk
Bernhard Reutner-Fischeracc706b2007-07-23 11:29:38 +0000311endif
312
Thomas Petazzoniee0246e2011-09-29 21:57:38 +0200313# Include the package override file if one has been provided in the
314# configuration.
315PACKAGE_OVERRIDE_FILE=$(call qstrip,$(BR2_PACKAGE_OVERRIDE_FILE))
316ifneq ($(PACKAGE_OVERRIDE_FILE),)
317-include $(PACKAGE_OVERRIDE_FILE)
318endif
319
Eric Andersend06645d2005-02-10 03:06:39 +0000320include package/*/*.mk
Eric Andersend06645d2005-02-10 03:06:39 +0000321
Peter Korsgaard64d8e9a2010-11-07 19:33:11 +0100322include boot/common.mk
Peter Korsgaard64d8e9a2010-11-07 19:33:11 +0100323include linux/linux.mk
324
Peter Korsgaard32faf352009-04-07 21:04:31 +0000325TARGETS+=target-finalize
John Voltzd45de0c2008-03-11 13:12:39 +0000326
Peter Korsgaardb87b4742009-04-06 09:21:26 +0000327ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
328TARGETS+=target-purgelocales
329endif
330
Thomas Petazzoniaebf1992012-05-08 04:39:22 +0000331ifneq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC)$(BR2_TOOLCHAIN_CTNG_eglibc)$(BR2_TOOLCHAIN_CTNG_glibc),)
332ifneq ($(GENERATE_LOCALE),)
333TARGETS+=target-generatelocales
334endif
335endif
336
Thomas Petazzoni6c3e3ad2012-11-03 08:27:58 +0000337include system/system.mk
Thomas Petazzoni649b5b92010-03-14 18:20:45 +0100338include fs/common.mk
Eric Andersen79f5f1e2005-02-17 03:00:29 +0000339
Eric Andersen08782ae2002-04-26 11:45:55 +0000340TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
Bernhard Reutner-Fischer3b08e642007-09-18 13:12:25 +0000341TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS) $(BASE_TARGETS))
Eric Andersen08782ae2002-04-26 11:45:55 +0000342TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
Bernhard Reutner-Fischerb3efde22007-09-01 17:10:55 +0000343TARGETS_ALL:=$(patsubst %,__real_tgt_%,$(TARGETS))
Peter Korsgaard22c2c6b2010-11-19 14:20:56 +0100344
345# host-* dependencies have to be handled specially, as those aren't
346# visible in Kconfig and hence not added to a variable like TARGETS.
347# instead, find all the host-* targets listed in each <PKG>_DEPENDENCIES
348# variable for each enabled target.
349# Notice: this only works for newstyle gentargets/autotargets packages
350TARGETS_HOST_DEPS = $(sort $(filter host-%,$(foreach dep,\
351 $(addsuffix _DEPENDENCIES,$(call UPPERCASE,$(TARGETS))),\
352 $($(dep)))))
353# Host packages can in turn have their own dependencies. Likewise find
354# all the package names listed in the HOST_<PKG>_DEPENDENCIES for each
355# host package found above. Ideally this should be done recursively until
356# no more packages are found, but that's hard to do in make, so limit to
357# 1 level for now.
358HOST_DEPS = $(sort $(foreach dep,\
359 $(addsuffix _DEPENDENCIES,$(call UPPERCASE,$(TARGETS_HOST_DEPS))),\
360 $($(dep))))
361HOST_SOURCE += $(addsuffix -source,$(sort $(TARGETS_HOST_DEPS) $(HOST_DEPS)))
362
Luca Ceresoli7e76f902012-05-17 19:33:00 +0200363TARGETS_LEGAL_INFO:=$(patsubst %,%-legal-info,\
364 $(TARGETS) $(BASE_TARGETS) $(TARGETS_HOST_DEPS) $(HOST_DEPS))))
365
Bernhard Reutner-Fischeracc706b2007-07-23 11:29:38 +0000366# all targets depend on the crosscompiler and it's prerequisites
Bernhard Reutner-Fischerb3efde22007-09-01 17:10:55 +0000367$(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) %
Bernhard Reutner-Fischeracc706b2007-07-23 11:29:38 +0000368
Peter Korsgaarda77ee7f2012-09-10 12:38:29 +0200369dirs: $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
Peter Korsgaardd0880f72012-01-15 20:59:37 +0100370 $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR)
Ulf Samuelssonf958d892007-08-14 07:45:01 +0000371
Peter Korsgaarded7791e2012-02-25 23:18:03 +0100372$(BASE_TARGETS): dirs $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake
Ulf Samuelssonf958d892007-08-14 07:45:01 +0000373
Thomas Petazzoni0b368802010-08-22 07:27:09 +0200374$(BUILD_DIR)/buildroot-config/auto.conf: $(CONFIG_DIR)/.config
Thomas Petazzonic7298292011-04-02 18:44:36 +0200375 $(MAKE) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig
Thomas Petazzoni0b368802010-08-22 07:27:09 +0200376
377prepare: $(BUILD_DIR)/buildroot-config/auto.conf
378
Thomas De Schampheleireee7f92e2012-02-08 17:22:19 +0100379world: prepare dirs dependencies $(BASE_TARGETS) $(TARGETS_ALL)
Eric Andersenffde94b2001-12-22 00:56:11 +0000380
Yann E. MORINaefad532010-09-26 10:56:12 +0200381.PHONY: all world dirs clean distclean source outputmakefile \
Luca Ceresoli7e76f902012-05-17 19:33:00 +0200382 legal-info legal-info-prepare legal-info-clean \
Bernhard Reutner-Fischerb3efde22007-09-01 17:10:55 +0000383 $(BASE_TARGETS) $(TARGETS) $(TARGETS_ALL) \
Luca Ceresoli7e76f902012-05-17 19:33:00 +0200384 $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) $(TARGETS_LEGAL_INFO) \
Peter Korsgaarda77ee7f2012-09-10 12:38:29 +0200385 $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
Peter Korsgaardd0880f72012-01-15 20:59:37 +0100386 $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR)
Jon Nelsonc79e9982002-01-05 20:26:15 +0000387
Eric Andersen08782ae2002-04-26 11:45:55 +0000388#############################################################
389#
Eric Andersenef407d32004-01-29 23:21:00 +0000390# staging and target directories do NOT list these as
Mike Frysingerd99c31c2006-05-26 01:18:09 +0000391# dependencies anywhere else
Eric Andersen08782ae2002-04-26 11:45:55 +0000392#
393#############################################################
Peter Korsgaarda77ee7f2012-09-10 12:38:29 +0200394$(TOOLCHAIN_DIR) $(BUILD_DIR) $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR) $(LEGAL_INFO_DIR) $(REDIST_SOURCES_DIR):
Bernhard Reutner-Fischer8d583fc2007-01-30 00:58:18 +0000395 @mkdir -p $@
Manuel Novoa III 3ad3d8a2004-09-03 00:49:43 +0000396
Eric Andersen08782ae2002-04-26 11:45:55 +0000397$(STAGING_DIR):
"Steven J. Hill"9c865d72007-05-07 03:56:47 +0000398 @mkdir -p $(STAGING_DIR)/bin
Eric Andersenbf387232004-12-11 10:35:18 +0000399 @mkdir -p $(STAGING_DIR)/lib
Bernhard Reutner-Fischer80277842007-06-20 11:26:36 +0000400 @mkdir -p $(STAGING_DIR)/usr/lib
Bernhard Reutner-Fischer80277842007-06-20 11:26:36 +0000401 @mkdir -p $(STAGING_DIR)/usr/include
Thomas Petazzonia05c3372010-02-09 22:44:15 +0100402 @mkdir -p $(STAGING_DIR)/usr/bin
Gustavo Zacarias5ad139e2010-12-31 08:39:05 -0300403 @ln -snf $(STAGING_DIR) $(BASE_DIR)/staging
Eric Andersen08782ae2002-04-26 11:45:55 +0000404
Dmytro Milinevskyy2b3a43f2010-06-16 23:25:56 +0300405ifeq ($(BR2_ROOTFS_SKELETON_CUSTOM),y)
406TARGET_SKELETON=$(BR2_ROOTFS_SKELETON_CUSTOM_PATH)
407endif
408
Thomas Petazzoni397fe5c2009-09-05 15:49:30 +0200409$(BUILD_DIR)/.root:
Bernhard Reutner-Fischer7547c7e2007-08-21 10:53:39 +0000410 mkdir -p $(TARGET_DIR)
Bernhard Reutner-Fischerf0ca4b82007-08-21 10:56:38 +0000411 if ! [ -d "$(TARGET_DIR)/bin" ]; then \
412 if [ -d "$(TARGET_SKELETON)" ]; then \
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000413 cp -fa $(TARGET_SKELETON)/* $(TARGET_DIR)/; \
Ulf Samuelsson74cda1e2007-08-14 07:24:45 +0000414 fi; \
Bernhard Reutner-Fischerf0ca4b82007-08-21 10:56:38 +0000415 fi
Thomas Petazzoni9226a992012-11-17 03:52:14 +0000416 cp support/misc/target-dir-warning.txt $(TARGET_DIR_WARNING_FILE)
Will Newtonfc3eb182009-08-10 10:04:14 +0100417 -find $(TARGET_DIR) -type d -name CVS -print0 -o -name .svn -print0 | xargs -0 rm -rf
Anders Daranderb9656e82009-12-23 10:05:45 +0100418 -find $(TARGET_DIR) -type f \( -name .empty -o -name '*~' \) -print0 | xargs -0 rm -rf
Bernhard Reutner-Fischer7547c7e2007-08-21 10:53:39 +0000419 touch $@
Eric Andersenffde94b2001-12-22 00:56:11 +0000420
Thomas Petazzoni397fe5c2009-09-05 15:49:30 +0200421$(TARGET_DIR): $(BUILD_DIR)/.root
Ulf Samuelssonc6771df2007-08-16 05:44:55 +0000422
Thomas De Schampheleire2a970452012-06-21 19:34:50 +0000423STRIP_FIND_CMD = find $(TARGET_DIR)
424ifneq (,$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS)))
425STRIP_FIND_CMD += \( $(call finddirclauses,$(TARGET_DIR),$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS))) \) -prune -o
426endif
427STRIP_FIND_CMD += -type f -perm +111
428STRIP_FIND_CMD += -not \( $(call findfileclauses,libthread_db*.so* $(call qstrip,$(BR2_STRIP_EXCLUDE_FILES))) \) -print
429
Peter Korsgaard32faf352009-04-07 21:04:31 +0000430target-finalize:
John Voltzd45de0c2008-03-11 13:12:39 +0000431ifeq ($(BR2_HAVE_DEVFILES),y)
Thomas Petazzonif082c7c2011-08-31 23:35:02 +0200432 ( support/scripts/copy.sh $(STAGING_DIR) $(TARGET_DIR) )
John Voltzbc67ca22008-03-10 15:22:43 +0000433else
Valentine Barshak94d3aa12012-10-02 08:52:15 +0000434 rm -rf $(TARGET_DIR)/usr/include $(TARGET_DIR)/usr/share/aclocal \
435 $(TARGET_DIR)/usr/lib/pkgconfig $(TARGET_DIR)/usr/share/pkgconfig
Wade Berrier027aa1d2009-04-28 17:33:44 +0000436 find $(TARGET_DIR)/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
437 find $(TARGET_DIR)/usr/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
John Voltzbc67ca22008-03-10 15:22:43 +0000438endif
Malte Starostike48a72e2010-07-24 21:29:56 +0200439ifneq ($(BR2_PACKAGE_GDB),y)
440 rm -rf $(TARGET_DIR)/usr/share/gdb
441endif
Thomas Petazzoni87b06372010-04-10 22:42:45 +0200442ifneq ($(BR2_HAVE_DOCUMENTATION),y)
Peter Korsgaard32faf352009-04-07 21:04:31 +0000443 rm -rf $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/man
Peter Korsgaard32faf352009-04-07 21:04:31 +0000444 rm -rf $(TARGET_DIR)/usr/info $(TARGET_DIR)/usr/share/info
Thomas Petazzoni87b06372010-04-10 22:42:45 +0200445 rm -rf $(TARGET_DIR)/usr/doc $(TARGET_DIR)/usr/share/doc
Paulius Zaleckasd701a822010-05-05 13:09:36 +0300446 rm -rf $(TARGET_DIR)/usr/share/gtk-doc
Mike Frysinger68ad6d42010-11-18 16:25:58 -0500447 -rmdir $(TARGET_DIR)/usr/share 2>/dev/null
Peter Korsgaard32faf352009-04-07 21:04:31 +0000448endif
Thomas Petazzonib0c86bc2011-01-11 21:44:29 +0100449ifeq ($(BR2_PACKAGE_PYTHON_PY_ONLY),y)
450 find $(TARGET_DIR)/usr/lib/ -name '*.pyc' -print0 | xargs -0 rm -f
451endif
452ifeq ($(BR2_PACKAGE_PYTHON_PYC_ONLY),y)
453 find $(TARGET_DIR)/usr/lib/ -name '*.py' -print0 | xargs -0 rm -f
454endif
Thomas De Schampheleire2a970452012-06-21 19:34:50 +0000455 $(STRIP_FIND_CMD) | xargs $(STRIPCMD) 2>/dev/null || true
Mike Frysinger8101c9a2010-11-17 18:55:43 -0500456 find $(TARGET_DIR)/lib/modules -type f -name '*.ko' | \
Gustavo Zacarias0dc940c2010-11-30 12:19:59 -0300457 xargs -r $(KSTRIPCMD) || true
Mike Frysinger8101c9a2010-11-17 18:55:43 -0500458
Thomas Petazzoni4ccde7f2010-08-30 22:52:18 +0200459 mkdir -p $(TARGET_DIR)/etc
460 # Mandatory configuration file and auxilliary cache directory
461 # for recent versions of ldconfig
462 touch $(TARGET_DIR)/etc/ld.so.conf
463 mkdir -p $(TARGET_DIR)/var/cache/ldconfig
Peter Korsgaarde49e2fe2010-07-26 23:53:37 +0200464 if [ -x "$(TARGET_CROSS)ldconfig" ]; \
465 then \
Thomas Petazzoni4ccde7f2010-08-30 22:52:18 +0200466 $(TARGET_CROSS)ldconfig -r $(TARGET_DIR); \
Peter Korsgaarde49e2fe2010-07-26 23:53:37 +0200467 else \
Thomas Petazzoni4ccde7f2010-08-30 22:52:18 +0200468 /sbin/ldconfig -r $(TARGET_DIR); \
Peter Korsgaarde49e2fe2010-07-26 23:53:37 +0200469 fi
Peter Korsgaard451a8872012-02-14 12:58:25 +0100470 ( \
471 echo "NAME=Buildroot"; \
472 echo "VERSION=$(BR2_VERSION_FULL)"; \
473 echo "ID=buildroot"; \
474 echo "VERSION_ID=$(BR2_VERSION)"; \
475 echo "PRETTY_NAME=\"Buildroot $(BR2_VERSION)\"" \
476 ) > $(TARGET_DIR)/etc/os-release
Peter Korsgaard912ea812009-09-30 17:40:24 +0200477
Daniel Mackeed7d872009-07-08 22:46:58 +0200478ifneq ($(BR2_ROOTFS_POST_BUILD_SCRIPT),"")
Philippe Reynesdbf49782012-11-17 13:01:22 +0100479 @$(call MESSAGE,"Executing post-build script\(s\)")
480 @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_BUILD_SCRIPT)), \
481 $(s) $(TARGET_DIR)$(sep))
Daniel Mackeed7d872009-07-08 22:46:58 +0200482endif
483
Peter Korsgaardb87b4742009-04-06 09:21:26 +0000484ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
Thomas Petazzoni397fe5c2009-09-05 15:49:30 +0200485LOCALE_WHITELIST=$(BUILD_DIR)/locales.nopurge
Thomas Petazzoni6cdf2482009-07-30 17:28:20 +0200486LOCALE_NOPURGE=$(call qstrip,$(BR2_ENABLE_LOCALE_WHITELIST))
Peter Korsgaardb87b4742009-04-06 09:21:26 +0000487
488target-purgelocales:
489 rm -f $(LOCALE_WHITELIST)
490 for i in $(LOCALE_NOPURGE); do echo $$i >> $(LOCALE_WHITELIST); done
491
492 for dir in $(wildcard $(addprefix $(TARGET_DIR),/usr/share/locale /usr/share/X11/locale /usr/man /usr/share/man)); \
493 do \
494 for lang in $$(cd $$dir; ls .|grep -v man); \
495 do \
496 grep -qx $$lang $(LOCALE_WHITELIST) || rm -rf $$dir/$$lang; \
497 done; \
498 done
499endif
500
Thomas Petazzoniaebf1992012-05-08 04:39:22 +0000501ifneq ($(GENERATE_LOCALE),)
502# Generate locale data. Basically, we call the localedef program
503# (built by the host-localedef package) for each locale. The input
504# data comes preferably from the toolchain, or if the toolchain does
505# not have them (Linaro toolchains), we use the ones available on the
506# host machine.
507target-generatelocales: host-localedef
508 $(Q)mkdir -p $(TARGET_DIR)/usr/lib/locale/
509 $(Q)for locale in $(GENERATE_LOCALE) ; do \
510 inputfile=`echo $${locale} | cut -f1 -d'.'` ; \
511 charmap=`echo $${locale} | cut -f2 -d'.'` ; \
512 if test -z "$${charmap}" ; then \
513 charmap="UTF-8" ; \
514 fi ; \
515 echo "Generating locale $${inputfile}.$${charmap}" ; \
516 I18NPATH=$(STAGING_DIR)/usr/share/i18n:/usr/share/i18n \
517 $(HOST_DIR)/usr/bin/localedef \
518 --prefix=$(TARGET_DIR) \
519 --`echo $(BR2_ENDIAN) | tr [A-Z] [a-z]`-endian \
520 -i $${inputfile} -f $${charmap} \
521 $${locale} ; \
522 done
523endif
524
Thomas De Schampheleire4eb982c2011-07-27 11:34:51 +0200525source: dirs $(TARGETS_SOURCE) $(HOST_SOURCE)
Eric Andersenffde94b2001-12-22 00:56:11 +0000526
Peter Korsgaard155971e2008-03-04 12:19:16 +0000527external-deps:
Peter Korsgaard22c2c6b2010-11-19 14:20:56 +0100528 @$(MAKE) -Bs DL_MODE=SHOW_EXTERNAL_DEPS $(EXTRAMAKEARGS) source | sort -u
Peter Korsgaard155971e2008-03-04 12:19:16 +0000529
Luca Ceresoli7e76f902012-05-17 19:33:00 +0200530legal-info-clean:
531 @rm -fr $(LEGAL_INFO_DIR)
532
533legal-info-prepare: $(LEGAL_INFO_DIR)
534 @$(call MESSAGE,"Collecting legal info")
535 @$(call legal-license-file,buildroot,COPYING,COPYING)
536 @$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE)
537 @$(call legal-manifest,buildroot,$(BR2_VERSION_FULL),GPLv2+,COPYING,not saved)
538 @$(call legal-warning,the Buildroot source code has not been saved)
539 @$(call legal-warning,the toolchain has not been saved)
540 @cp $(CONFIG_DIR)/.config $(LEGAL_INFO_DIR)/buildroot.config
541
542legal-info: dirs legal-info-clean legal-info-prepare $(REDIST_SOURCES_DIR) \
543 $(TARGETS_LEGAL_INFO)
544 @cat support/legal-info/README.header >>$(LEGAL_REPORT)
545 @if [ -r $(LEGAL_WARNINGS) ]; then \
546 cat support/legal-info/README.warnings-header \
547 $(LEGAL_WARNINGS) >>$(LEGAL_REPORT); \
548 cat $(LEGAL_WARNINGS); fi
549 @echo "Legal info produced in $(LEGAL_INFO_DIR)"
550 @rm -f $(LEGAL_WARNINGS)
551
Thomas Petazzonib7d6c8a2010-05-13 19:20:33 +0200552show-targets:
553 @echo $(TARGETS)
554
Bernhard Reutner-Fischercfe511b2007-09-29 13:58:30 +0000555else # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
Eric Andersen2d523c22004-10-09 01:06:03 +0000556
557all: menuconfig
558
559# configuration
560# ---------------------------------------------------------------------------
561
Bernhard Reutner-Fischerc0d7d4e2007-07-09 18:23:20 +0000562HOSTCFLAGS=$(CFLAGS_FOR_BUILD)
563export HOSTCFLAGS
564
Peter Korsgaard2cc210c2010-06-20 23:05:32 +0200565$(BUILD_DIR)/buildroot-config/%onf:
566 mkdir -p $(@D)/lxdialog
Thomas Petazzoni17b66af2010-12-07 21:09:56 +0100567 $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)
Alper Yildirimb0df9df2009-07-20 19:17:10 +0200568
Thomas Petazzoni1039eb72010-08-21 18:29:27 +0200569COMMON_CONFIG_ENV = \
570 KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
571 KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
Thomas Petazzoni0b368802010-08-22 07:27:09 +0200572 KCONFIG_TRISTATE=$(BUILD_DIR)/buildroot-config/tristate.config \
Thomas Petazzoni1039eb72010-08-21 18:29:27 +0200573 BUILDROOT_CONFIG=$(CONFIG_DIR)/.config
Alper Yildirimb0df9df2009-07-20 19:17:10 +0200574
Yann E. MORINaefad532010-09-26 10:56:12 +0200575xconfig: $(BUILD_DIR)/buildroot-config/qconf outputmakefile
Will Wagner39ca6d52010-01-11 12:28:50 +0000576 @mkdir -p $(BUILD_DIR)/buildroot-config
Peter Korsgaard610255e2010-11-24 15:30:54 +0100577 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
Alper Yildirimb0df9df2009-07-20 19:17:10 +0200578
Yann E. MORINaefad532010-09-26 10:56:12 +0200579gconfig: $(BUILD_DIR)/buildroot-config/gconf outputmakefile
Will Wagner39ca6d52010-01-11 12:28:50 +0000580 @mkdir -p $(BUILD_DIR)/buildroot-config
Peter Korsgaard610255e2010-11-24 15:30:54 +0100581 @$(COMMON_CONFIG_ENV) srctree=$(TOPDIR) $< $(CONFIG_CONFIG_IN)
Peter Korsgaard2b42aae2010-06-05 21:09:05 +0200582
Yann E. MORINaefad532010-09-26 10:56:12 +0200583menuconfig: $(BUILD_DIR)/buildroot-config/mconf outputmakefile
Will Wagner39ca6d52010-01-11 12:28:50 +0000584 @mkdir -p $(BUILD_DIR)/buildroot-config
Peter Korsgaard610255e2010-11-24 15:30:54 +0100585 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
Eric Andersen2d523c22004-10-09 01:06:03 +0000586
Yann E. MORINaefad532010-09-26 10:56:12 +0200587nconfig: $(BUILD_DIR)/buildroot-config/nconf outputmakefile
Thomas Petazzoni8b6585a2010-08-21 17:21:40 +0200588 @mkdir -p $(BUILD_DIR)/buildroot-config
Peter Korsgaard610255e2010-11-24 15:30:54 +0100589 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
Eric Andersen2d523c22004-10-09 01:06:03 +0000590
Yann E. MORINaefad532010-09-26 10:56:12 +0200591config: $(BUILD_DIR)/buildroot-config/conf outputmakefile
Will Wagner39ca6d52010-01-11 12:28:50 +0000592 @mkdir -p $(BUILD_DIR)/buildroot-config
Thomas Petazzoni1039eb72010-08-21 18:29:27 +0200593 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
Eric Andersen2d523c22004-10-09 01:06:03 +0000594
Yann E. MORINaefad532010-09-26 10:56:12 +0200595oldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
Will Wagner39ca6d52010-01-11 12:28:50 +0000596 mkdir -p $(BUILD_DIR)/buildroot-config
Thomas Petazzoni1039eb72010-08-21 18:29:27 +0200597 @$(COMMON_CONFIG_ENV) $< --oldconfig $(CONFIG_CONFIG_IN)
Eric Andersen2d523c22004-10-09 01:06:03 +0000598
Yann E. MORINaefad532010-09-26 10:56:12 +0200599randconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
Will Wagner39ca6d52010-01-11 12:28:50 +0000600 @mkdir -p $(BUILD_DIR)/buildroot-config
Thomas Petazzoni1039eb72010-08-21 18:29:27 +0200601 @$(COMMON_CONFIG_ENV) $< --randconfig $(CONFIG_CONFIG_IN)
Eric Andersen2d523c22004-10-09 01:06:03 +0000602
Yann E. MORINaefad532010-09-26 10:56:12 +0200603allyesconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
Will Wagner39ca6d52010-01-11 12:28:50 +0000604 @mkdir -p $(BUILD_DIR)/buildroot-config
Thomas Petazzoni1039eb72010-08-21 18:29:27 +0200605 @$(COMMON_CONFIG_ENV) $< --allyesconfig $(CONFIG_CONFIG_IN)
Eric Andersen2d523c22004-10-09 01:06:03 +0000606
Yann E. MORINaefad532010-09-26 10:56:12 +0200607allnoconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
Will Wagner39ca6d52010-01-11 12:28:50 +0000608 @mkdir -p $(BUILD_DIR)/buildroot-config
Thomas Petazzoni1039eb72010-08-21 18:29:27 +0200609 @$(COMMON_CONFIG_ENV) $< --allnoconfig $(CONFIG_CONFIG_IN)
Eric Andersen2d523c22004-10-09 01:06:03 +0000610
Yann E. MORINaefad532010-09-26 10:56:12 +0200611randpackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
Will Wagner39ca6d52010-01-11 12:28:50 +0000612 @mkdir -p $(BUILD_DIR)/buildroot-config
613 @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg
Thomas Petazzoni1039eb72010-08-21 18:29:27 +0200614 @$(COMMON_CONFIG_ENV) \
Will Wagner39ca6d52010-01-11 12:28:50 +0000615 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
Thomas Petazzoni1039eb72010-08-21 18:29:27 +0200616 $< --randconfig $(CONFIG_CONFIG_IN)
Will Wagner39ca6d52010-01-11 12:28:50 +0000617 @rm -f $(CONFIG_DIR)/.config.nopkg
Peter Korsgaard66527702009-10-04 21:57:12 +0200618
Yann E. MORINaefad532010-09-26 10:56:12 +0200619allyespackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
Will Wagner39ca6d52010-01-11 12:28:50 +0000620 @mkdir -p $(BUILD_DIR)/buildroot-config
621 @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg
Thomas Petazzoni1039eb72010-08-21 18:29:27 +0200622 @$(COMMON_CONFIG_ENV) \
Will Wagner39ca6d52010-01-11 12:28:50 +0000623 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
Thomas Petazzoni1039eb72010-08-21 18:29:27 +0200624 $< --allyesconfig $(CONFIG_CONFIG_IN)
Will Wagner39ca6d52010-01-11 12:28:50 +0000625 @rm -f $(CONFIG_DIR)/.config.nopkg
Peter Korsgaard66527702009-10-04 21:57:12 +0200626
Yann E. MORINaefad532010-09-26 10:56:12 +0200627allnopackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
Will Wagner39ca6d52010-01-11 12:28:50 +0000628 @mkdir -p $(BUILD_DIR)/buildroot-config
629 @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg
Thomas Petazzoni1039eb72010-08-21 18:29:27 +0200630 @$(COMMON_CONFIG_ENV) \
Will Wagner39ca6d52010-01-11 12:28:50 +0000631 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
Thomas Petazzoni1039eb72010-08-21 18:29:27 +0200632 $< --allnoconfig $(CONFIG_CONFIG_IN)
Will Wagner39ca6d52010-01-11 12:28:50 +0000633 @rm -f $(CONFIG_DIR)/.config.nopkg
Peter Korsgaard66527702009-10-04 21:57:12 +0200634
Yann E. MORINaefad532010-09-26 10:56:12 +0200635silentoldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
Thomas Petazzoni0b368802010-08-22 07:27:09 +0200636 @mkdir -p $(BUILD_DIR)/buildroot-config
637 $(COMMON_CONFIG_ENV) $< --silentoldconfig $(CONFIG_CONFIG_IN)
638
Yann E. MORINaefad532010-09-26 10:56:12 +0200639defconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
Will Wagner39ca6d52010-01-11 12:28:50 +0000640 @mkdir -p $(BUILD_DIR)/buildroot-config
Arnout Vandecappelle33f454b2012-04-28 07:14:50 +0000641 @$(COMMON_CONFIG_ENV) $< --defconfig$(if $(BR2_DEFCONFIG),=$(BR2_DEFCONFIG)) $(CONFIG_CONFIG_IN)
Eric Andersen2d523c22004-10-09 01:06:03 +0000642
Yann E. MORINaefad532010-09-26 10:56:12 +0200643%_defconfig: $(BUILD_DIR)/buildroot-config/conf $(TOPDIR)/configs/%_defconfig outputmakefile
Thomas Petazzoni6f381192010-08-11 20:01:23 +0200644 @mkdir -p $(BUILD_DIR)/buildroot-config
Thomas Petazzoni1039eb72010-08-21 18:29:27 +0200645 @$(COMMON_CONFIG_ENV) $< --defconfig=$(TOPDIR)/configs/$@ $(CONFIG_CONFIG_IN)
Thomas Petazzoni6f381192010-08-11 20:01:23 +0200646
Yann E. MORINaefad532010-09-26 10:56:12 +0200647savedefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
Thomas Petazzonie1b1a182010-08-21 18:50:44 +0200648 @mkdir -p $(BUILD_DIR)/buildroot-config
Peter Korsgaard35ac32d2011-02-02 15:33:10 +0100649 @$(COMMON_CONFIG_ENV) $< --savedefconfig=$(CONFIG_DIR)/defconfig $(CONFIG_CONFIG_IN)
Eric Andersen2d523c22004-10-09 01:06:03 +0000650
Bernhard Reutner-Fischer6547bce2007-08-22 12:35:41 +0000651# check if download URLs are outdated
Thomas De Schampheleire07bae752012-06-21 19:38:42 +0000652source-check:
Yann E. MORIN7c297452011-07-14 13:02:33 +0200653 $(MAKE) DL_MODE=SOURCE_CHECK $(EXTRAMAKEARGS) source
Bernhard Reutner-Fischer825ff342007-06-07 12:57:03 +0000654
Peter Korsgaard406053d2009-11-20 14:05:48 +0100655endif # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
656
Eric Andersen2d523c22004-10-09 01:06:03 +0000657#############################################################
658#
659# Cleanup and misc junk
660#
661#############################################################
Yann E. MORINaefad532010-09-26 10:56:12 +0200662
663# outputmakefile generates a Makefile in the output directory, if using a
664# separate output directory. This allows convenient use of make in the
665# output directory.
666outputmakefile:
667ifeq ($(NEED_WRAPPER),y)
Thomas Petazzonif082c7c2011-08-31 23:35:02 +0200668 $(Q)$(TOPDIR)/support/scripts/mkmakefile $(TOPDIR) $(O)
Yann E. MORINaefad532010-09-26 10:56:12 +0200669endif
670
Eric Andersen2d523c22004-10-09 01:06:03 +0000671clean:
Peter Korsgaard406053d2009-11-20 14:05:48 +0100672 rm -rf $(STAGING_DIR) $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
Luca Ceresoli7e76f902012-05-17 19:33:00 +0200673 $(STAMP_DIR) $(BUILD_DIR) $(TOOLCHAIN_DIR) $(BASE_DIR)/staging \
674 $(LEGAL_INFO_DIR)
Eric Andersen2d523c22004-10-09 01:06:03 +0000675
676distclean: clean
Peter Korsgaard406053d2009-11-20 14:05:48 +0100677ifeq ($(DL_DIR),$(TOPDIR)/dl)
678 rm -rf $(DL_DIR)
679endif
680ifeq ($(O),output)
681 rm -rf $(O)
682endif
Peter Korsgaard610255e2010-11-24 15:30:54 +0100683 rm -rf $(CONFIG_DIR)/.config $(CONFIG_DIR)/.config.old $(CONFIG_DIR)/.auto.deps
Eric Andersen2d523c22004-10-09 01:06:03 +0000684
Ulf Samuelssonb8f28d62007-09-28 16:18:16 +0000685cross: $(BASE_TARGETS)
686
Bernhard Reutner-Fischere491fba2007-07-08 12:20:58 +0000687help:
688 @echo 'Cleaning:'
Peter Korsgaard406053d2009-11-20 14:05:48 +0100689 @echo ' clean - delete all files created by build'
Bernhard Reutner-Fischere491fba2007-07-08 12:20:58 +0000690 @echo ' distclean - delete all non-source files (including .config)'
691 @echo
692 @echo 'Build:'
693 @echo ' all - make world'
Stephan Hoffmann040f6a32012-04-06 18:44:22 +0200694 @echo ' <package>-rebuild - force recompile <package>'
695 @echo ' <package>-reconfigure - force reconfigure <package>'
Bernhard Reutner-Fischere491fba2007-07-08 12:20:58 +0000696 @echo
697 @echo 'Configuration:'
698 @echo ' menuconfig - interactive curses-based configurator'
Peter Korsgaard15f5bef2011-02-01 08:41:01 +0100699 @echo ' nconfig - interactive ncurses-based configurator'
Peter Korsgaardc48bbb82009-10-04 21:42:54 +0200700 @echo ' xconfig - interactive Qt-based configurator'
Peter Korsgaard2b42aae2010-06-05 21:09:05 +0200701 @echo ' gconfig - interactive GTK-based configurator'
Bernhard Reutner-Fischere491fba2007-07-08 12:20:58 +0000702 @echo ' oldconfig - resolve any unresolved symbols in .config'
Peter Korsgaardc48bbb82009-10-04 21:42:54 +0200703 @echo ' randconfig - New config with random answer to all options'
704 @echo ' defconfig - New config with default answer to all options'
Arnout Vandecappelle33f454b2012-04-28 07:14:50 +0000705 @echo ' BR2_DEFCONFIG, if set, is used as input'
Peter Korsgaardd7051da2010-12-07 12:16:44 +0100706 @echo ' savedefconfig - Save current config as ./defconfig (minimal config)'
Peter Korsgaardc48bbb82009-10-04 21:42:54 +0200707 @echo ' allyesconfig - New config where all options are accepted with yes'
708 @echo ' allnoconfig - New config where all options are answered with no'
Peter Korsgaard66527702009-10-04 21:57:12 +0200709 @echo ' randpackageconfig - New config with random answer to package options'
710 @echo ' allyespackageconfig - New config where pkg options are accepted with yes'
711 @echo ' allnopackageconfig - New config where package options are answered with no'
Peter Korsgaard4bb33dc2011-04-25 00:10:45 +0200712ifeq ($(BR2_PACKAGE_BUSYBOX),y)
713 @echo ' busybox-menuconfig - Run BusyBox menuconfig'
714endif
715ifeq ($(BR2_LINUX_KERNEL),y)
716 @echo ' linux-menuconfig - Run Linux kernel menuconfig'
Jean-Christophe PLAGNIOL-VILLARDf5777ce2011-08-22 21:28:47 +0200717 @echo ' linux-savedefconfig - Run Linux kernel savedefconfig'
Peter Korsgaard4bb33dc2011-04-25 00:10:45 +0200718endif
719ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
720 @echo ' uclibc-menuconfig - Run uClibc menuconfig'
721endif
722ifeq ($(BR2_TOOLCHAIN_CTNG),y)
723 @echo ' ctng-menuconfig - Run crosstool-NG menuconfig'
724endif
Jean-Christophe PLAGNIOL-VILLARD83f1bf92011-08-22 21:28:48 +0200725ifeq ($(BR2_TARGET_BAREBOX),y)
726 @echo ' barebox-menuconfig - Run barebox menuconfig'
727 @echo ' barebox-savedefconfig - Run barebox savedefconfig'
728endif
Bernhard Reutner-Fischere491fba2007-07-08 12:20:58 +0000729 @echo
Thomas Petazzoni8792cf92011-10-10 10:46:40 +0200730 @echo 'Documentation:'
731 @echo ' manual - build manual in HTML, split HTML, PDF and txt'
732 @echo ' manual-html - build manual in HTML'
733 @echo ' manual-split-html - build manual in split HTML'
734 @echo ' manual-pdf - build manual in PDF'
735 @echo ' manual-txt - build manual in txt'
736 @echo ' manual-epub - build manual in ePub'
737 @echo
Bernhard Reutner-Fischere491fba2007-07-08 12:20:58 +0000738 @echo 'Miscellaneous:'
739 @echo ' source - download all sources needed for offline-build'
Thomas De Schampheleire07bae752012-06-21 19:38:42 +0000740 @echo ' source-check - check selected packages for valid download URLs'
Peter Korsgaard155971e2008-03-04 12:19:16 +0000741 @echo ' external-deps - list external packages used'
Luca Ceresoli7e76f902012-05-17 19:33:00 +0200742 @echo ' legal-info - generate info about license compliance'
Bernhard Reutner-Fischere491fba2007-07-08 12:20:58 +0000743 @echo
Peter Korsgaard15f5bef2011-02-01 08:41:01 +0100744 @echo ' make V=0|1 - 0 => quiet build (default), 1 => verbose build'
745 @echo ' make O=dir - Locate all output files in "dir", including .config'
746 @echo
Danomi Mocelopolisb9796192011-07-17 22:17:08 +0200747 @$(foreach b, $(sort $(notdir $(wildcard $(TOPDIR)/configs/*_defconfig))), \
Peter Korsgaard58fd7792009-10-04 22:09:25 +0200748 printf " %-35s - Build for %s\\n" $(b) $(b:_defconfig=);)
749 @echo
Thomas Petazzoni8792cf92011-10-10 10:46:40 +0200750 @echo 'See docs/README, or generate the Buildroot manual for further details'
Bernhard Reutner-Fischer663dee42007-08-27 21:40:42 +0000751 @echo
Bernhard Reutner-Fischerba2e7e02007-06-25 10:56:13 +0000752
Yann E. MORINe5e8fae2010-10-31 17:35:10 +0100753release: OUT=buildroot-$(BR2_VERSION)
Peter Korsgaard0dca7062010-11-04 00:00:00 +0100754
Peter Korsgaard134ab1c2012-02-03 22:03:29 +0100755# Create release tarballs. We need to fiddle a bit to add the generated
756# documentation to the git output
Peter Korsgaard0dca7062010-11-04 00:00:00 +0100757release:
Peter Korsgaard134ab1c2012-02-03 22:03:29 +0100758 git archive --format=tar --prefix=$(OUT)/ master > $(OUT).tar
759 $(MAKE) O=$(OUT) manual-html manual-txt manual-pdf
760 tar rf $(OUT).tar $(OUT)
761 gzip -9 -c < $(OUT).tar > $(OUT).tar.gz
762 bzip2 -9 -c < $(OUT).tar > $(OUT).tar.bz2
763 rm -rf $(OUT) $(OUT).tar
Peter Korsgaarde62d2ec2009-01-15 19:36:06 +0000764
Arnout Vandecappelle (Essensium/Mind)2b91ab72012-03-11 12:16:39 +0100765print-version:
766 @echo $(BR2_VERSION_FULL)
767
Thomas Petazzonib7285d02012-04-17 16:45:22 +0200768include docs/manual/manual.mk
Thomas Petazzoni8792cf92011-10-10 10:46:40 +0200769
Peter Korsgaard66527702009-10-04 21:57:12 +0200770.PHONY: $(noconfig_targets)