blob: 5ebf75eaee7ee5848a6b27ea4a2db93ef07fcf72 [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
Bernhard Reutner-Fischer5f975802007-09-28 20:10:22 +000094ifndef HOSTFC
95HOSTFC:=gfortran
96endif
Ulf Samuelsson356133b2007-09-28 19:46:58 +000097ifndef HOSTCPP
98HOSTCPP:=cpp
99endif
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +0000100ifndef HOSTLD
101HOSTLD:=ld
102endif
Ulf Samuelsson0f9c5b12007-07-15 21:54:11 +0000103ifndef HOSTLN
104HOSTLN:=ln
105endif
Ulf Samuelsson356133b2007-09-28 19:46:58 +0000106ifndef HOSTNM
107HOSTNM:=nm
108endif
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000109HOSTAR:=$(shell $(CONFIG_SHELL) -c "which $(HOSTAR)" || type -p $(HOSTAR) || echo ar)
110HOSTAS:=$(shell $(CONFIG_SHELL) -c "which $(HOSTAS)" || type -p $(HOSTAS) || echo as)
111HOSTCC:=$(shell $(CONFIG_SHELL) -c "which $(HOSTCC)" || type -p $(HOSTCC) || echo gcc)
Ulf Samuelsson83832cd2007-07-09 04:26:49 +0000112HOSTCXX:=$(shell $(CONFIG_SHELL) -c "which $(HOSTCXX)" || type -p $(HOSTCXX) || echo g++)
Bernhard Reutner-Fischer5f975802007-09-28 20:10:22 +0000113HOSTFC:=$(shell $(CONFIG_SHELL) -c "which $(HOSTLD)" || type -p $(HOSTLD) || echo || which g77 || type -p g77 || echo gfortran)
Ulf Samuelsson356133b2007-09-28 19:46:58 +0000114HOSTCPP:=$(shell $(CONFIG_SHELL) -c "which $(HOSTCPP)" || type -p $(HOSTCPP) || echo cpp)
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000115HOSTLD:=$(shell $(CONFIG_SHELL) -c "which $(HOSTLD)" || type -p $(HOSTLD) || echo ld)
116HOSTLN:=$(shell $(CONFIG_SHELL) -c "which $(HOSTLN)" || type -p $(HOSTLN) || echo ln)
Ulf Samuelsson356133b2007-09-28 19:46:58 +0000117HOSTNM:=$(shell $(CONFIG_SHELL) -c "which $(HOSTNM)" || type -p $(HOSTNM) || echo nm)
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +0000118ifndef CFLAGS_FOR_BUILD
Bernhard Reutner-Fischerf987b7a2007-07-08 00:00:17 +0000119CFLAGS_FOR_BUILD:=-g -O2
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +0000120endif
Bernhard Reutner-Fischer5f975802007-09-28 20:10:22 +0000121ifndef CXXFLAGS_FOR_BUILD
122CXXFLAGS_FOR_BUILD:=-g -O2
123endif
124ifndef FCFLAGS_FOR_BUILD
125FCFLAGS_FOR_BUILD:=-g -O2
126endif
127export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +0000128
129
Bernhard Reutner-Fischercfe511b2007-09-29 13:58:30 +0000130ifeq ($(BR2_HAVE_DOT_CONFIG),y)
Eric Andersenffde94b2001-12-22 00:56:11 +0000131
Bernhard Reutner-Fischer99cf7292007-02-12 13:38:06 +0000132# cc-option
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000133# Usage: cflags-y+=$(call cc-option, -march=winchip-c6, -march=i586)
Bernhard Reutner-Fischer99cf7292007-02-12 13:38:06 +0000134# sets -march=winchip-c6 if supported else falls back to -march=i586
135# without checking the latter.
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000136cc-option=$(shell if $(TARGET_CC) $(TARGET_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
Bernhard Reutner-Fischer99cf7292007-02-12 13:38:06 +0000137 > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
138
Peter Korsgaard2c649042007-06-19 15:19:27 +0000139#############################################################
140#
141# Hide troublesome environment variables from sub processes
142#
143#############################################################
144unexport CROSS_COMPILE
145unexport ARCH
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000146
147#############################################################
148#
Bernhard Reutner-Fischerc6e43c92007-06-02 11:22:17 +0000149# Setup the proper filename extensions for the host
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000150#
151##############################################################
152ifneq ($(findstring linux,$(BR2_GNU_BUILD_SUFFIX)),)
Bernhard Reutner-Fischerc6e43c92007-06-02 11:22:17 +0000153HOST_EXEEXT:=
154HOST_LIBEXT:=.a
155HOST_SHREXT:=.so
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000156endif
157ifneq ($(findstring apple,$(BR2_GNU_BUILD_SUFFIX)),)
Bernhard Reutner-Fischerc6e43c92007-06-02 11:22:17 +0000158HOST_EXEEXT:=
159HOST_LIBEXT:=.a
160HOST_SHREXT:=.dylib
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000161endif
162ifneq ($(findstring cygwin,$(BR2_GNU_BUILD_SUFFIX)),)
Bernhard Reutner-Fischerc6e43c92007-06-02 11:22:17 +0000163HOST_EXEEXT:=.exe
164HOST_LIBEXT:=.lib
165HOST_SHREXT:=.dll
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000166endif
167ifneq ($(findstring mingw,$(BR2_GNU_BUILD_SUFFIX)),)
Bernhard Reutner-Fischerc6e43c92007-06-02 11:22:17 +0000168HOST_EXEEXT:=.exe
169HOST_LIBEXT:=.lib
170HOST_SHREXT:=.dll
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000171endif
172
Bernhard Reutner-Fischerc6e43c92007-06-02 11:22:17 +0000173# The preferred type of libs we build for the target
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000174ifeq ($(BR2_PREFER_STATIC_LIB),y)
Bernhard Reutner-Fischerc6e43c92007-06-02 11:22:17 +0000175LIBTGTEXT=.a
Bernhard Reutner-Fischer80277842007-06-20 11:26:36 +0000176#PREFERRED_LIB_FLAGS:=--disable-shared --enable-static
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000177else
Bernhard Reutner-Fischerc6e43c92007-06-02 11:22:17 +0000178LIBTGTEXT=.so
Bernhard Reutner-Fischer80277842007-06-20 11:26:36 +0000179#PREFERRED_LIB_FLAGS:=--disable-static --enable-shared
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000180endif
Bernhard Reutner-Fischer80277842007-06-20 11:26:36 +0000181PREFERRED_LIB_FLAGS:=--enable-static --enable-shared
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000182
Bernhard Reutner-Fischer6ad07202007-07-31 15:02:06 +0000183##############################################################
Eric Andersen08782ae2002-04-26 11:45:55 +0000184#
Eric Andersen2d523c22004-10-09 01:06:03 +0000185# The list of stuff to build for the target toolchain
186# along with the packages to build for the target.
Eric Andersen08782ae2002-04-26 11:45:55 +0000187#
Eric Andersen2d523c22004-10-09 01:06:03 +0000188##############################################################
Bernhard Reutner-Fischer4b0d5a82007-09-26 21:12:38 +0000189ifeq ($(BR2_TOOLCHAIN_SOURCE),y)
Bernhard Reutner-Fischer4909da42007-09-22 21:38:15 +0000190BASE_TARGETS:=uclibc-configured binutils cross_compiler uclibc-target-utils
"Steven J. Hill"02f71aa2007-02-06 18:19:38 +0000191else
Bernhard Reutner-Fischeracc706b2007-07-23 11:29:38 +0000192BASE_TARGETS:=uclibc
"Steven J. Hill"02f71aa2007-02-06 18:19:38 +0000193endif
Bernhard Reutner-Fischeracc706b2007-07-23 11:29:38 +0000194TARGETS:=
195
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000196# setup our pathes
Ulf Samuelssonf958d892007-08-14 07:45:01 +0000197include project/Makefile.in
Bernhard Reutner-Fischer1dbe6e32007-08-21 17:56:47 +0000198
199BR2_DEPENDS_DIR=$(PROJECT_BUILD_DIR)/buildroot-config
200
Eric Andersen2d523c22004-10-09 01:06:03 +0000201include toolchain/Makefile.in
Eric Andersen2d523c22004-10-09 01:06:03 +0000202include package/Makefile.in
Eric Andersen27bc59d2003-01-17 04:31:36 +0000203
Eric Andersen08782ae2002-04-26 11:45:55 +0000204#############################################################
205#
Eric Andersenef407d32004-01-29 23:21:00 +0000206# You should probably leave this stuff alone unless you know
Eric Andersen08782ae2002-04-26 11:45:55 +0000207# what you are doing.
208#
209#############################################################
Manuel Novoa III d632d422003-11-01 05:34:41 +0000210
Bernhard Reutner-Fischer6547bce2007-08-22 12:35:41 +0000211all: world
Eric Andersenffde94b2001-12-22 00:56:11 +0000212
Eric Andersen2d523c22004-10-09 01:06:03 +0000213# In this section, we need .config
214include .config.cmd
215
Ulf Samuelssonf958d892007-08-14 07:45:01 +0000216include project/*.mk
217
Eric Andersend06645d2005-02-10 03:06:39 +0000218# We also need the various per-package makefiles, which also add
219# each selected package to TARGETS if that package was selected
220# in the .config file.
Bernhard Reutner-Fischer4b0d5a82007-09-26 21:12:38 +0000221ifeq ($(BR2_TOOLCHAIN_SOURCE),y)
Bernhard Reutner-Fischeracc706b2007-07-23 11:29:38 +0000222# avoid pulling in external toolchain which is broken for toplvl parallel builds
Bernhard Reutner-Fischer57310ec2007-09-27 21:24:15 +0000223# Explicit ordering:
224include toolchain/dependencies/dependencies.mk
225include toolchain/binutils/binutils.mk
226include toolchain/ccache/ccache.mk
227include toolchain/elf2flt/elf2flt.mk
228include toolchain/gcc/gcc-uclibc-3.x.mk
229include toolchain/gcc/gcc-uclibc-4.x.mk
230include toolchain/gdb/gdb.mk
231include toolchain/kernel-headers/kernel-headers.mk
232include toolchain/mklibs/mklibs.mk
233include toolchain/sstrip/sstrip.mk
234include toolchain/uClibc/uclibc.mk
Bernhard Reutner-Fischeracc706b2007-07-23 11:29:38 +0000235else
Eric Andersend06645d2005-02-10 03:06:39 +0000236include toolchain/*/*.mk
Bernhard Reutner-Fischeracc706b2007-07-23 11:29:38 +0000237endif
238
"Steven J. Hill"62b5ae42007-07-18 18:07:19 +0000239ifeq ($(BR2_PACKAGE_LINUX),y)
240TARGETS+=linux26-modules
241endif
Bernhard Reutner-Fischeracc706b2007-07-23 11:29:38 +0000242
Eric Andersend06645d2005-02-10 03:06:39 +0000243include package/*/*.mk
Eric Andersend06645d2005-02-10 03:06:39 +0000244
Eric Andersen79f5f1e2005-02-17 03:00:29 +0000245# target stuff is last so it can override anything else
246include target/Makefile.in
247
Ulf Samuelssonc2fc93b2007-08-15 09:47:49 +0000248TARGETS+=erase-fakeroots
249
Eric Andersen08782ae2002-04-26 11:45:55 +0000250TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
Bernhard Reutner-Fischer3b08e642007-09-18 13:12:25 +0000251TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS) $(BASE_TARGETS))
Eric Andersen08782ae2002-04-26 11:45:55 +0000252TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
Bernhard Reutner-Fischerb3efde22007-09-01 17:10:55 +0000253TARGETS_ALL:=$(patsubst %,__real_tgt_%,$(TARGETS))
Bernhard Reutner-Fischeracc706b2007-07-23 11:29:38 +0000254# all targets depend on the crosscompiler and it's prerequisites
Bernhard Reutner-Fischerb3efde22007-09-01 17:10:55 +0000255$(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) %
Bernhard Reutner-Fischeracc706b2007-07-23 11:29:38 +0000256
Bernhard Reutner-Fischer1dbe6e32007-08-21 17:56:47 +0000257$(BR2_DEPENDS_DIR): .config
258 rm -rf $@
Bernhard Reutner-Fischerb3efde22007-09-01 17:10:55 +0000259 mkdir -p $(@D)
Bernhard Reutner-Fischer1dbe6e32007-08-21 17:56:47 +0000260 cp -dpRf $(CONFIG)/buildroot-config $@
261
Bernhard Reutner-Fischer5ef9e522007-07-27 14:57:34 +0000262dirs: $(DL_DIR) $(TOOL_BUILD_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
Bernhard Reutner-Fischer1dbe6e32007-08-21 17:56:47 +0000263 $(BR2_DEPENDS_DIR) \
Bernhard Reutner-Fischer5ef9e522007-07-27 14:57:34 +0000264 $(BINARIES_DIR) $(PROJECT_BUILD_DIR)
Ulf Samuelssonf958d892007-08-14 07:45:01 +0000265
Bernhard Reutner-Fischer5ef9e522007-07-27 14:57:34 +0000266$(BASE_TARGETS): dirs
Ulf Samuelssonf958d892007-08-14 07:45:01 +0000267
Bernhard Reutner-Fischerb3efde22007-09-01 17:10:55 +0000268world: dependencies dirs target-host-info $(BASE_TARGETS) $(TARGETS_ALL)
Eric Andersenffde94b2001-12-22 00:56:11 +0000269
Bernhard Reutner-Fischer5ef9e522007-07-27 14:57:34 +0000270
Ulf Samuelssonf958d892007-08-14 07:45:01 +0000271.PHONY: all world dirs clean dirclean distclean source \
Bernhard Reutner-Fischerb3efde22007-09-01 17:10:55 +0000272 $(BASE_TARGETS) $(TARGETS) $(TARGETS_ALL) \
Eric Andersen747b16d2004-12-11 10:33:19 +0000273 $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \
Bernhard Reutner-Fischer5ef9e522007-07-27 14:57:34 +0000274 $(DL_DIR) $(TOOL_BUILD_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
Bernhard Reutner-Fischer1dbe6e32007-08-21 17:56:47 +0000275 $(BR2_DEPENDS_DIR) \
Bernhard Reutner-Fischer5ef9e522007-07-27 14:57:34 +0000276 $(BINARIES_DIR) $(PROJECT_BUILD_DIR)
Jon Nelsonc79e9982002-01-05 20:26:15 +0000277
Eric Andersen08782ae2002-04-26 11:45:55 +0000278#############################################################
279#
Eric Andersenef407d32004-01-29 23:21:00 +0000280# staging and target directories do NOT list these as
Mike Frysingerd99c31c2006-05-26 01:18:09 +0000281# dependencies anywhere else
Eric Andersen08782ae2002-04-26 11:45:55 +0000282#
283#############################################################
Bernhard Reutner-Fischer5ef9e522007-07-27 14:57:34 +0000284$(DL_DIR) $(TOOL_BUILD_DIR) $(BUILD_DIR) \
Ulf Samuelssonc6771df2007-08-16 05:44:55 +0000285 $(PROJECT_BUILD_DIR) $(BINARIES_DIR):
Bernhard Reutner-Fischer8d583fc2007-01-30 00:58:18 +0000286 @mkdir -p $@
Manuel Novoa III 3ad3d8a2004-09-03 00:49:43 +0000287
Eric Andersen08782ae2002-04-26 11:45:55 +0000288$(STAGING_DIR):
"Steven J. Hill"9c865d72007-05-07 03:56:47 +0000289 @mkdir -p $(STAGING_DIR)/bin
Eric Andersenbf387232004-12-11 10:35:18 +0000290 @mkdir -p $(STAGING_DIR)/lib
Bernhard Reutner-Fischer7e0c8902007-06-24 12:27:08 +0000291ifeq ($(BR2_TOOLCHAIN_SYSROOT),y)
Bernhard Reutner-Fischer80277842007-06-20 11:26:36 +0000292 @mkdir -p $(STAGING_DIR)/usr/lib
293else
Ulf Samuelssonf5905dc2007-10-07 18:23:43 +0000294ifneq ($(BR2_TOOLCHAIN_EXTERNAL),y)
Bernhard Reutner-Fischer80277842007-06-20 11:26:36 +0000295 @ln -snf . $(STAGING_DIR)/usr
296 @mkdir -p $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)
Eric Andersen3da708e2007-01-10 06:55:27 +0000297 @ln -snf ../lib $(STAGING_DIR)/usr/lib
Bernhard Reutner-Fischer80277842007-06-20 11:26:36 +0000298 @ln -snf ../lib $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/lib
299endif
Ulf Samuelssonf5905dc2007-10-07 18:23:43 +0000300endif
Bernhard Reutner-Fischer80277842007-06-20 11:26:36 +0000301 @mkdir -p $(STAGING_DIR)/usr/include
Eric Andersen08782ae2002-04-26 11:45:55 +0000302
Ulf Samuelssonc6771df2007-08-16 05:44:55 +0000303$(PROJECT_BUILD_DIR)/.root:
Bernhard Reutner-Fischer7547c7e2007-08-21 10:53:39 +0000304 mkdir -p $(TARGET_DIR)
Bernhard Reutner-Fischerf0ca4b82007-08-21 10:56:38 +0000305 if ! [ -d "$(TARGET_DIR)/bin" ]; then \
306 if [ -d "$(TARGET_SKELETON)" ]; then \
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000307 cp -fa $(TARGET_SKELETON)/* $(TARGET_DIR)/; \
Ulf Samuelsson74cda1e2007-08-14 07:24:45 +0000308 fi; \
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000309 touch $(STAGING_DIR)/.fakeroot.00000; \
Bernhard Reutner-Fischerf0ca4b82007-08-21 10:56:38 +0000310 fi
311 -find $(TARGET_DIR) -type d -name CVS | xargs rm -rf
312 -find $(TARGET_DIR) -type d -name .svn | xargs rm -rf
Bernhard Reutner-Fischer7547c7e2007-08-21 10:53:39 +0000313 touch $@
Eric Andersenffde94b2001-12-22 00:56:11 +0000314
Bernhard Reutner-Fischer1dbe6e32007-08-21 17:56:47 +0000315$(TARGET_DIR): $(PROJECT_BUILD_DIR)/.root
Ulf Samuelssonc6771df2007-08-16 05:44:55 +0000316
Ulf Samuelssonc2fc93b2007-08-15 09:47:49 +0000317erase-fakeroots:
Ulf Samuelsson5d2be042007-08-16 18:19:42 +0000318 rm -f $(PROJECT_BUILD_DIR)/.fakeroot*
Ulf Samuelsson412ca2a2007-07-12 13:11:03 +0000319
Bernhard Reutner-Fischer3b08e642007-09-18 13:12:25 +0000320source: $(TARGETS_SOURCE) $(HOST_SOURCE)
Eric Andersenffde94b2001-12-22 00:56:11 +0000321
Bernhard Reutner-Fischer6547bce2007-08-22 12:35:41 +0000322_source-check:
Ulf Samuelssone7c08c22007-07-20 07:34:28 +0000323 $(MAKE) SPIDER=--spider source
Bernhard Reutner-Fischer825ff342007-06-07 12:57:03 +0000324
Eric Andersen08782ae2002-04-26 11:45:55 +0000325#############################################################
326#
327# Cleanup and misc junk
328#
329#############################################################
330clean: $(TARGETS_CLEAN)
Manuel Novoa III 3ad3d8a2004-09-03 00:49:43 +0000331 rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE)
Eric Andersenffde94b2001-12-22 00:56:11 +0000332
Eric Andersen08782ae2002-04-26 11:45:55 +0000333dirclean: $(TARGETS_DIRCLEAN)
Manuel Novoa III 3ad3d8a2004-09-03 00:49:43 +0000334 rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE)
Eric Andersenffde94b2001-12-22 00:56:11 +0000335
Eric Andersen08782ae2002-04-26 11:45:55 +0000336distclean:
Mike Frysinger5bc1f0c2005-09-09 02:49:10 +0000337ifeq ($(DL_DIR),$(BASE_DIR)/dl)
338 rm -rf $(DL_DIR)
339endif
Bernhard Reutner-Fischer6547bce2007-08-22 12:35:41 +0000340 rm -rf $(BUILD_DIR) $(PROJECT_BUILD_DIR) $(BINARIES_DIR) \
Ulf Samuelsson412ca2a2007-07-12 13:11:03 +0000341 $(LINUX_KERNEL) $(IMAGE) $(BASE_DIR)/include \
Bernhard Reutner-Fischer81df2262007-07-09 08:06:27 +0000342 .config.cmd
Bernhard Reutner-Fischerb5136192007-01-19 18:00:49 +0000343 $(MAKE) -C $(CONFIG) clean
Eric Andersenffde94b2001-12-22 00:56:11 +0000344
Manuel Novoa III 3ad3d8a2004-09-03 00:49:43 +0000345sourceball:
Bernhard Reutner-Fischer6547bce2007-08-22 12:35:41 +0000346 rm -rf $(BUILD_DIR) $(PROJECT_BUILD_DIR) $(BINARIES_DIR)
Eric Andersen08782ae2002-04-26 11:45:55 +0000347 set -e; \
348 cd ..; \
349 rm -f buildroot.tar.bz2; \
350 tar -cvf buildroot.tar buildroot; \
351 bzip2 -9 buildroot.tar; \
Eric Andersen2d523c22004-10-09 01:06:03 +0000352
353
Bernhard Reutner-Fischercfe511b2007-09-29 13:58:30 +0000354else # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
Eric Andersen2d523c22004-10-09 01:06:03 +0000355
356all: menuconfig
357
358# configuration
359# ---------------------------------------------------------------------------
360
Bernhard Reutner-Fischerc0d7d4e2007-07-09 18:23:20 +0000361HOSTCFLAGS=$(CFLAGS_FOR_BUILD)
362export HOSTCFLAGS
363
Eric Andersen2d523c22004-10-09 01:06:03 +0000364$(CONFIG)/conf:
Bernhard Reutner-Fischer1dbe6e32007-08-21 17:56:47 +0000365 @mkdir -p $(CONFIG)/buildroot-config
Bernhard Reutner-Fischerfb2c8fe2007-07-27 14:16:00 +0000366 $(MAKE) CC="$(HOSTCC)" -C $(CONFIG) conf
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000367 -@if [ ! -f .config ]; then \
Eric Andersen2d523c22004-10-09 01:06:03 +0000368 cp $(CONFIG_DEFCONFIG) .config; \
369 fi
370$(CONFIG)/mconf:
Bernhard Reutner-Fischer1dbe6e32007-08-21 17:56:47 +0000371 @mkdir -p $(CONFIG)/buildroot-config
Bernhard Reutner-Fischerfb2c8fe2007-07-27 14:16:00 +0000372 $(MAKE) CC="$(HOSTCC)" -C $(CONFIG) conf mconf
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000373 -@if [ ! -f .config ]; then \
Eric Andersen2d523c22004-10-09 01:06:03 +0000374 cp $(CONFIG_DEFCONFIG) .config; \
375 fi
376
377menuconfig: $(CONFIG)/mconf
Bernhard Reutner-Fischer7b403ad2007-08-21 11:25:30 +0000378 @mkdir -p $(CONFIG)/buildroot-config
Bernhard Reutner-Fischer153b1be2007-07-27 12:37:30 +0000379 @if ! KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
"Steven J. Hill"62b5ae42007-07-18 18:07:19 +0000380 KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
Bernhard Reutner-Fischer153b1be2007-07-27 12:37:30 +0000381 $(CONFIG)/mconf $(CONFIG_CONFIG_IN); then \
382 test -f .config.cmd || rm -f .config; \
383 fi
Eric Andersen2d523c22004-10-09 01:06:03 +0000384
385config: $(CONFIG)/conf
Bernhard Reutner-Fischer7b403ad2007-08-21 11:25:30 +0000386 @mkdir -p $(CONFIG)/buildroot-config
"Steven J. Hill"62b5ae42007-07-18 18:07:19 +0000387 @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
388 KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
Bernhard Reutner-Fischerf987b7a2007-07-08 00:00:17 +0000389 $(CONFIG)/conf $(CONFIG_CONFIG_IN)
Eric Andersen2d523c22004-10-09 01:06:03 +0000390
391oldconfig: $(CONFIG)/conf
Bernhard Reutner-Fischer7b403ad2007-08-21 11:25:30 +0000392 @mkdir -p $(CONFIG)/buildroot-config
"Steven J. Hill"62b5ae42007-07-18 18:07:19 +0000393 @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
394 KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
Bernhard Reutner-Fischerf987b7a2007-07-08 00:00:17 +0000395 $(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
Eric Andersen2d523c22004-10-09 01:06:03 +0000396
397randconfig: $(CONFIG)/conf
Bernhard Reutner-Fischer7b403ad2007-08-21 11:25:30 +0000398 @mkdir -p $(CONFIG)/buildroot-config
"Steven J. Hill"62b5ae42007-07-18 18:07:19 +0000399 @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
400 KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
Bernhard Reutner-Fischerf987b7a2007-07-08 00:00:17 +0000401 $(CONFIG)/conf -r $(CONFIG_CONFIG_IN)
Eric Andersen2d523c22004-10-09 01:06:03 +0000402
403allyesconfig: $(CONFIG)/conf
Bernhard Reutner-Fischerf987b7a2007-07-08 00:00:17 +0000404 cat $(CONFIG_DEFCONFIG) > .config
Bernhard Reutner-Fischer7b403ad2007-08-21 11:25:30 +0000405 @mkdir -p $(CONFIG)/buildroot-config
"Steven J. Hill"62b5ae42007-07-18 18:07:19 +0000406 @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
407 KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
Bernhard Reutner-Fischerf987b7a2007-07-08 00:00:17 +0000408 $(CONFIG)/conf -y $(CONFIG_CONFIG_IN)
Eric Andersen2d523c22004-10-09 01:06:03 +0000409 #sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config
Eric Andersen2d523c22004-10-09 01:06:03 +0000410
411allnoconfig: $(CONFIG)/conf
Bernhard Reutner-Fischer7b403ad2007-08-21 11:25:30 +0000412 @mkdir -p $(CONFIG)/buildroot-config
"Steven J. Hill"62b5ae42007-07-18 18:07:19 +0000413 @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
414 KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
Bernhard Reutner-Fischerf987b7a2007-07-08 00:00:17 +0000415 $(CONFIG)/conf -n $(CONFIG_CONFIG_IN)
Eric Andersen2d523c22004-10-09 01:06:03 +0000416
417defconfig: $(CONFIG)/conf
Bernhard Reutner-Fischer7b403ad2007-08-21 11:25:30 +0000418 @mkdir -p $(CONFIG)/buildroot-config
"Steven J. Hill"62b5ae42007-07-18 18:07:19 +0000419 @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
420 KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
Bernhard Reutner-Fischerf987b7a2007-07-08 00:00:17 +0000421 $(CONFIG)/conf -d $(CONFIG_CONFIG_IN)
Eric Andersen2d523c22004-10-09 01:06:03 +0000422
Bernhard Reutner-Fischer6547bce2007-08-22 12:35:41 +0000423# check if download URLs are outdated
Bernhard Reutner-Fischer825ff342007-06-07 12:57:03 +0000424source-check: allyesconfig
425 $(MAKE) _source-check
426
Eric Andersen2d523c22004-10-09 01:06:03 +0000427#############################################################
428#
429# Cleanup and misc junk
430#
431#############################################################
432clean:
433 rm -f .config .config.old .config.cmd .tmpconfig.h
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000434 -$(MAKE) -C $(CONFIG) clean
Eric Andersen2d523c22004-10-09 01:06:03 +0000435
436distclean: clean
437 rm -rf sources/*
438
Bernhard Reutner-Fischercfe511b2007-09-29 13:58:30 +0000439endif # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
Eric Andersen2d523c22004-10-09 01:06:03 +0000440
Bernhard Reutner-Fischerba2e7e02007-06-25 10:56:13 +0000441%_defconfig: $(CONFIG)/conf
442 cp $(shell find ./target/ -name $@) .config
Ulf Samuelsson8820d632007-09-23 14:36:04 +0000443 -@$(MAKE) oldconfig
Bernhard Reutner-Fischerba2e7e02007-06-25 10:56:13 +0000444
Ulf Samuelsson5459a9c2007-09-28 19:43:26 +0000445configured: dirs host-sed kernel-headers uclibc-config busybox-config linux26-config
Ulf Samuelssonb8f28d62007-09-28 16:18:16 +0000446
447cross: $(BASE_TARGETS)
448
Bernhard Reutner-Fischere491fba2007-07-08 12:20:58 +0000449help:
450 @echo 'Cleaning:'
451 @echo ' clean - delete temporary files created by build'
452 @echo ' distclean - delete all non-source files (including .config)'
453 @echo
454 @echo 'Build:'
455 @echo ' all - make world'
456 @echo
457 @echo 'Configuration:'
458 @echo ' menuconfig - interactive curses-based configurator'
459 @echo ' oldconfig - resolve any unresolved symbols in .config'
460 @echo
461 @echo 'Miscellaneous:'
462 @echo ' source - download all sources needed for offline-build'
Bernhard Reutner-Fischer03380402007-08-21 10:42:05 +0000463 @echo ' source-check - check all packages for valid download URLs'
Bernhard Reutner-Fischere491fba2007-07-08 12:20:58 +0000464 @echo
Bernhard Reutner-Fischer232fa7e2007-08-27 21:51:27 +0000465 @echo 'See docs/README and docs/buildroot.html for further details'
Bernhard Reutner-Fischer663dee42007-08-27 21:40:42 +0000466 @echo
Bernhard Reutner-Fischerba2e7e02007-06-25 10:56:13 +0000467
Eric Andersen2d523c22004-10-09 01:06:03 +0000468.PHONY: dummy subdirs release distclean clean config oldconfig \
Bernhard Reutner-Fischere491fba2007-07-08 12:20:58 +0000469 menuconfig tags check test depend defconfig help
Ulf Samuelsson633c8cb2007-09-17 12:49:46 +0000470