]> Git Repo - buildroot-mgba.git/blame - Makefile
- pull kconfig from linux-2.6.21.5
[buildroot-mgba.git] / Makefile
CommitLineData
2d523c23 1# Makefile for buildroot2
ffde94bd 2#
15b26aee 3# Copyright (C) 1999-2005 by Erik Andersen <[email protected]>
ffde94bd 4#
08782ae7 5# This program is free software; you can redistribute it and/or modify
2d523c23
EA
6# 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.
ffde94bd 9#
2d523c23
EA
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
08782ae7 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2d523c23 13# General Public License for more details.
ffde94bd 14#
2d523c23
EA
15# 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
3ad3d8a1 18#
02bf5816 19
2d523c23
EA
20#--------------------------------------------------------------
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
a0aef7c4 28
2d523c23 29noconfig_targets := menuconfig config oldconfig randconfig \
0c1e709e 30 defconfig allyesconfig allnoconfig release tags \
825ff341 31 source-check
9e250356
BRF
32
33# $(shell find . -name *_defconfig |sed 's/.*\///')
cad58108 34
2d523c23
EA
35# Pull in the user's configuration file
36ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
37-include $(TOPDIR).config
38endif
9741a49e 39
2d523c23 40ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
54e098e4 41
99cf7293
BRF
42# cc-option
43# Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586)
44# sets -march=winchip-c6 if supported else falls back to -march=i586
45# without checking the latter.
46cc-option = $(shell if $(TARGET_CC) $(TARGET_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
47 > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
48
2c649045
PK
49#############################################################
50#
51# Hide troublesome environment variables from sub processes
52#
53#############################################################
54unexport CROSS_COMPILE
55unexport ARCH
27bc59d4 56
08782ae7
EA
57#############################################################
58#
c6e43c9d 59# Setup the proper filename extensions for the host
08782ae7 60#
7dcbbfbb
BRF
61##############################################################
62ifneq ($(findstring linux,$(BR2_GNU_BUILD_SUFFIX)),)
c6e43c9d
BRF
63HOST_EXEEXT:=
64HOST_LIBEXT:=.a
65HOST_SHREXT:=.so
3096f34d 66endif
7dcbbfbb 67ifneq ($(findstring apple,$(BR2_GNU_BUILD_SUFFIX)),)
c6e43c9d
BRF
68HOST_EXEEXT:=
69HOST_LIBEXT:=.a
70HOST_SHREXT:=.dylib
3096f34d 71endif
7dcbbfbb 72ifneq ($(findstring cygwin,$(BR2_GNU_BUILD_SUFFIX)),)
c6e43c9d
BRF
73HOST_EXEEXT:=.exe
74HOST_LIBEXT:=.lib
75HOST_SHREXT:=.dll
3096f34d 76endif
7dcbbfbb 77ifneq ($(findstring mingw,$(BR2_GNU_BUILD_SUFFIX)),)
c6e43c9d
BRF
78HOST_EXEEXT:=.exe
79HOST_LIBEXT:=.lib
80HOST_SHREXT:=.dll
3096f34d 81endif
cb7d5b81 82
c6e43c9d 83# The preferred type of libs we build for the target
3096f34d 84ifeq ($(BR2_PREFER_STATIC_LIB),y)
c6e43c9d 85LIBTGTEXT=.a
8027784c 86#PREFERRED_LIB_FLAGS:=--disable-shared --enable-static
3096f34d 87else
c6e43c9d 88LIBTGTEXT=.so
8027784c 89#PREFERRED_LIB_FLAGS:=--disable-static --enable-shared
3096f34d 90endif
8027784c 91PREFERRED_LIB_FLAGS:=--enable-static --enable-shared
ffde94bd 92
7dcbbfbb 93
7dcbbfbb
BRF
94#############################################################
95#
96# The list of stuff to build for the target toolchain
97# along with the packages to build for the target.
98#
99##############################################################
100ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
101TARGETS:=uclibc-configured binutils gcc uclibc-target-utils
102else
103TARGETS:=uclibc
104endif
105include toolchain/Makefile.in
106include package/Makefile.in
107
108#############################################################
109#
110# You should probably leave this stuff alone unless you know
111# what you are doing.
112#
113#############################################################
114
08782ae7 115all: world
ffde94bd 116
2d523c23
EA
117# In this section, we need .config
118include .config.cmd
119
d06645d8
EA
120# We also need the various per-package makefiles, which also add
121# each selected package to TARGETS if that package was selected
122# in the .config file.
123include toolchain/*/*.mk
124include package/*/*.mk
d06645d8 125
79f5f1e8
EA
126# target stuff is last so it can override anything else
127include target/Makefile.in
128
08782ae7 129TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
a5c23541 130TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS))
08782ae7 131TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
ffde94bd 132
6e2823c1 133world: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) $(TARGETS)
870cb9e8 134dirs: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR)
ffde94bd 135
870cb9e8 136.PHONY: all world dirs clean dirclean distclean source $(TARGETS) \
747b16dd
EA
137 $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \
138 $(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR) $(STAGING_DIR)
ffde94bd 139
08782ae7
EA
140#############################################################
141#
ef407d3d 142# staging and target directories do NOT list these as
d99c31c6 143# dependencies anywhere else
08782ae7
EA
144#
145#############################################################
8d583fc0
BRF
146$(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR):
147 @mkdir -p $@
3ad3d8a1 148
08782ae7 149$(STAGING_DIR):
9c865d75 150 @mkdir -p $(STAGING_DIR)/bin
bf38723f 151 @mkdir -p $(STAGING_DIR)/lib
7e0c890c 152ifeq ($(BR2_TOOLCHAIN_SYSROOT),y)
8027784c
BRF
153 @mkdir -p $(STAGING_DIR)/usr/lib
154else
155 @ln -snf . $(STAGING_DIR)/usr
156 @mkdir -p $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)
3da708e4 157 @ln -snf ../lib $(STAGING_DIR)/usr/lib
8027784c
BRF
158 @ln -snf ../lib $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/lib
159endif
160 @mkdir -p $(STAGING_DIR)/usr/include
ffde94bd 161
08782ae7 162$(TARGET_DIR):
a4c685f1 163 mkdir -p $(TARGET_DIR)
ba70f94e
EA
164 if [ -d "$(TARGET_SKELETON)" ] ; then \
165 cp -fa $(TARGET_SKELETON)/* $(TARGET_DIR)/; \
bb15c221 166 fi;
5418a923 167 touch $(STAGING_DIR)/.fakeroot.00000
bb15c221
EA
168 -find $(TARGET_DIR) -type d -name CVS | xargs rm -rf
169 -find $(TARGET_DIR) -type d -name .svn | xargs rm -rf
08782ae7 170
73be7f9e 171source: $(TARGETS_SOURCE) $(HOST_SOURCE)
08782ae7 172
825ff341
BRF
173.config.check: dependencies
174 $(SED) '/BR2_WGET/s/\"$$/ --spider\"/g' .config
175 touch $@
176
177_source-check: .config.check
178 $(MAKE) source
179
08782ae7
EA
180#############################################################
181#
182# Cleanup and misc junk
183#
184#############################################################
185clean: $(TARGETS_CLEAN)
3ad3d8a1 186 rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE)
08782ae7
EA
187
188dirclean: $(TARGETS_DIRCLEAN)
3ad3d8a1 189 rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE)
08782ae7
EA
190
191distclean:
5bc1f0c3
MF
192ifeq ($(DL_DIR),$(BASE_DIR)/dl)
193 rm -rf $(DL_DIR)
194endif
195 rm -rf $(BUILD_DIR) $(LINUX_KERNEL) $(IMAGE)
b5136193 196 $(MAKE) -C $(CONFIG) clean
08782ae7 197
3ad3d8a1 198sourceball:
08782ae7
EA
199 rm -rf $(BUILD_DIR)
200 set -e; \
201 cd ..; \
202 rm -f buildroot.tar.bz2; \
203 tar -cvf buildroot.tar buildroot; \
204 bzip2 -9 buildroot.tar; \
2d523c23
EA
205
206
207else # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
208
209all: menuconfig
210
211# configuration
212# ---------------------------------------------------------------------------
213
214$(CONFIG)/conf:
215 $(MAKE) -C $(CONFIG) conf
216 -@if [ ! -f .config ] ; then \
217 cp $(CONFIG_DEFCONFIG) .config; \
218 fi
219$(CONFIG)/mconf:
220 $(MAKE) -C $(CONFIG) ncurses conf mconf
221 -@if [ ! -f .config ] ; then \
222 cp $(CONFIG_DEFCONFIG) .config; \
223 fi
224
225menuconfig: $(CONFIG)/mconf
226 @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
227
228config: $(CONFIG)/conf
229 @$(CONFIG)/conf $(CONFIG_CONFIG_IN)
230
231oldconfig: $(CONFIG)/conf
232 @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
233
234randconfig: $(CONFIG)/conf
235 @$(CONFIG)/conf -r $(CONFIG_CONFIG_IN)
236
237allyesconfig: $(CONFIG)/conf
825ff341
BRF
238 cp $(CONFIG_DEFCONFIG) .config
239 @$(CONFIG)/conf -y $(CONFIG_CONFIG_IN)
2d523c23 240 #sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config
2d523c23
EA
241
242allnoconfig: $(CONFIG)/conf
243 @$(CONFIG)/conf -n $(CONFIG_CONFIG_IN)
244
245defconfig: $(CONFIG)/conf
246 @$(CONFIG)/conf -d $(CONFIG_CONFIG_IN)
247
825ff341
BRF
248# check if download URLs are outdated
249source-check: allyesconfig
250 $(MAKE) _source-check
251
2d523c23
EA
252#############################################################
253#
254# Cleanup and misc junk
255#
256#############################################################
257clean:
258 rm -f .config .config.old .config.cmd .tmpconfig.h
259 - $(MAKE) -C $(CONFIG) clean
260
261distclean: clean
262 rm -rf sources/*
263
264endif # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
265
ba2e7e02
BRF
266%_defconfig: $(CONFIG)/conf
267 cp $(shell find ./target/ -name $@) .config
268 @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
269
270
2d523c23 271.PHONY: dummy subdirs release distclean clean config oldconfig \
f3ccf319 272 menuconfig tags check test depend defconfig
2d523c23
EA
273
274
This page took 0.141285 seconds and 4 git commands to generate.