blob: d4340d5385ad50cc3533422c26c1384639b0d596 [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
Eric Andersen2d523c22004-10-09 01:06:03 +000034
Ulf Samuelssona1b06512008-03-28 07:31:28 +000035# Use shell variables, if defined
Ulf Samuelsson7521f372007-09-12 04:34:16 +000036ifneq ($(BUILDROOT_LOCAL),)
Ulf Samuelssonefd85762008-03-30 06:38:46 +000037BR2_LOCAL:=$(BUILDROOT_LOCAL)
Ulf Samuelsson7521f372007-09-12 04:34:16 +000038else
Ulf Samuelssonefd85762008-03-30 06:38:46 +000039BR2_LOCAL:=$(TOPDIR)/local
Ulf Samuelssona1b06512008-03-28 07:31:28 +000040endif
41
42# $(shell find . -name *_defconfig |sed 's/.*\///')
43# Pull in the user's configuration file
44ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
45ifeq ($(BOARD),)
46# if "make BOARD=xyz" command
47-include $(TOPDIR).config
48else
49# if "make" command
Ulf Samuelssonefd85762008-03-30 06:38:46 +000050-include $(BR2_LOCAL)/$(BOARD)/$(BOARD).config
Ulf Samuelssona1b06512008-03-28 07:31:28 +000051endif
Ulf Samuelsson7521f372007-09-12 04:34:16 +000052endif
Eric Andersen2d523c22004-10-09 01:06:03 +000053
Ulf Samuelssonefd85762008-03-30 06:38:46 +000054# Override BR2_DL_DIR if shell variable defined
55ifneq ($(BUILDROOT_DL_DIR),)
56BR2_DL_DIR:=$(BUILDROOT_DL_DIR)
57endif
58LOCAL:=$(BR2_LOCAL)
59
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +000060# To put more focus on warnings, be less verbose as default
61# Use 'make V=1' to see the full commands
62ifdef V
63 ifeq ("$(origin V)", "command line")
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +000064 KBUILD_VERBOSE=$(V)
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +000065 endif
66endif
67ifndef KBUILD_VERBOSE
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +000068 KBUILD_VERBOSE=0
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +000069endif
70
71ifeq ($(KBUILD_VERBOSE),1)
Ulf Samuelsson4df454e2007-07-06 12:19:35 +000072 quiet=
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +000073 Q=
Bernhard Reutner-Fischer1669b6e2007-09-22 14:19:22 +000074ifndef VERBOSE
75 VERBOSE=1
76endif
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +000077else
78 quiet=quiet_
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +000079 Q=@
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +000080endif
81
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +000082CONFIG_SHELL:=$(shell if [ -x "$$BASH" ]; then echo $$BASH; \
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +000083 else if [ -x /bin/bash ]; then echo /bin/bash; \
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +000084 else echo sh; fi; fi)
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +000085
Bernhard Reutner-Fischer1669b6e2007-09-22 14:19:22 +000086export CONFIG_SHELL quiet Q KBUILD_VERBOSE VERBOSE
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +000087
88ifndef HOSTAR
89HOSTAR:=ar
90endif
91ifndef HOSTAS
92HOSTAS:=as
93endif
94ifndef HOSTCC
95HOSTCC:=gcc
96else
97endif
98ifndef HOSTCXX
99HOSTCXX:=g++
100endif
Bernhard Reutner-Fischer5f975802007-09-28 20:10:22 +0000101ifndef HOSTFC
102HOSTFC:=gfortran
103endif
Ulf Samuelsson356133b2007-09-28 19:46:58 +0000104ifndef HOSTCPP
105HOSTCPP:=cpp
106endif
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +0000107ifndef HOSTLD
108HOSTLD:=ld
109endif
Ulf Samuelsson0f9c5b12007-07-15 21:54:11 +0000110ifndef HOSTLN
111HOSTLN:=ln
112endif
Ulf Samuelsson356133b2007-09-28 19:46:58 +0000113ifndef HOSTNM
114HOSTNM:=nm
115endif
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000116HOSTAR:=$(shell $(CONFIG_SHELL) -c "which $(HOSTAR)" || type -p $(HOSTAR) || echo ar)
117HOSTAS:=$(shell $(CONFIG_SHELL) -c "which $(HOSTAS)" || type -p $(HOSTAS) || echo as)
118HOSTCC:=$(shell $(CONFIG_SHELL) -c "which $(HOSTCC)" || type -p $(HOSTCC) || echo gcc)
Ulf Samuelsson83832cd2007-07-09 04:26:49 +0000119HOSTCXX:=$(shell $(CONFIG_SHELL) -c "which $(HOSTCXX)" || type -p $(HOSTCXX) || echo g++)
Bernhard Reutner-Fischer5f975802007-09-28 20:10:22 +0000120HOSTFC:=$(shell $(CONFIG_SHELL) -c "which $(HOSTLD)" || type -p $(HOSTLD) || echo || which g77 || type -p g77 || echo gfortran)
Ulf Samuelsson356133b2007-09-28 19:46:58 +0000121HOSTCPP:=$(shell $(CONFIG_SHELL) -c "which $(HOSTCPP)" || type -p $(HOSTCPP) || echo cpp)
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000122HOSTLD:=$(shell $(CONFIG_SHELL) -c "which $(HOSTLD)" || type -p $(HOSTLD) || echo ld)
123HOSTLN:=$(shell $(CONFIG_SHELL) -c "which $(HOSTLN)" || type -p $(HOSTLN) || echo ln)
Ulf Samuelsson356133b2007-09-28 19:46:58 +0000124HOSTNM:=$(shell $(CONFIG_SHELL) -c "which $(HOSTNM)" || type -p $(HOSTNM) || echo nm)
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +0000125ifndef CFLAGS_FOR_BUILD
Bernhard Reutner-Fischerf987b7a2007-07-08 00:00:17 +0000126CFLAGS_FOR_BUILD:=-g -O2
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +0000127endif
Bernhard Reutner-Fischer5f975802007-09-28 20:10:22 +0000128ifndef CXXFLAGS_FOR_BUILD
129CXXFLAGS_FOR_BUILD:=-g -O2
130endif
131ifndef FCFLAGS_FOR_BUILD
132FCFLAGS_FOR_BUILD:=-g -O2
133endif
134export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD
Bernhard Reutner-Fischerafc61c62007-06-28 10:47:05 +0000135
136
Bernhard Reutner-Fischercfe511b2007-09-29 13:58:30 +0000137ifeq ($(BR2_HAVE_DOT_CONFIG),y)
Eric Andersenffde94b2001-12-22 00:56:11 +0000138
Bernhard Reutner-Fischer99cf7292007-02-12 13:38:06 +0000139# cc-option
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000140# Usage: cflags-y+=$(call cc-option, -march=winchip-c6, -march=i586)
Bernhard Reutner-Fischer99cf7292007-02-12 13:38:06 +0000141# sets -march=winchip-c6 if supported else falls back to -march=i586
142# without checking the latter.
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000143cc-option=$(shell if $(TARGET_CC) $(TARGET_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
Bernhard Reutner-Fischer99cf7292007-02-12 13:38:06 +0000144 > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
145
Peter Korsgaard2c649042007-06-19 15:19:27 +0000146#############################################################
147#
148# Hide troublesome environment variables from sub processes
149#
150#############################################################
151unexport CROSS_COMPILE
152unexport ARCH
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000153
154#############################################################
155#
Bernhard Reutner-Fischerc6e43c92007-06-02 11:22:17 +0000156# Setup the proper filename extensions for the host
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000157#
158##############################################################
159ifneq ($(findstring linux,$(BR2_GNU_BUILD_SUFFIX)),)
Bernhard Reutner-Fischerc6e43c92007-06-02 11:22:17 +0000160HOST_EXEEXT:=
161HOST_LIBEXT:=.a
162HOST_SHREXT:=.so
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000163endif
164ifneq ($(findstring apple,$(BR2_GNU_BUILD_SUFFIX)),)
Bernhard Reutner-Fischerc6e43c92007-06-02 11:22:17 +0000165HOST_EXEEXT:=
166HOST_LIBEXT:=.a
167HOST_SHREXT:=.dylib
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000168endif
169ifneq ($(findstring cygwin,$(BR2_GNU_BUILD_SUFFIX)),)
Bernhard Reutner-Fischerc6e43c92007-06-02 11:22:17 +0000170HOST_EXEEXT:=.exe
171HOST_LIBEXT:=.lib
172HOST_SHREXT:=.dll
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000173endif
174ifneq ($(findstring mingw,$(BR2_GNU_BUILD_SUFFIX)),)
Bernhard Reutner-Fischerc6e43c92007-06-02 11:22:17 +0000175HOST_EXEEXT:=.exe
176HOST_LIBEXT:=.lib
177HOST_SHREXT:=.dll
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000178endif
179
Bernhard Reutner-Fischerc6e43c92007-06-02 11:22:17 +0000180# The preferred type of libs we build for the target
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000181ifeq ($(BR2_PREFER_STATIC_LIB),y)
Bernhard Reutner-Fischerc6e43c92007-06-02 11:22:17 +0000182LIBTGTEXT=.a
Bernhard Reutner-Fischer80277842007-06-20 11:26:36 +0000183#PREFERRED_LIB_FLAGS:=--disable-shared --enable-static
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000184else
Bernhard Reutner-Fischerc6e43c92007-06-02 11:22:17 +0000185LIBTGTEXT=.so
Bernhard Reutner-Fischer80277842007-06-20 11:26:36 +0000186#PREFERRED_LIB_FLAGS:=--disable-static --enable-shared
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000187endif
Bernhard Reutner-Fischer80277842007-06-20 11:26:36 +0000188PREFERRED_LIB_FLAGS:=--enable-static --enable-shared
Bernhard Reutner-Fischer7dcbbfb2007-06-02 09:05:40 +0000189
Bernhard Reutner-Fischer6ad07202007-07-31 15:02:06 +0000190##############################################################
Eric Andersen08782ae2002-04-26 11:45:55 +0000191#
Eric Andersen2d523c22004-10-09 01:06:03 +0000192# The list of stuff to build for the target toolchain
193# along with the packages to build for the target.
Eric Andersen08782ae2002-04-26 11:45:55 +0000194#
Eric Andersen2d523c22004-10-09 01:06:03 +0000195##############################################################
Bernhard Reutner-Fischer4b0d5a82007-09-26 21:12:38 +0000196ifeq ($(BR2_TOOLCHAIN_SOURCE),y)
Peter Korsgaard3d8919a2008-03-04 12:19:19 +0000197BASE_TARGETS:=uclibc-configured binutils cross_compiler uclibc-target-utils kernel-headers
"Steven J. Hill"02f71aa2007-02-06 18:19:38 +0000198else
Bernhard Reutner-Fischeracc706b2007-07-23 11:29:38 +0000199BASE_TARGETS:=uclibc
"Steven J. Hill"02f71aa2007-02-06 18:19:38 +0000200endif
Bernhard Reutner-Fischeracc706b2007-07-23 11:29:38 +0000201TARGETS:=
202
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000203# setup our pathes
Ulf Samuelssonf958d892007-08-14 07:45:01 +0000204include project/Makefile.in
Bernhard Reutner-Fischer1dbe6e32007-08-21 17:56:47 +0000205
206BR2_DEPENDS_DIR=$(PROJECT_BUILD_DIR)/buildroot-config
207
Eric Andersen2d523c22004-10-09 01:06:03 +0000208include toolchain/Makefile.in
Eric Andersen2d523c22004-10-09 01:06:03 +0000209include package/Makefile.in
Eric Andersen27bc59d2003-01-17 04:31:36 +0000210
Eric Andersen08782ae2002-04-26 11:45:55 +0000211#############################################################
212#
Eric Andersenef407d32004-01-29 23:21:00 +0000213# You should probably leave this stuff alone unless you know
Eric Andersen08782ae2002-04-26 11:45:55 +0000214# what you are doing.
215#
216#############################################################
Manuel Novoa III d632d422003-11-01 05:34:41 +0000217
Bernhard Reutner-Fischer6547bce2007-08-22 12:35:41 +0000218all: world
Eric Andersenffde94b2001-12-22 00:56:11 +0000219
Eric Andersen2d523c22004-10-09 01:06:03 +0000220# In this section, we need .config
221include .config.cmd
222
Ulf Samuelssonf958d892007-08-14 07:45:01 +0000223include project/*.mk
224
Eric Andersend06645d2005-02-10 03:06:39 +0000225# We also need the various per-package makefiles, which also add
226# each selected package to TARGETS if that package was selected
227# in the .config file.
Bernhard Reutner-Fischer4b0d5a82007-09-26 21:12:38 +0000228ifeq ($(BR2_TOOLCHAIN_SOURCE),y)
Bernhard Reutner-Fischeracc706b2007-07-23 11:29:38 +0000229# avoid pulling in external toolchain which is broken for toplvl parallel builds
Bernhard Reutner-Fischer57310ec2007-09-27 21:24:15 +0000230# Explicit ordering:
231include toolchain/dependencies/dependencies.mk
232include toolchain/binutils/binutils.mk
233include toolchain/ccache/ccache.mk
234include toolchain/elf2flt/elf2flt.mk
235include toolchain/gcc/gcc-uclibc-3.x.mk
236include toolchain/gcc/gcc-uclibc-4.x.mk
237include toolchain/gdb/gdb.mk
238include toolchain/kernel-headers/kernel-headers.mk
239include toolchain/mklibs/mklibs.mk
240include toolchain/sstrip/sstrip.mk
241include toolchain/uClibc/uclibc.mk
Bernhard Reutner-Fischeracc706b2007-07-23 11:29:38 +0000242else
Eric Andersend06645d2005-02-10 03:06:39 +0000243include toolchain/*/*.mk
Bernhard Reutner-Fischeracc706b2007-07-23 11:29:38 +0000244endif
245
"Steven J. Hill"62b5ae42007-07-18 18:07:19 +0000246ifeq ($(BR2_PACKAGE_LINUX),y)
247TARGETS+=linux26-modules
248endif
Bernhard Reutner-Fischeracc706b2007-07-23 11:29:38 +0000249
Eric Andersend06645d2005-02-10 03:06:39 +0000250include package/*/*.mk
Eric Andersend06645d2005-02-10 03:06:39 +0000251
John Voltzd45de0c2008-03-11 13:12:39 +0000252TARGETS+=target-devfiles
253
Eric Andersen79f5f1e2005-02-17 03:00:29 +0000254# target stuff is last so it can override anything else
255include target/Makefile.in
256
John Voltzd45de0c2008-03-11 13:12:39 +0000257TARGETS+=erase-fakeroots
Ulf Samuelssonc2fc93b2007-08-15 09:47:49 +0000258
Eric Andersen08782ae2002-04-26 11:45:55 +0000259TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
Bernhard Reutner-Fischer3b08e642007-09-18 13:12:25 +0000260TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS) $(BASE_TARGETS))
Eric Andersen08782ae2002-04-26 11:45:55 +0000261TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
Bernhard Reutner-Fischerb3efde22007-09-01 17:10:55 +0000262TARGETS_ALL:=$(patsubst %,__real_tgt_%,$(TARGETS))
Bernhard Reutner-Fischeracc706b2007-07-23 11:29:38 +0000263# all targets depend on the crosscompiler and it's prerequisites
Bernhard Reutner-Fischerb3efde22007-09-01 17:10:55 +0000264$(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) %
Bernhard Reutner-Fischeracc706b2007-07-23 11:29:38 +0000265
Bernhard Reutner-Fischer1dbe6e32007-08-21 17:56:47 +0000266$(BR2_DEPENDS_DIR): .config
267 rm -rf $@
Bernhard Reutner-Fischerb3efde22007-09-01 17:10:55 +0000268 mkdir -p $(@D)
Bernhard Reutner-Fischer1dbe6e32007-08-21 17:56:47 +0000269 cp -dpRf $(CONFIG)/buildroot-config $@
270
Bernhard Reutner-Fischer5ef9e522007-07-27 14:57:34 +0000271dirs: $(DL_DIR) $(TOOL_BUILD_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
Bernhard Reutner-Fischer1dbe6e32007-08-21 17:56:47 +0000272 $(BR2_DEPENDS_DIR) \
Bernhard Reutner-Fischer5ef9e522007-07-27 14:57:34 +0000273 $(BINARIES_DIR) $(PROJECT_BUILD_DIR)
Ulf Samuelssonf958d892007-08-14 07:45:01 +0000274
Bernhard Reutner-Fischer5ef9e522007-07-27 14:57:34 +0000275$(BASE_TARGETS): dirs
Ulf Samuelssonf958d892007-08-14 07:45:01 +0000276
Bernhard Reutner-Fischerb3efde22007-09-01 17:10:55 +0000277world: dependencies dirs target-host-info $(BASE_TARGETS) $(TARGETS_ALL)
Eric Andersenffde94b2001-12-22 00:56:11 +0000278
Bernhard Reutner-Fischer5ef9e522007-07-27 14:57:34 +0000279
Ulf Samuelssonf958d892007-08-14 07:45:01 +0000280.PHONY: all world dirs clean dirclean distclean source \
Bernhard Reutner-Fischerb3efde22007-09-01 17:10:55 +0000281 $(BASE_TARGETS) $(TARGETS) $(TARGETS_ALL) \
Eric Andersen747b16d2004-12-11 10:33:19 +0000282 $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \
Bernhard Reutner-Fischer5ef9e522007-07-27 14:57:34 +0000283 $(DL_DIR) $(TOOL_BUILD_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
Bernhard Reutner-Fischer1dbe6e32007-08-21 17:56:47 +0000284 $(BR2_DEPENDS_DIR) \
Bernhard Reutner-Fischer5ef9e522007-07-27 14:57:34 +0000285 $(BINARIES_DIR) $(PROJECT_BUILD_DIR)
Jon Nelsonc79e9982002-01-05 20:26:15 +0000286
Eric Andersen08782ae2002-04-26 11:45:55 +0000287#############################################################
288#
Eric Andersenef407d32004-01-29 23:21:00 +0000289# staging and target directories do NOT list these as
Mike Frysingerd99c31c2006-05-26 01:18:09 +0000290# dependencies anywhere else
Eric Andersen08782ae2002-04-26 11:45:55 +0000291#
292#############################################################
Bernhard Reutner-Fischer5ef9e522007-07-27 14:57:34 +0000293$(DL_DIR) $(TOOL_BUILD_DIR) $(BUILD_DIR) \
Ulf Samuelssonc6771df2007-08-16 05:44:55 +0000294 $(PROJECT_BUILD_DIR) $(BINARIES_DIR):
Bernhard Reutner-Fischer8d583fc2007-01-30 00:58:18 +0000295 @mkdir -p $@
Manuel Novoa III 3ad3d8a2004-09-03 00:49:43 +0000296
Eric Andersen08782ae2002-04-26 11:45:55 +0000297$(STAGING_DIR):
"Steven J. Hill"9c865d72007-05-07 03:56:47 +0000298 @mkdir -p $(STAGING_DIR)/bin
Eric Andersenbf387232004-12-11 10:35:18 +0000299 @mkdir -p $(STAGING_DIR)/lib
Bernhard Reutner-Fischer7e0c8902007-06-24 12:27:08 +0000300ifeq ($(BR2_TOOLCHAIN_SYSROOT),y)
Bernhard Reutner-Fischer80277842007-06-20 11:26:36 +0000301 @mkdir -p $(STAGING_DIR)/usr/lib
302else
Ulf Samuelssonf5905dc2007-10-07 18:23:43 +0000303ifneq ($(BR2_TOOLCHAIN_EXTERNAL),y)
Bernhard Reutner-Fischer80277842007-06-20 11:26:36 +0000304 @ln -snf . $(STAGING_DIR)/usr
305 @mkdir -p $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)
Eric Andersen3da708e2007-01-10 06:55:27 +0000306 @ln -snf ../lib $(STAGING_DIR)/usr/lib
Bernhard Reutner-Fischer80277842007-06-20 11:26:36 +0000307 @ln -snf ../lib $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/lib
308endif
Ulf Samuelssonf5905dc2007-10-07 18:23:43 +0000309endif
Bernhard Reutner-Fischer80277842007-06-20 11:26:36 +0000310 @mkdir -p $(STAGING_DIR)/usr/include
Eric Andersen08782ae2002-04-26 11:45:55 +0000311
Ulf Samuelssonc6771df2007-08-16 05:44:55 +0000312$(PROJECT_BUILD_DIR)/.root:
Bernhard Reutner-Fischer7547c7e2007-08-21 10:53:39 +0000313 mkdir -p $(TARGET_DIR)
Bernhard Reutner-Fischerf0ca4b82007-08-21 10:56:38 +0000314 if ! [ -d "$(TARGET_DIR)/bin" ]; then \
315 if [ -d "$(TARGET_SKELETON)" ]; then \
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000316 cp -fa $(TARGET_SKELETON)/* $(TARGET_DIR)/; \
Ulf Samuelsson74cda1e2007-08-14 07:24:45 +0000317 fi; \
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000318 touch $(STAGING_DIR)/.fakeroot.00000; \
Bernhard Reutner-Fischerf0ca4b82007-08-21 10:56:38 +0000319 fi
Peter Korsgaarde0137732008-03-30 20:52:33 +0000320 -find $(TARGET_DIR) -type d -name CVS -o -name .svn | xargs rm -rf
Peter Korsgaard6a262b12008-03-30 20:48:13 +0000321 -find $(TARGET_DIR) -type f -name .empty | xargs rm -rf
Bernhard Reutner-Fischer7547c7e2007-08-21 10:53:39 +0000322 touch $@
Eric Andersenffde94b2001-12-22 00:56:11 +0000323
Bernhard Reutner-Fischer1dbe6e32007-08-21 17:56:47 +0000324$(TARGET_DIR): $(PROJECT_BUILD_DIR)/.root
Ulf Samuelssonc6771df2007-08-16 05:44:55 +0000325
Ulf Samuelssonc2fc93b2007-08-15 09:47:49 +0000326erase-fakeroots:
Ulf Samuelsson5d2be042007-08-16 18:19:42 +0000327 rm -f $(PROJECT_BUILD_DIR)/.fakeroot*
Ulf Samuelsson412ca2a2007-07-12 13:11:03 +0000328
John Voltzbc67ca22008-03-10 15:22:43 +0000329target-devfiles:
John Voltzd45de0c2008-03-11 13:12:39 +0000330ifeq ($(BR2_HAVE_DEVFILES),y)
331 ( scripts/copy.sh $(STAGING_DIR) $(TARGET_DIR) )
John Voltzbc67ca22008-03-10 15:22:43 +0000332else
333 rm -rf $(TARGET_DIR)/usr/include
John Voltzd45de0c2008-03-11 13:12:39 +0000334 find $(TARGET_DIR)/usr/lib -name '*.a' -delete
335 find $(TARGET_DIR)/lib -name '*.a' -delete
336 find $(TARGET_DIR)/usr/lib -name '*.la' -delete
337 find $(TARGET_DIR)/lib -name '*.la' -delete
John Voltzbc67ca22008-03-10 15:22:43 +0000338endif
339
Bernhard Reutner-Fischer3b08e642007-09-18 13:12:25 +0000340source: $(TARGETS_SOURCE) $(HOST_SOURCE)
Eric Andersenffde94b2001-12-22 00:56:11 +0000341
Bernhard Reutner-Fischer6547bce2007-08-22 12:35:41 +0000342_source-check:
Ulf Samuelssone7c08c22007-07-20 07:34:28 +0000343 $(MAKE) SPIDER=--spider source
Bernhard Reutner-Fischer825ff342007-06-07 12:57:03 +0000344
Peter Korsgaard155971e2008-03-04 12:19:16 +0000345external-deps:
346 @$(MAKE) -Bs BR2_WGET=$(TOPDIR)toolchain/wget-show-external-deps.sh \
347 source
348
Eric Andersen08782ae2002-04-26 11:45:55 +0000349#############################################################
350#
351# Cleanup and misc junk
352#
353#############################################################
354clean: $(TARGETS_CLEAN)
Manuel Novoa III 3ad3d8a2004-09-03 00:49:43 +0000355 rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE)
Eric Andersenffde94b2001-12-22 00:56:11 +0000356
Eric Andersen08782ae2002-04-26 11:45:55 +0000357dirclean: $(TARGETS_DIRCLEAN)
Manuel Novoa III 3ad3d8a2004-09-03 00:49:43 +0000358 rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE)
Eric Andersenffde94b2001-12-22 00:56:11 +0000359
Eric Andersen08782ae2002-04-26 11:45:55 +0000360distclean:
Mike Frysinger5bc1f0c2005-09-09 02:49:10 +0000361ifeq ($(DL_DIR),$(BASE_DIR)/dl)
362 rm -rf $(DL_DIR)
363endif
Bernhard Reutner-Fischer6547bce2007-08-22 12:35:41 +0000364 rm -rf $(BUILD_DIR) $(PROJECT_BUILD_DIR) $(BINARIES_DIR) \
Ulf Samuelsson412ca2a2007-07-12 13:11:03 +0000365 $(LINUX_KERNEL) $(IMAGE) $(BASE_DIR)/include \
Bernhard Reutner-Fischer81df2262007-07-09 08:06:27 +0000366 .config.cmd
Bernhard Reutner-Fischerb5136192007-01-19 18:00:49 +0000367 $(MAKE) -C $(CONFIG) clean
Eric Andersenffde94b2001-12-22 00:56:11 +0000368
Manuel Novoa III 3ad3d8a2004-09-03 00:49:43 +0000369sourceball:
Bernhard Reutner-Fischer6547bce2007-08-22 12:35:41 +0000370 rm -rf $(BUILD_DIR) $(PROJECT_BUILD_DIR) $(BINARIES_DIR)
Eric Andersen08782ae2002-04-26 11:45:55 +0000371 set -e; \
372 cd ..; \
373 rm -f buildroot.tar.bz2; \
374 tar -cvf buildroot.tar buildroot; \
375 bzip2 -9 buildroot.tar; \
Eric Andersen2d523c22004-10-09 01:06:03 +0000376
377
Bernhard Reutner-Fischercfe511b2007-09-29 13:58:30 +0000378else # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
Eric Andersen2d523c22004-10-09 01:06:03 +0000379
380all: menuconfig
381
382# configuration
383# ---------------------------------------------------------------------------
384
Bernhard Reutner-Fischerc0d7d4e2007-07-09 18:23:20 +0000385HOSTCFLAGS=$(CFLAGS_FOR_BUILD)
386export HOSTCFLAGS
387
Eric Andersen2d523c22004-10-09 01:06:03 +0000388$(CONFIG)/conf:
Bernhard Reutner-Fischer1dbe6e32007-08-21 17:56:47 +0000389 @mkdir -p $(CONFIG)/buildroot-config
Bernhard Reutner-Fischerfb2c8fe2007-07-27 14:16:00 +0000390 $(MAKE) CC="$(HOSTCC)" -C $(CONFIG) conf
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000391 -@if [ ! -f .config ]; then \
Eric Andersen2d523c22004-10-09 01:06:03 +0000392 cp $(CONFIG_DEFCONFIG) .config; \
393 fi
394$(CONFIG)/mconf:
Bernhard Reutner-Fischer1dbe6e32007-08-21 17:56:47 +0000395 @mkdir -p $(CONFIG)/buildroot-config
Bernhard Reutner-Fischerfb2c8fe2007-07-27 14:16:00 +0000396 $(MAKE) CC="$(HOSTCC)" -C $(CONFIG) conf mconf
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000397 -@if [ ! -f .config ]; then \
Eric Andersen2d523c22004-10-09 01:06:03 +0000398 cp $(CONFIG_DEFCONFIG) .config; \
399 fi
400
401menuconfig: $(CONFIG)/mconf
Bernhard Reutner-Fischer7b403ad2007-08-21 11:25:30 +0000402 @mkdir -p $(CONFIG)/buildroot-config
Bernhard Reutner-Fischer153b1be2007-07-27 12:37:30 +0000403 @if ! KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
"Steven J. Hill"62b5ae42007-07-18 18:07:19 +0000404 KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
Bernhard Reutner-Fischer153b1be2007-07-27 12:37:30 +0000405 $(CONFIG)/mconf $(CONFIG_CONFIG_IN); then \
406 test -f .config.cmd || rm -f .config; \
407 fi
Eric Andersen2d523c22004-10-09 01:06:03 +0000408
409config: $(CONFIG)/conf
Bernhard Reutner-Fischer7b403ad2007-08-21 11:25:30 +0000410 @mkdir -p $(CONFIG)/buildroot-config
"Steven J. Hill"62b5ae42007-07-18 18:07:19 +0000411 @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
412 KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
Bernhard Reutner-Fischerf987b7a2007-07-08 00:00:17 +0000413 $(CONFIG)/conf $(CONFIG_CONFIG_IN)
Eric Andersen2d523c22004-10-09 01:06:03 +0000414
415oldconfig: $(CONFIG)/conf
Bernhard Reutner-Fischer7b403ad2007-08-21 11:25:30 +0000416 @mkdir -p $(CONFIG)/buildroot-config
"Steven J. Hill"62b5ae42007-07-18 18:07:19 +0000417 @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
418 KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
Bernhard Reutner-Fischerf987b7a2007-07-08 00:00:17 +0000419 $(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
Eric Andersen2d523c22004-10-09 01:06:03 +0000420
421randconfig: $(CONFIG)/conf
Bernhard Reutner-Fischer7b403ad2007-08-21 11:25:30 +0000422 @mkdir -p $(CONFIG)/buildroot-config
"Steven J. Hill"62b5ae42007-07-18 18:07:19 +0000423 @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
424 KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
Bernhard Reutner-Fischerf987b7a2007-07-08 00:00:17 +0000425 $(CONFIG)/conf -r $(CONFIG_CONFIG_IN)
Eric Andersen2d523c22004-10-09 01:06:03 +0000426
427allyesconfig: $(CONFIG)/conf
Bernhard Reutner-Fischerf987b7a2007-07-08 00:00:17 +0000428 cat $(CONFIG_DEFCONFIG) > .config
Bernhard Reutner-Fischer7b403ad2007-08-21 11:25:30 +0000429 @mkdir -p $(CONFIG)/buildroot-config
"Steven J. Hill"62b5ae42007-07-18 18:07:19 +0000430 @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
431 KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
Bernhard Reutner-Fischerf987b7a2007-07-08 00:00:17 +0000432 $(CONFIG)/conf -y $(CONFIG_CONFIG_IN)
Eric Andersen2d523c22004-10-09 01:06:03 +0000433 #sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config
Eric Andersen2d523c22004-10-09 01:06:03 +0000434
435allnoconfig: $(CONFIG)/conf
Bernhard Reutner-Fischer7b403ad2007-08-21 11:25:30 +0000436 @mkdir -p $(CONFIG)/buildroot-config
"Steven J. Hill"62b5ae42007-07-18 18:07:19 +0000437 @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
438 KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
Bernhard Reutner-Fischerf987b7a2007-07-08 00:00:17 +0000439 $(CONFIG)/conf -n $(CONFIG_CONFIG_IN)
Eric Andersen2d523c22004-10-09 01:06:03 +0000440
441defconfig: $(CONFIG)/conf
Bernhard Reutner-Fischer7b403ad2007-08-21 11:25:30 +0000442 @mkdir -p $(CONFIG)/buildroot-config
"Steven J. Hill"62b5ae42007-07-18 18:07:19 +0000443 @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
444 KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
Bernhard Reutner-Fischerf987b7a2007-07-08 00:00:17 +0000445 $(CONFIG)/conf -d $(CONFIG_CONFIG_IN)
Eric Andersen2d523c22004-10-09 01:06:03 +0000446
Bernhard Reutner-Fischer6547bce2007-08-22 12:35:41 +0000447# check if download URLs are outdated
Bernhard Reutner-Fischer825ff342007-06-07 12:57:03 +0000448source-check: allyesconfig
449 $(MAKE) _source-check
450
Eric Andersen2d523c22004-10-09 01:06:03 +0000451#############################################################
452#
453# Cleanup and misc junk
454#
455#############################################################
456clean:
457 rm -f .config .config.old .config.cmd .tmpconfig.h
Bernhard Reutner-Fischer18d979c2007-09-01 18:21:09 +0000458 -$(MAKE) -C $(CONFIG) clean
Eric Andersen2d523c22004-10-09 01:06:03 +0000459
460distclean: clean
461 rm -rf sources/*
462
Bernhard Reutner-Fischercfe511b2007-09-29 13:58:30 +0000463endif # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
Eric Andersen2d523c22004-10-09 01:06:03 +0000464
Bernhard Reutner-Fischerba2e7e02007-06-25 10:56:13 +0000465%_defconfig: $(CONFIG)/conf
466 cp $(shell find ./target/ -name $@) .config
Ulf Samuelsson8820d632007-09-23 14:36:04 +0000467 -@$(MAKE) oldconfig
Bernhard Reutner-Fischerba2e7e02007-06-25 10:56:13 +0000468
Ulf Samuelsson82c92e12008-03-30 06:29:30 +0000469update:
470 cp .config $(BOARD_PATH)/$(BOARD_NAME)_defconfig
471
Ulf Samuelsson5459a9c2007-09-28 19:43:26 +0000472configured: dirs host-sed kernel-headers uclibc-config busybox-config linux26-config
Ulf Samuelssonb8f28d62007-09-28 16:18:16 +0000473
474cross: $(BASE_TARGETS)
475
Bernhard Reutner-Fischere491fba2007-07-08 12:20:58 +0000476help:
477 @echo 'Cleaning:'
478 @echo ' clean - delete temporary files created by build'
479 @echo ' distclean - delete all non-source files (including .config)'
480 @echo
481 @echo 'Build:'
482 @echo ' all - make world'
483 @echo
484 @echo 'Configuration:'
485 @echo ' menuconfig - interactive curses-based configurator'
486 @echo ' oldconfig - resolve any unresolved symbols in .config'
487 @echo
488 @echo 'Miscellaneous:'
489 @echo ' source - download all sources needed for offline-build'
Bernhard Reutner-Fischer03380402007-08-21 10:42:05 +0000490 @echo ' source-check - check all packages for valid download URLs'
Peter Korsgaard155971e2008-03-04 12:19:16 +0000491 @echo ' external-deps - list external packages used'
Bernhard Reutner-Fischere491fba2007-07-08 12:20:58 +0000492 @echo
Bernhard Reutner-Fischer232fa7e2007-08-27 21:51:27 +0000493 @echo 'See docs/README and docs/buildroot.html for further details'
Bernhard Reutner-Fischer663dee42007-08-27 21:40:42 +0000494 @echo
Bernhard Reutner-Fischerba2e7e02007-06-25 10:56:13 +0000495
Eric Andersen2d523c22004-10-09 01:06:03 +0000496.PHONY: dummy subdirs release distclean clean config oldconfig \
Bernhard Reutner-Fischere491fba2007-07-08 12:20:58 +0000497 menuconfig tags check test depend defconfig help
Ulf Samuelsson633c8cb2007-09-17 12:49:46 +0000498