blob: 5622b54a936caa7ed853da488cb6ca21984aa982 [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>
Eric Andersenffde94b2001-12-22 00:56:11 +00004#
Eric Andersen08782ae2002-04-26 11:45:55 +00005# This program is free software; you can redistribute it and/or modify
Eric Andersen2d523c22004-10-09 01:06:03 +00006# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
Eric Andersenffde94b2001-12-22 00:56:11 +00009#
Eric Andersen2d523c22004-10-09 01:06:03 +000010# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
Eric Andersen08782ae2002-04-26 11:45:55 +000012# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Eric Andersen2d523c22004-10-09 01:06:03 +000013# General Public License for more details.
Eric Andersenffde94b2001-12-22 00:56:11 +000014#
Eric Andersen2d523c22004-10-09 01:06:03 +000015# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software
17# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18#
Eric Andersenffde94b2001-12-22 00:56:11 +000019
Eric Andersen2d523c22004-10-09 01:06:03 +000020#--------------------------------------------------------------
21# Just run 'make menuconfig', configure stuff, then run 'make'.
22# You shouldn't need to mess with anything beyond this point...
23#--------------------------------------------------------------
24TOPDIR=./
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +000025CONFIG_CONFIG_IN=Config.in
26CONFIG_DEFCONFIG=.defconfig
27CONFIG=package/config
Ulf Samuelsson7def5552007-07-11 15:01:42 +000028DATE:=$(shell date -u +%Y%m%d)
Eric Andersen2d523c22004-10-09 01:06:03 +000029
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +000030noconfig_targets:=menuconfig config oldconfig randconfig \
Bernhard Reutner-Fischer6547bce2007-08-22 12:35:41 +000031 defconfig allyesconfig allnoconfig release tags \
Bernhard Reutner-Fischere491fba2007-07-08 12:20:58 +000032 source-check help
Bernhard Reutner-Fischer9e250352006-12-02 19:01:10 +000033
Bernhard Reutner-Fischer6547bce2007-08-22 12:35:41 +000034# $(shell find . -name *_defconfig |sed 's/.*\///')
Eric Andersen2d523c22004-10-09 01:06:03 +000035
36# Pull in the user's configuration file
37ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
Ulf Samuelsson7521f372007-09-12 04:34:16 +000038ifeq ($(BOARD),)
Eric Andersen2d523c22004-10-09 01:06:03 +000039-include $(TOPDIR).config
Ulf Samuelsson7521f372007-09-12 04:34:16 +000040else
41-include $(TOPDIR)/local/$(BOARD)/$(BOARD).config
42endif
Eric Andersen2d523c22004-10-09 01:06:03 +000043endif
Ulf Samuelssonadbc5a12007-08-20 15:47:42 +000044ifneq ($(BUILDROOT_DL_DIR),)
Ulf Samuelsson3c567e62007-08-19 23:32:33 +000045BR2_DL_DIR:=$(BUILDROOT_DL_DIR)
46endif
Ulf Samuelsson7521f372007-09-12 04:34:16 +000047ifneq ($(BUILDROOT_LOCAL),)
48LOCAL:=$(BUILDROOT_LOCAL)
49else
50LOCAL:=local
51endif
Eric Andersen2d523c22004-10-09 01:06:03 +000052
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +000053# To put more focus on warnings, be less verbose as default
54# Use 'make V=1' to see the full commands
55ifdef V
56 ifeq ("$(origin V)", "command line")
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +000057 KBUILD_VERBOSE=$(V)
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +000058 endif
59endif
60ifndef KBUILD_VERBOSE
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +000061 KBUILD_VERBOSE=0
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +000062endif
63
64ifeq ($(KBUILD_VERBOSE),1)
Ulf Samuelsson4df454e2007-07-06 12:19:35 +000065 quiet=
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +000066 Q=
Bernhard Reutner-Fischer1669b6e2007-09-22 14:19:22 +000067ifndef VERBOSE
68 VERBOSE=1
69endif
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +000070else
71 quiet=quiet_
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +000072 Q=@
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +000073endif
74
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +000075CONFIG_SHELL:=$(shell if [ -x "$$BASH" ]; then echo $$BASH; \
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +000076 else if [ -x /bin/bash ]; then echo /bin/bash; \
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +000077 else echo sh; fi; fi)
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +000078
Bernhard Reutner-Fischer1669b6e2007-09-22 14:19:22 +000079export CONFIG_SHELL quiet Q KBUILD_VERBOSE VERBOSE
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +000080
81ifndef HOSTAR
82HOSTAR:=ar
83endif
84ifndef HOSTAS
85HOSTAS:=as
86endif
87ifndef HOSTCC
88HOSTCC:=gcc
89else
90endif
91ifndef HOSTCXX
92HOSTCXX:=g++
93endif
94ifndef HOSTLD
95HOSTLD:=ld
96endif
Ulf Samuelsson0f9c5b12007-07-15 21:54:11 +000097ifndef HOSTLN
98HOSTLN:=ln
99endif
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000100HOSTAR:=$(shell $(CONFIG_SHELL) -c "which $(HOSTAR)" || type -p $(HOSTAR) || echo ar)
101HOSTAS:=$(shell $(CONFIG_SHELL) -c "which $(HOSTAS)" || type -p $(HOSTAS) || echo as)
102HOSTCC:=$(shell $(CONFIG_SHELL) -c "which $(HOSTCC)" || type -p $(HOSTCC) || echo gcc)
Ulf Samuelsson83832cd2007-07-09 04:26:49 +0000103HOSTCXX:=$(shell $(CONFIG_SHELL) -c "which $(HOSTCXX)" || type -p $(HOSTCXX) || echo g++)
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000104HOSTLD:=$(shell $(CONFIG_SHELL) -c "which $(HOSTLD)" || type -p $(HOSTLD) || echo ld)
105HOSTLN:=$(shell $(CONFIG_SHELL) -c "which $(HOSTLN)" || type -p $(HOSTLN) || echo ln)
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +0000106ifndef CFLAGS_FOR_BUILD
Bernhard Reutner-Fischerf987b7a2007-07-08 00:00:17 +0000107CFLAGS_FOR_BUILD:=-g -O2
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +0000108endif
109export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTLD
110
111
Eric Andersen2d523c22004-10-09 01:06:03 +0000112ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
Eric Andersenffde94b2001-12-22 00:56:11 +0000113
Bernhard Reutner-Fischer99cf7292007-02-12 13:38:06 +0000114# cc-option
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000115# Usage: cflags-y+=$(call cc-option, -march=winchip-c6, -march=i586)
Bernhard Reutner-Fischer99cf7292007-02-12 13:38:06 +0000116# sets -march=winchip-c6 if supported else falls back to -march=i586
117# without checking the latter.
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000118cc-option=$(shell if $(TARGET_CC) $(TARGET_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
Bernhard Reutner-Fischer99cf7292007-02-12 13:38:06 +0000119 > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
120
Peter Korsgaard2c649042007-06-19 15:19:27 +0000121#############################################################
122#
123# Hide troublesome environment variables from sub processes
124#
125#############################################################
126unexport CROSS_COMPILE
127unexport ARCH
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000128
129#############################################################
130#
Bernhard Reutner-Fischerc6e43c92007-06-02 11:22:17 +0000131# Setup the proper filename extensions for the host
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000132#
133##############################################################
134ifneq ($(findstring linux,$(BR2_GNU_BUILD_SUFFIX)),)
Bernhard Reutner-Fischerc6e43c92007-06-02 11:22:17 +0000135HOST_EXEEXT:=
136HOST_LIBEXT:=.a
137HOST_SHREXT:=.so
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000138endif
139ifneq ($(findstring apple,$(BR2_GNU_BUILD_SUFFIX)),)
Bernhard Reutner-Fischerc6e43c92007-06-02 11:22:17 +0000140HOST_EXEEXT:=
141HOST_LIBEXT:=.a
142HOST_SHREXT:=.dylib
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000143endif
144ifneq ($(findstring cygwin,$(BR2_GNU_BUILD_SUFFIX)),)
Bernhard Reutner-Fischerc6e43c92007-06-02 11:22:17 +0000145HOST_EXEEXT:=.exe
146HOST_LIBEXT:=.lib
147HOST_SHREXT:=.dll
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000148endif
149ifneq ($(findstring mingw,$(BR2_GNU_BUILD_SUFFIX)),)
Bernhard Reutner-Fischerc6e43c92007-06-02 11:22:17 +0000150HOST_EXEEXT:=.exe
151HOST_LIBEXT:=.lib
152HOST_SHREXT:=.dll
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000153endif
154
Bernhard Reutner-Fischerc6e43c92007-06-02 11:22:17 +0000155# The preferred type of libs we build for the target
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000156ifeq ($(BR2_PREFER_STATIC_LIB),y)
Bernhard Reutner-Fischerc6e43c92007-06-02 11:22:17 +0000157LIBTGTEXT=.a
Bernhard Reutner-Fischer80277842007-06-20 11:26:36 +0000158#PREFERRED_LIB_FLAGS:=--disable-shared --enable-static
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000159else
Bernhard Reutner-Fischerc6e43c92007-06-02 11:22:17 +0000160LIBTGTEXT=.so
Bernhard Reutner-Fischer80277842007-06-20 11:26:36 +0000161#PREFERRED_LIB_FLAGS:=--disable-static --enable-shared
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000162endif
Bernhard Reutner-Fischer80277842007-06-20 11:26:36 +0000163PREFERRED_LIB_FLAGS:=--enable-static --enable-shared
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000164
Bernhard Reutner-Fischer6ad07202007-07-31 15:02:06 +0000165##############################################################
Eric Andersen08782ae2002-04-26 11:45:55 +0000166#
Eric Andersen2d523c22004-10-09 01:06:03 +0000167# The list of stuff to build for the target toolchain
168# along with the packages to build for the target.
Eric Andersen08782ae2002-04-26 11:45:55 +0000169#
Eric Andersen2d523c22004-10-09 01:06:03 +0000170##############################################################
"Steven J. Hill"02f71aa2007-02-06 18:19:38 +0000171ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
Bernhard Reutner-Fischeracc706b2007-07-23 11:29:38 +0000172BASE_TARGETS:=uclibc-configured binutils gcc uclibc-target-utils
"Steven J. Hill"02f71aa2007-02-06 18:19:38 +0000173else
Bernhard Reutner-Fischeracc706b2007-07-23 11:29:38 +0000174BASE_TARGETS:=uclibc
"Steven J. Hill"02f71aa2007-02-06 18:19:38 +0000175endif
Bernhard Reutner-Fischeracc706b2007-07-23 11:29:38 +0000176TARGETS:=
177
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000178# setup our pathes
Ulf Samuelssonf958d892007-08-14 07:45:01 +0000179include project/Makefile.in
Bernhard Reutner-Fischer1dbe6e32007-08-21 17:56:47 +0000180
181BR2_DEPENDS_DIR=$(PROJECT_BUILD_DIR)/buildroot-config
182
Eric Andersen2d523c22004-10-09 01:06:03 +0000183include toolchain/Makefile.in
Eric Andersen2d523c22004-10-09 01:06:03 +0000184include package/Makefile.in
Eric Andersen27bc59d2003-01-17 04:31:36 +0000185
Eric Andersen08782ae2002-04-26 11:45:55 +0000186#############################################################
187#
Eric Andersenef407d32004-01-29 23:21:00 +0000188# You should probably leave this stuff alone unless you know
Eric Andersen08782ae2002-04-26 11:45:55 +0000189# what you are doing.
190#
191#############################################################
Manuel Novoa III d632d422003-11-01 05:34:41 +0000192
Bernhard Reutner-Fischer6547bce2007-08-22 12:35:41 +0000193all: world
Eric Andersenffde94b2001-12-22 00:56:11 +0000194
Eric Andersen2d523c22004-10-09 01:06:03 +0000195# In this section, we need .config
196include .config.cmd
197
Ulf Samuelssonf958d892007-08-14 07:45:01 +0000198include project/*.mk
199
Eric Andersend06645d2005-02-10 03:06:39 +0000200# We also need the various per-package makefiles, which also add
201# each selected package to TARGETS if that package was selected
202# in the .config file.
Bernhard Reutner-Fischeracc706b2007-07-23 11:29:38 +0000203ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
204# avoid pulling in external toolchain which is broken for toplvl parallel builds
205include $(filter-out $(wildcard toolchain/external-toolchain/*),$(wildcard toolchain/*/*.mk))
206else
Eric Andersend06645d2005-02-10 03:06:39 +0000207include toolchain/*/*.mk
Bernhard Reutner-Fischeracc706b2007-07-23 11:29:38 +0000208endif
209
"Steven J. Hill"62b5ae42007-07-18 18:07:19 +0000210ifeq ($(BR2_PACKAGE_LINUX),y)
211TARGETS+=linux26-modules
212endif
Bernhard Reutner-Fischeracc706b2007-07-23 11:29:38 +0000213
Eric Andersend06645d2005-02-10 03:06:39 +0000214include package/*/*.mk
Eric Andersend06645d2005-02-10 03:06:39 +0000215
Eric Andersen79f5f1e2005-02-17 03:00:29 +0000216# target stuff is last so it can override anything else
217include target/Makefile.in
218
Ulf Samuelssonc2fc93b2007-08-15 09:47:49 +0000219TARGETS+=erase-fakeroots
220
Eric Andersen08782ae2002-04-26 11:45:55 +0000221TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
Bernhard Reutner-Fischer3b08e642007-09-18 13:12:25 +0000222TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS) $(BASE_TARGETS))
Eric Andersen08782ae2002-04-26 11:45:55 +0000223TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
Bernhard Reutner-Fischerb3efde22007-09-01 17:10:55 +0000224TARGETS_ALL:=$(patsubst %,__real_tgt_%,$(TARGETS))
Bernhard Reutner-Fischeracc706b2007-07-23 11:29:38 +0000225# all targets depend on the crosscompiler and it's prerequisites
Bernhard Reutner-Fischerb3efde22007-09-01 17:10:55 +0000226$(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) %
Bernhard Reutner-Fischeracc706b2007-07-23 11:29:38 +0000227
Bernhard Reutner-Fischer1dbe6e32007-08-21 17:56:47 +0000228$(BR2_DEPENDS_DIR): .config
229 rm -rf $@
Bernhard Reutner-Fischerb3efde22007-09-01 17:10:55 +0000230 mkdir -p $(@D)
Bernhard Reutner-Fischer1dbe6e32007-08-21 17:56:47 +0000231 cp -dpRf $(CONFIG)/buildroot-config $@
232
Bernhard Reutner-Fischer5ef9e522007-07-27 14:57:34 +0000233dirs: $(DL_DIR) $(TOOL_BUILD_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
Bernhard Reutner-Fischer1dbe6e32007-08-21 17:56:47 +0000234 $(BR2_DEPENDS_DIR) \
Bernhard Reutner-Fischer5ef9e522007-07-27 14:57:34 +0000235 $(BINARIES_DIR) $(PROJECT_BUILD_DIR)
Ulf Samuelssonf958d892007-08-14 07:45:01 +0000236
Bernhard Reutner-Fischer5ef9e522007-07-27 14:57:34 +0000237$(BASE_TARGETS): dirs
Ulf Samuelssonf958d892007-08-14 07:45:01 +0000238
Bernhard Reutner-Fischerb3efde22007-09-01 17:10:55 +0000239world: dependencies dirs target-host-info $(BASE_TARGETS) $(TARGETS_ALL)
Eric Andersenffde94b2001-12-22 00:56:11 +0000240
Bernhard Reutner-Fischer5ef9e522007-07-27 14:57:34 +0000241
Ulf Samuelssonf958d892007-08-14 07:45:01 +0000242.PHONY: all world dirs clean dirclean distclean source \
Bernhard Reutner-Fischerb3efde22007-09-01 17:10:55 +0000243 $(BASE_TARGETS) $(TARGETS) $(TARGETS_ALL) \
Eric Andersen747b16d2004-12-11 10:33:19 +0000244 $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \
Bernhard Reutner-Fischer5ef9e522007-07-27 14:57:34 +0000245 $(DL_DIR) $(TOOL_BUILD_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
Bernhard Reutner-Fischer1dbe6e32007-08-21 17:56:47 +0000246 $(BR2_DEPENDS_DIR) \
Bernhard Reutner-Fischer5ef9e522007-07-27 14:57:34 +0000247 $(BINARIES_DIR) $(PROJECT_BUILD_DIR)
Jon Nelsonc79e9982002-01-05 20:26:15 +0000248
Eric Andersen08782ae2002-04-26 11:45:55 +0000249#############################################################
250#
Eric Andersenef407d32004-01-29 23:21:00 +0000251# staging and target directories do NOT list these as
Mike Frysingerd99c31c2006-05-26 01:18:09 +0000252# dependencies anywhere else
Eric Andersen08782ae2002-04-26 11:45:55 +0000253#
254#############################################################
Bernhard Reutner-Fischer5ef9e522007-07-27 14:57:34 +0000255$(DL_DIR) $(TOOL_BUILD_DIR) $(BUILD_DIR) \
Ulf Samuelssonc6771df2007-08-16 05:44:55 +0000256 $(PROJECT_BUILD_DIR) $(BINARIES_DIR):
Bernhard Reutner-Fischer8d583fc2007-01-30 00:58:18 +0000257 @mkdir -p $@
Manuel Novoa III 3ad3d8a2004-09-03 00:49:43 +0000258
Eric Andersen08782ae2002-04-26 11:45:55 +0000259$(STAGING_DIR):
"Steven J. Hill"9c865d72007-05-07 03:56:47 +0000260 @mkdir -p $(STAGING_DIR)/bin
Eric Andersenbf387232004-12-11 10:35:18 +0000261 @mkdir -p $(STAGING_DIR)/lib
Bernhard Reutner-Fischer7e0c8902007-06-24 12:27:08 +0000262ifeq ($(BR2_TOOLCHAIN_SYSROOT),y)
Bernhard Reutner-Fischer80277842007-06-20 11:26:36 +0000263 @mkdir -p $(STAGING_DIR)/usr/lib
264else
265 @ln -snf . $(STAGING_DIR)/usr
266 @mkdir -p $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)
Eric Andersen3da708e2007-01-10 06:55:27 +0000267 @ln -snf ../lib $(STAGING_DIR)/usr/lib
Bernhard Reutner-Fischer80277842007-06-20 11:26:36 +0000268 @ln -snf ../lib $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/lib
269endif
270 @mkdir -p $(STAGING_DIR)/usr/include
Eric Andersen08782ae2002-04-26 11:45:55 +0000271
Ulf Samuelssonc6771df2007-08-16 05:44:55 +0000272$(PROJECT_BUILD_DIR)/.root:
Bernhard Reutner-Fischer7547c7e2007-08-21 10:53:39 +0000273 mkdir -p $(TARGET_DIR)
Bernhard Reutner-Fischerf0ca4b82007-08-21 10:56:38 +0000274 if ! [ -d "$(TARGET_DIR)/bin" ]; then \
275 if [ -d "$(TARGET_SKELETON)" ]; then \
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000276 cp -fa $(TARGET_SKELETON)/* $(TARGET_DIR)/; \
Ulf Samuelsson74cda1e2007-08-14 07:24:45 +0000277 fi; \
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000278 touch $(STAGING_DIR)/.fakeroot.00000; \
Bernhard Reutner-Fischerf0ca4b82007-08-21 10:56:38 +0000279 fi
280 -find $(TARGET_DIR) -type d -name CVS | xargs rm -rf
281 -find $(TARGET_DIR) -type d -name .svn | xargs rm -rf
Bernhard Reutner-Fischer7547c7e2007-08-21 10:53:39 +0000282 touch $@
Eric Andersenffde94b2001-12-22 00:56:11 +0000283
Bernhard Reutner-Fischer1dbe6e32007-08-21 17:56:47 +0000284$(TARGET_DIR): $(PROJECT_BUILD_DIR)/.root
Ulf Samuelssonc6771df2007-08-16 05:44:55 +0000285
Ulf Samuelssonc2fc93b2007-08-15 09:47:49 +0000286erase-fakeroots:
Ulf Samuelsson5d2be042007-08-16 18:19:42 +0000287 rm -f $(PROJECT_BUILD_DIR)/.fakeroot*
Ulf Samuelsson412ca2a2007-07-12 13:11:03 +0000288
Bernhard Reutner-Fischer3b08e642007-09-18 13:12:25 +0000289source: $(TARGETS_SOURCE) $(HOST_SOURCE)
Eric Andersenffde94b2001-12-22 00:56:11 +0000290
Bernhard Reutner-Fischer6547bce2007-08-22 12:35:41 +0000291_source-check:
Ulf Samuelssone7c08c22007-07-20 07:34:28 +0000292 $(MAKE) SPIDER=--spider source
Bernhard Reutner-Fischer825ff342007-06-07 12:57:03 +0000293
Eric Andersen08782ae2002-04-26 11:45:55 +0000294#############################################################
295#
296# Cleanup and misc junk
297#
298#############################################################
299clean: $(TARGETS_CLEAN)
Manuel Novoa III 3ad3d8a2004-09-03 00:49:43 +0000300 rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE)
Eric Andersenffde94b2001-12-22 00:56:11 +0000301
Eric Andersen08782ae2002-04-26 11:45:55 +0000302dirclean: $(TARGETS_DIRCLEAN)
Manuel Novoa III 3ad3d8a2004-09-03 00:49:43 +0000303 rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE)
Eric Andersenffde94b2001-12-22 00:56:11 +0000304
Eric Andersen08782ae2002-04-26 11:45:55 +0000305distclean:
Mike Frysinger5bc1f0c2005-09-09 02:49:10 +0000306ifeq ($(DL_DIR),$(BASE_DIR)/dl)
307 rm -rf $(DL_DIR)
308endif
Bernhard Reutner-Fischer6547bce2007-08-22 12:35:41 +0000309 rm -rf $(BUILD_DIR) $(PROJECT_BUILD_DIR) $(BINARIES_DIR) \
Ulf Samuelsson412ca2a2007-07-12 13:11:03 +0000310 $(LINUX_KERNEL) $(IMAGE) $(BASE_DIR)/include \
Bernhard Reutner-Fischer81df2262007-07-09 08:06:27 +0000311 .config.cmd
Bernhard Reutner-Fischerb5136192007-01-19 18:00:49 +0000312 $(MAKE) -C $(CONFIG) clean
Eric Andersenffde94b2001-12-22 00:56:11 +0000313
Manuel Novoa III 3ad3d8a2004-09-03 00:49:43 +0000314sourceball:
Bernhard Reutner-Fischer6547bce2007-08-22 12:35:41 +0000315 rm -rf $(BUILD_DIR) $(PROJECT_BUILD_DIR) $(BINARIES_DIR)
Eric Andersen08782ae2002-04-26 11:45:55 +0000316 set -e; \
317 cd ..; \
318 rm -f buildroot.tar.bz2; \
319 tar -cvf buildroot.tar buildroot; \
320 bzip2 -9 buildroot.tar; \
Eric Andersen2d523c22004-10-09 01:06:03 +0000321
322
323else # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
324
325all: menuconfig
326
327# configuration
328# ---------------------------------------------------------------------------
329
Bernhard Reutner-Fischerc0d7d4e2007-07-09 18:23:20 +0000330HOSTCFLAGS=$(CFLAGS_FOR_BUILD)
331export HOSTCFLAGS
332
Eric Andersen2d523c22004-10-09 01:06:03 +0000333$(CONFIG)/conf:
Bernhard Reutner-Fischer1dbe6e32007-08-21 17:56:47 +0000334 @mkdir -p $(CONFIG)/buildroot-config
Bernhard Reutner-Fischerfb2c8fe2007-07-27 14:16:00 +0000335 $(MAKE) CC="$(HOSTCC)" -C $(CONFIG) conf
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000336 -@if [ ! -f .config ]; then \
Eric Andersen2d523c22004-10-09 01:06:03 +0000337 cp $(CONFIG_DEFCONFIG) .config; \
338 fi
339$(CONFIG)/mconf:
Bernhard Reutner-Fischer1dbe6e32007-08-21 17:56:47 +0000340 @mkdir -p $(CONFIG)/buildroot-config
Bernhard Reutner-Fischerfb2c8fe2007-07-27 14:16:00 +0000341 $(MAKE) CC="$(HOSTCC)" -C $(CONFIG) conf mconf
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000342 -@if [ ! -f .config ]; then \
Eric Andersen2d523c22004-10-09 01:06:03 +0000343 cp $(CONFIG_DEFCONFIG) .config; \
344 fi
345
346menuconfig: $(CONFIG)/mconf
Bernhard Reutner-Fischer7b403ad2007-08-21 11:25:30 +0000347 @mkdir -p $(CONFIG)/buildroot-config
Bernhard Reutner-Fischer153b1be2007-07-27 12:37:30 +0000348 @if ! KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
"Steven J. Hill"62b5ae42007-07-18 18:07:19 +0000349 KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
Bernhard Reutner-Fischer153b1be2007-07-27 12:37:30 +0000350 $(CONFIG)/mconf $(CONFIG_CONFIG_IN); then \
351 test -f .config.cmd || rm -f .config; \
352 fi
Eric Andersen2d523c22004-10-09 01:06:03 +0000353
354config: $(CONFIG)/conf
Bernhard Reutner-Fischer7b403ad2007-08-21 11:25:30 +0000355 @mkdir -p $(CONFIG)/buildroot-config
"Steven J. Hill"62b5ae42007-07-18 18:07:19 +0000356 @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
357 KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
Bernhard Reutner-Fischerf987b7a2007-07-08 00:00:17 +0000358 $(CONFIG)/conf $(CONFIG_CONFIG_IN)
Eric Andersen2d523c22004-10-09 01:06:03 +0000359
360oldconfig: $(CONFIG)/conf
Bernhard Reutner-Fischer7b403ad2007-08-21 11:25:30 +0000361 @mkdir -p $(CONFIG)/buildroot-config
"Steven J. Hill"62b5ae42007-07-18 18:07:19 +0000362 @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
363 KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
Bernhard Reutner-Fischerf987b7a2007-07-08 00:00:17 +0000364 $(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
Eric Andersen2d523c22004-10-09 01:06:03 +0000365
366randconfig: $(CONFIG)/conf
Bernhard Reutner-Fischer7b403ad2007-08-21 11:25:30 +0000367 @mkdir -p $(CONFIG)/buildroot-config
"Steven J. Hill"62b5ae42007-07-18 18:07:19 +0000368 @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
369 KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
Bernhard Reutner-Fischerf987b7a2007-07-08 00:00:17 +0000370 $(CONFIG)/conf -r $(CONFIG_CONFIG_IN)
Eric Andersen2d523c22004-10-09 01:06:03 +0000371
372allyesconfig: $(CONFIG)/conf
Bernhard Reutner-Fischerf987b7a2007-07-08 00:00:17 +0000373 cat $(CONFIG_DEFCONFIG) > .config
Bernhard Reutner-Fischer7b403ad2007-08-21 11:25:30 +0000374 @mkdir -p $(CONFIG)/buildroot-config
"Steven J. Hill"62b5ae42007-07-18 18:07:19 +0000375 @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
376 KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
Bernhard Reutner-Fischerf987b7a2007-07-08 00:00:17 +0000377 $(CONFIG)/conf -y $(CONFIG_CONFIG_IN)
Eric Andersen2d523c22004-10-09 01:06:03 +0000378 #sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config
Eric Andersen2d523c22004-10-09 01:06:03 +0000379
380allnoconfig: $(CONFIG)/conf
Bernhard Reutner-Fischer7b403ad2007-08-21 11:25:30 +0000381 @mkdir -p $(CONFIG)/buildroot-config
"Steven J. Hill"62b5ae42007-07-18 18:07:19 +0000382 @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
383 KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
Bernhard Reutner-Fischerf987b7a2007-07-08 00:00:17 +0000384 $(CONFIG)/conf -n $(CONFIG_CONFIG_IN)
Eric Andersen2d523c22004-10-09 01:06:03 +0000385
386defconfig: $(CONFIG)/conf
Bernhard Reutner-Fischer7b403ad2007-08-21 11:25:30 +0000387 @mkdir -p $(CONFIG)/buildroot-config
"Steven J. Hill"62b5ae42007-07-18 18:07:19 +0000388 @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
389 KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
Bernhard Reutner-Fischerf987b7a2007-07-08 00:00:17 +0000390 $(CONFIG)/conf -d $(CONFIG_CONFIG_IN)
Eric Andersen2d523c22004-10-09 01:06:03 +0000391
Bernhard Reutner-Fischer6547bce2007-08-22 12:35:41 +0000392# check if download URLs are outdated
Bernhard Reutner-Fischer825ff342007-06-07 12:57:03 +0000393source-check: allyesconfig
394 $(MAKE) _source-check
395
Eric Andersen2d523c22004-10-09 01:06:03 +0000396#############################################################
397#
398# Cleanup and misc junk
399#
400#############################################################
401clean:
402 rm -f .config .config.old .config.cmd .tmpconfig.h
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000403 -$(MAKE) -C $(CONFIG) clean
Eric Andersen2d523c22004-10-09 01:06:03 +0000404
405distclean: clean
406 rm -rf sources/*
407
408endif # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
409
Bernhard Reutner-Fischerba2e7e02007-06-25 10:56:13 +0000410%_defconfig: $(CONFIG)/conf
411 cp $(shell find ./target/ -name $@) .config
412 @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
413
Bernhard Reutner-Fischere491fba2007-07-08 12:20:58 +0000414help:
415 @echo 'Cleaning:'
416 @echo ' clean - delete temporary files created by build'
417 @echo ' distclean - delete all non-source files (including .config)'
418 @echo
419 @echo 'Build:'
420 @echo ' all - make world'
421 @echo
422 @echo 'Configuration:'
423 @echo ' menuconfig - interactive curses-based configurator'
424 @echo ' oldconfig - resolve any unresolved symbols in .config'
425 @echo
426 @echo 'Miscellaneous:'
427 @echo ' source - download all sources needed for offline-build'
Bernhard Reutner-Fischer03380402007-08-21 10:42:05 +0000428 @echo ' source-check - check all packages for valid download URLs'
Bernhard Reutner-Fischere491fba2007-07-08 12:20:58 +0000429 @echo
Bernhard Reutner-Fischer232fa7e2007-08-27 21:51:27 +0000430 @echo 'See docs/README and docs/buildroot.html for further details'
Bernhard Reutner-Fischer663dee42007-08-27 21:40:42 +0000431 @echo
Bernhard Reutner-Fischerba2e7e02007-06-25 10:56:13 +0000432
Eric Andersen2d523c22004-10-09 01:06:03 +0000433.PHONY: dummy subdirs release distclean clean config oldconfig \
Bernhard Reutner-Fischere491fba2007-07-08 12:20:58 +0000434 menuconfig tags check test depend defconfig help
Ulf Samuelsson633c8cb2007-09-17 12:49:46 +0000435