blob: 045aa19ef85161656f4aef0c2c8934f09f38085a [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=./
25CONFIG_CONFIG_IN = Config.in
26CONFIG_DEFCONFIG = .defconfig
27CONFIG = package/config
28
29noconfig_targets := menuconfig config oldconfig randconfig \
30 defconfig allyesconfig allnoconfig clean distclean \
31 release tags
32
33# Pull in the user's configuration file
34ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
35-include $(TOPDIR).config
36endif
37
Eric Andersenbad64282004-10-09 21:12:25 +000038ifeq ($(BR2_TAR_VERBOSITY),y)
Eric Andersenbb05a9a2004-10-09 21:19:47 +000039TAR_OPTIONS=-xvf
Mike Frysinger1f41bb72004-10-09 18:58:04 +000040else
Eric Andersenbb05a9a2004-10-09 21:19:47 +000041TAR_OPTIONS=-xf
Mike Frysinger1f41bb72004-10-09 18:58:04 +000042endif
43
Eric Andersen2d523c22004-10-09 01:06:03 +000044ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
Eric Andersenffde94b2001-12-22 00:56:11 +000045
Eric Andersen08782ae2002-04-26 11:45:55 +000046#############################################################
47#
Eric Andersen2d523c22004-10-09 01:06:03 +000048# The list of stuff to build for the target toolchain
49# along with the packages to build for the target.
Eric Andersen08782ae2002-04-26 11:45:55 +000050#
Eric Andersen2d523c22004-10-09 01:06:03 +000051##############################################################
Manuel Novoa III 56239e42004-10-15 08:26:30 +000052TARGETS:=host-sed kernel-headers uclibc-configured binutils gcc uclibc-target-utils
Eric Andersen2d523c22004-10-09 01:06:03 +000053include toolchain/Makefile.in
Eric Andersen2d523c22004-10-09 01:06:03 +000054include package/Makefile.in
Eric Andersen27bc59d2003-01-17 04:31:36 +000055
Eric Andersen08782ae2002-04-26 11:45:55 +000056#############################################################
57#
Eric Andersenef407d32004-01-29 23:21:00 +000058# You should probably leave this stuff alone unless you know
Eric Andersen08782ae2002-04-26 11:45:55 +000059# what you are doing.
60#
61#############################################################
Manuel Novoa III d632d422003-11-01 05:34:41 +000062
Eric Andersencb7d5b82003-09-14 11:38:35 +000063
Eric Andersenffde94b2001-12-22 00:56:11 +000064
65all: world
66
Eric Andersen2d523c22004-10-09 01:06:03 +000067# In this section, we need .config
68include .config.cmd
69
Eric Andersend06645d2005-02-10 03:06:39 +000070# We also need the various per-package makefiles, which also add
71# each selected package to TARGETS if that package was selected
72# in the .config file.
73include toolchain/*/*.mk
74include package/*/*.mk
75include target/*/*.mk
76
Eric Andersen79f5f1e2005-02-17 03:00:29 +000077# target stuff is last so it can override anything else
78include target/Makefile.in
79
Eric Andersen08782ae2002-04-26 11:45:55 +000080TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
Eric Andersena5c23542003-02-19 08:56:04 +000081TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS))
Eric Andersen08782ae2002-04-26 11:45:55 +000082TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
Eric Andersenffde94b2001-12-22 00:56:11 +000083
Eric Andersen08782ae2002-04-26 11:45:55 +000084world: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) $(TARGETS)
Eric Andersenffde94b2001-12-22 00:56:11 +000085
Eric Andersena5c23542003-02-19 08:56:04 +000086.PHONY: all world clean dirclean distclean source $(TARGETS) \
Eric Andersen747b16d2004-12-11 10:33:19 +000087 $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \
88 $(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR) $(STAGING_DIR)
Jon Nelsonc79e9982002-01-05 20:26:15 +000089
Eric Andersen08782ae2002-04-26 11:45:55 +000090#############################################################
91#
Eric Andersenef407d32004-01-29 23:21:00 +000092# staging and target directories do NOT list these as
Eric Andersen08782ae2002-04-26 11:45:55 +000093# dependancies anywhere else
94#
95#############################################################
96$(DL_DIR):
Eric Andersenbf387232004-12-11 10:35:18 +000097 @mkdir -p $(DL_DIR)
Eric Andersen08782ae2002-04-26 11:45:55 +000098
99$(BUILD_DIR):
Eric Andersenbf387232004-12-11 10:35:18 +0000100 @mkdir -p $(BUILD_DIR)
Eric Andersen08782ae2002-04-26 11:45:55 +0000101
Manuel Novoa III 3ad3d8a2004-09-03 00:49:43 +0000102$(TOOL_BUILD_DIR):
Eric Andersenbf387232004-12-11 10:35:18 +0000103 @mkdir -p $(TOOL_BUILD_DIR)
Manuel Novoa III 3ad3d8a2004-09-03 00:49:43 +0000104
Eric Andersen08782ae2002-04-26 11:45:55 +0000105$(STAGING_DIR):
Eric Andersenbf387232004-12-11 10:35:18 +0000106 @mkdir -p $(STAGING_DIR)/lib
107 @mkdir -p $(STAGING_DIR)/include
108 @mkdir -p $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)
109 @ln -sf ../lib $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib
Eric Andersen08782ae2002-04-26 11:45:55 +0000110
111$(TARGET_DIR):
Eric Andersen3f284172004-10-09 05:28:18 +0000112 zcat target/default/skel.tar.gz | tar -C $(BUILD_DIR) -xf -
113 cp -a target/default/target_skeleton/* $(TARGET_DIR)/
Eric Andersen1a35a662005-02-11 20:52:06 +0000114 -find $(TARGET_DIR) -type d -name .svn -exec rm -rf {} \; > /dev/null 2>&1
Eric Andersenffde94b2001-12-22 00:56:11 +0000115
Eric Andersena5c23542003-02-19 08:56:04 +0000116source: $(TARGETS_SOURCE)
Eric Andersenffde94b2001-12-22 00:56:11 +0000117
Eric Andersen08782ae2002-04-26 11:45:55 +0000118#############################################################
119#
120# Cleanup and misc junk
121#
122#############################################################
123clean: $(TARGETS_CLEAN)
Manuel Novoa III 3ad3d8a2004-09-03 00:49:43 +0000124 rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE)
Eric Andersenffde94b2001-12-22 00:56:11 +0000125
Eric Andersen08782ae2002-04-26 11:45:55 +0000126dirclean: $(TARGETS_DIRCLEAN)
Manuel Novoa III 3ad3d8a2004-09-03 00:49:43 +0000127 rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE)
Eric Andersenffde94b2001-12-22 00:56:11 +0000128
Eric Andersen08782ae2002-04-26 11:45:55 +0000129distclean:
130 rm -rf $(DL_DIR) $(BUILD_DIR) $(LINUX_KERNEL) $(IMAGE)
Eric Andersenffde94b2001-12-22 00:56:11 +0000131
Manuel Novoa III 3ad3d8a2004-09-03 00:49:43 +0000132sourceball:
Eric Andersen08782ae2002-04-26 11:45:55 +0000133 rm -rf $(BUILD_DIR)
134 set -e; \
135 cd ..; \
136 rm -f buildroot.tar.bz2; \
137 tar -cvf buildroot.tar buildroot; \
138 bzip2 -9 buildroot.tar; \
Eric Andersen2d523c22004-10-09 01:06:03 +0000139
140
141else # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
142
143all: menuconfig
144
145# configuration
146# ---------------------------------------------------------------------------
147
148$(CONFIG)/conf:
149 $(MAKE) -C $(CONFIG) conf
150 -@if [ ! -f .config ] ; then \
151 cp $(CONFIG_DEFCONFIG) .config; \
152 fi
153$(CONFIG)/mconf:
154 $(MAKE) -C $(CONFIG) ncurses conf mconf
155 -@if [ ! -f .config ] ; then \
156 cp $(CONFIG_DEFCONFIG) .config; \
157 fi
158
159menuconfig: $(CONFIG)/mconf
160 @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
161
162config: $(CONFIG)/conf
163 @$(CONFIG)/conf $(CONFIG_CONFIG_IN)
164
165oldconfig: $(CONFIG)/conf
166 @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
167
168randconfig: $(CONFIG)/conf
169 @$(CONFIG)/conf -r $(CONFIG_CONFIG_IN)
170
171allyesconfig: $(CONFIG)/conf
172 #@$(CONFIG)/conf -y $(CONFIG_CONFIG_IN)
173 #sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config
174 @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
175
176allnoconfig: $(CONFIG)/conf
177 @$(CONFIG)/conf -n $(CONFIG_CONFIG_IN)
178
179defconfig: $(CONFIG)/conf
180 @$(CONFIG)/conf -d $(CONFIG_CONFIG_IN)
181
182#############################################################
183#
184# Cleanup and misc junk
185#
186#############################################################
187clean:
188 rm -f .config .config.old .config.cmd .tmpconfig.h
189 - $(MAKE) -C $(CONFIG) clean
190
191distclean: clean
192 rm -rf sources/*
193
194endif # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
195
196.PHONY: dummy subdirs release distclean clean config oldconfig \
197 menuconfig tags check test depend
198
199