]> Git Repo - buildroot-mgba.git/blame - Makefile
Kill off the old gcc/binutils stuff
[buildroot-mgba.git] / Makefile
CommitLineData
08782ae7 1# Makefile for a simple busybox/uClibc root filesystem
ffde94bd 2#
03c3fa25 3# Copyright (C) 2001-2003 Erik Andersen <[email protected]>
08782ae7 4# Copyright (C) 2002 by Tim Riker <[email protected]>
ffde94bd 5#
08782ae7
EA
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU Library General Public License as
8# published by the Free Software Foundation; either version 2 of the
9# License, or (at your option) any later version.
ffde94bd 10#
08782ae7
EA
11# This program is distributed in the hope that it will be useful, but
12# WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14# Library General Public License for more details.
ffde94bd 15#
08782ae7
EA
16# You should have received a copy of the GNU Library General Public
17# License along with this program; if not, write to the Free Software
18# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19# USA
ffde94bd 20
ffde94bd 21
08782ae7
EA
22#############################################################
23#
24# EDIT this stuff to suit your system and preferences
25#
26# Use := when possible to get precomputation, thereby
27# speeding up the build process.
28#
29#############################################################
ffde94bd 30
08782ae7
EA
31# What sortof target system shall we compile this for?
32ARCH:=i386
33#ARCH:=arm
d632d42b 34#ARCH:=mips
de19fac4 35#ARCH:=mipsel
27bc59d4 36#ARCH:=powerpc
2394ee58 37#ARCH:=sh4
c09a799c 38# Busybox link failing due to needing libgcc functions that are statics.
2394ee58 39#ARCH:=cris
c09a799c
MNI
40
41# The following currently fail to build since no shared lib support.
42#ARCH:=sh64
2394ee58
EA
43#ARCH:=m68k
44#ARCH:=v850
45#ARCH:=sparc
08782ae7 46#ARCH:=whatever
c38dcccc 47
9168e838
MNI
48# Enable this if you want to use an <arch>-linux-uclibc-* toolchain.
49# Note that, to avoid configure problems with apps that don't support
50# this tupple, we also put <arch>-linux-* symlinks in staging_dir/bin.
93e576b7 51# This is the preferred approach now.
9168e838 52USE_LINUX_UCLIBC:=true
9168e838 53
18e33c25
EA
54# If you are building a native gcc toolchain, do you want to
55# build the old gcc-2.95 based toolchain, or would you prefer
c09a799c 56# a nice and shiny new gcc-3.3.2 toolchain?
9168e838
MNI
57# WARNING -- 2.95 currently does not build unless USE_LINUX_UCLIBC:=true.
58# WARNING -- 2.95 currently only builds for i386, arm, mips*, and powerpc.
59# WARNING -- 2.95 does not currently build natively for the target.
60#GCC_2_95_TOOLCHAIN:=true
18e33c25
EA
61GCC_2_95_TOOLCHAIN:=false
62
08782ae7
EA
63# Enable this to use the uClibc daily snapshot instead of a released
64# version. Daily snapshots may contain new features and bugfixes. Or
95f81a5a 65# they may not even compile at all, depending on what Erik is doing...
9168e838 66USE_UCLIBC_SNAPSHOT:=true
c38dcccc 67
085ba9f4
EA
68# Enable this to use the busybox daily snapshot instead of a released
69# version. Daily snapshots may contain new features and bugfixes. Or
70# they may not even compile at all....
26da803f 71USE_BUSYBOX_SNAPSHOT:=true
085ba9f4 72
08782ae7 73# Enable large file (files > 2 GB) support
03c3fa25 74BUILD_WITH_LARGEFILE:=true
ffde94bd 75
8a2597ea
EA
76# Command used to download source code
77WGET:=wget --passive-ftp
78
27bc59d4 79# Optimize toolchain for which type of CPU?
9168e838
MNI
80ifeq ($(USE_LINUX_UCLIBC),true)
81OPTIMIZE_FOR_CPU=$(ARCH)
82#OPTIMIZE_FOR_CPU=i686
93e576b7
MNI
83# Note... gcc 2.95 does not seem to like anything higher than i586.
84#OPTIMIZE_FOR_CPU=i586
9168e838
MNI
85#OPTIMIZE_FOR_CPU=whatever
86else
7bfc5d37 87# WARNING!!! CURRENTLY BROKEN!!! LEAVE IT AS $(ARCH)!!!
ef7784a6 88OPTIMIZE_FOR_CPU=$(ARCH)
7bfc5d37 89# WARNING!!! CURRENTLY BROKEN!!! LEAVE IT AS $(ARCH)!!!
9168e838 90endif
27bc59d4 91
d632d42b
MNI
92# Soft floating point options.
93# Notes:
93e576b7
MNI
94# Currently builds with gcc 3.3 for arm, mips, mipsel, powerpc.
95# (i386 support will be added back in at some point.)
d632d42b
MNI
96# Only tested with multilib enabled.
97# For i386, long double is the same as double (64 bits). While this
98# is unusual for x86, it seemed the best approach considering the
99# limitations in the gcc floating point emulation library.
100# For arm, soft float uses the usual libfloat routines.
93e576b7
MNI
101# Custom specs files are used to set the default gcc mode to soft float
102# as a convenience, since you shouldn't link hard and soft float
103# together. In fact, arm won't even let you.
c09a799c
MNI
104# (Un)comment the appropriate line below.
105#SOFT_FLOAT:=true
de19fac4 106SOFT_FLOAT:=false
d632d42b
MNI
107
108TARGET_OPTIMIZATION=-Os
109TARGET_DEBUGGING= #-g
d632d42b 110
27bc59d4 111# Any additional gcc options you may want to include....
c09a799c 112EXTRA_GCC_CONFIG_OPTIONS:=
27bc59d4 113
cb7d5b81 114# Enable the following if you want locale/gettext/i18n support.
c09a799c 115# NOTE! Currently the pregnerated locale stuff only works for x86!
cb7d5b81
EA
116#ENABLE_LOCALE:=true
117ENABLE_LOCALE:=false
118
119# If you want multilib enabled, enable this...
120MULTILIB:=--enable-multilib
121
c09a799c
MNI
122# Build/install c++ compiler and libstdc++?
123INSTALL_LIBSTDCPP:=true
0e956fc1 124
02bf5816
EA
125# For SMP machines some stuff can be run in parallel
126#JLEVEL=-j3
127
08782ae7
EA
128#############################################################
129#
130# The list of stuff to build for the target filesystem
131#
132#############################################################
4f889ada 133TARGETS:=host-sed
c09a799c 134
a0aef7c4 135ifeq ($(GCC_2_95_TOOLCHAIN),true)
c09a799c 136TARGETS+=uclibc-configured binutils gcc2_95
a0aef7c4 137else
f08097dd 138TARGETS+=uclibc-configured binutils gcc3_3
a0aef7c4 139endif
03c3fa25 140
cb7d5b81
EA
141# Do you want user mode Linux (x86 only), or are you building a
142# your own kernel that will run on its own? Perhaps you have a
4edbe2ca 143# kernel you have already configured and you want to use that?
cb7d5b81
EA
144# The default is to just use a set of known working kernel
145# headers. Unless you want to build a kernel, I recommend just
146# using that...
147TARGETS+=kernel-headers
5455b5e0 148#TARGETS+=linux
5eb4604c 149#TARGETS+=user-mode-linux
59759b8f 150#TARGETS+=system-linux
5455b5e0 151
cad58108 152# The default minimal set
b8a2361d 153TARGETS+=busybox tinylogin
cad58108
EA
154
155# Openssh...
156#TARGETS+=zlib openssl openssh
59759b8f
EA
157# Dropbear sshd is much smaller than openssl + openssh
158#TARGETS+=dropbear_sshd
cad58108
EA
159
160# Everything needed to build a full uClibc development system!
de857763 161#TARGETS+=coreutils findutils bash make diffutils patch sed
bfda40a5 162#TARGETS+=ed flex bison file gawk tar grep bzip2
a0aef7c4
EA
163
164#If you want a development system, you probably want gcc built
165# with uClibc so it can run within your dev system...
bfda40a5
EA
166#TARGETS+=gcc2_95_target ccache_target
167#TARGETS+=gcc3_3_target ccache_target
cad58108 168
7564033f
EA
169# Of course, if you are installing a development system, you
170# may want some header files so you can compile stuff....
171#TARGETS+=ncurses-headers zlib-headers openssl-headers
172
b7d4f49c
EA
173# More development system stuff for those that want it
174#TARGETS+=m4 autoconf automake libtool
175
13694747
EA
176# Perl
177#TARGETS+=perl
178
cad58108
EA
179# Some nice debugging tools
180#TARGETS+=gdb strace
181
382187f0 182# The Valgrind debugger (x86 only)
cad58108 183#TARGETS+=valgrind
ffde94bd 184
9741a49e 185# Some stuff for access points and firewalls
c8eea31d 186#TARGETS+=iptables hostap wtools dhcp_relay bridge
26da803f 187#TARGETS+=iproute2 netsnmp
9741a49e 188
54e098e4
EA
189# Run customize.mk at the very end to add your own special config.
190# This is useful for making your own distro within the buildroot
191# process.
192# TARGETS+=customize
193
194#############################################################
195#
08782ae7 196# Pick your root filesystem type.
54e098e4
EA
197#
198#############################################################
08782ae7 199TARGETS+=ext2root
ffde94bd 200
27bc59d4
EA
201# Must mount cramfs with 'ramdisk_blocksize=4096'
202#TARGETS+=cramfsroot
203
204# You may need to edit make/jffs2root.mk to change target
205# endian-ness or similar, but this is sufficient for most
206# things as-is...
207#TARGETS+=jffs2root
208
08782ae7
EA
209#############################################################
210#
211# You should probably leave this stuff alone unless you know
212# what you are doing.
213#
214#############################################################
d632d42b 215
de19fac4 216ifeq ($(SOFT_FLOAT),true)
43678bca
MNI
217SOFT_FLOAT_CONFIG_OPTION:=--without-float
218TARGET_SOFT_FLOAT:=-msoft-float
2192a03c
MNI
219ARCH_FPU_SUFFIX:=_nofpu
220else
43678bca
MNI
221SOFT_FLOAT_CONFIG_OPTION:=
222TARGET_SOFT_FLOAT:=
2192a03c 223ARCH_FPU_SUFFIX:=
de19fac4
EA
224endif
225
9168e838
MNI
226# The new stuff auto-detects approrpriate locale support.
227# So only set this for the old 'hacked' toolchain.
228ifneq ($(USE_LINUX_UCLIBC),true)
f08097dd
MNI
229ifeq ($(ENABLE_LOCALE),true)
230EXTRA_GCC_CONFIG_OPTIONS += --enable-clocale=gnu
231endif
9168e838 232endif
d632d42b 233
c09a799c
MNI
234# WARNING -- uClibc currently disables large file support on cris.
235ifeq ("$(strip $(ARCH))","cris")
236BUILD_WITH_LARGEFILE:=false
237endif
238
8162065d
MNI
239ifneq ($(BUILD_WITH_LARGEFILE),true)
240DISABLE_LARGEFILE= --disable-largefile
241endif
93e576b7 242TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)
8162065d 243
08782ae7 244HOSTCC:=gcc
9741a49e 245BASE_DIR:=${shell pwd}
08782ae7
EA
246SOURCE_DIR:=$(BASE_DIR)/sources
247DL_DIR:=$(SOURCE_DIR)/dl
248PATCH_DIR=$(SOURCE_DIR)/patches
d632d42b 249BUILD_DIR:=$(BASE_DIR)/build_$(ARCH)$(ARCH_FPU_SUFFIX)
08782ae7 250TARGET_DIR:=$(BUILD_DIR)/root
370fb2a3 251STAGING_DIR=$(BUILD_DIR)/staging_dir
d632d42b 252TOOL_BUILD_DIR=$(BASE_DIR)/toolchain_build_$(ARCH)$(ARCH_FPU_SUFFIX)
370fb2a3 253TARGET_PATH=$(STAGING_DIR)/bin:/bin:/sbin:/usr/bin:/usr/sbin
d632d42b 254IMAGE:=$(BASE_DIR)/root_fs_$(ARCH)$(ARCH_FPU_SUFFIX)
9168e838
MNI
255
256ifeq ($(USE_LINUX_UCLIBC),true)
257REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux-uclibc
258GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux
259KERNEL_CROSS=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-
260TARGET_CROSS=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-
261else
262REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux
370fb2a3 263GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux
9168e838
MNI
264KERNEL_CROSS=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-
265TARGET_CROSS=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-
266endif
267
93e576b7 268TARGET_CC=$(TARGET_CROSS)gcc
9168e838
MNI
269STRIP=$(TARGET_CROSS)strip --remove-section=.comment --remove-section=.note
270
271
36830bae
EA
272HOST_ARCH:=$(shell $(HOSTCC) -dumpmachine | sed -e s'/-.*//' \
273 -e 's/sparc.*/sparc/' \
274 -e 's/arm.*/arm/g' \
275 -e 's/m68k.*/m68k/' \
276 -e 's/ppc/powerpc/g' \
277 -e 's/v850.*/v850/g' \
278 -e 's/sh[234]/sh/' \
279 -e 's/mips-.*/mips/' \
280 -e 's/mipsel-.*/mipsel/' \
281 -e 's/cris.*/cris/' \
0554f62a 282 -e 's/i[3-9]86/i386/' \
36830bae
EA
283 )
284GNU_HOST_NAME:=$(HOST_ARCH)-pc-linux-gnu
1fc3f2f3
EA
285TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \
286 AR=$(TARGET_CROSS)ar \
287 AS=$(TARGET_CROSS)as \
288 LD=$(TARGET_CROSS)ld \
289 NM=$(TARGET_CROSS)nm \
93e576b7
MNI
290 CC=$(TARGET_CROSS)gcc \
291 GCC=$(TARGET_CROSS)gcc \
292 CXX=$(TARGET_CROSS)g++ \
1fc3f2f3 293 RANLIB=$(TARGET_CROSS)ranlib
93e576b7 294
cb7d5b81
EA
295ifeq ($(ENABLE_LOCALE),true)
296DISABLE_NLS:=
297else
298DISABLE_NLS:=--disable-nls
299endif
300
ffde94bd 301
08782ae7 302all: world
ffde94bd 303
08782ae7 304TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
a5c23541 305TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS))
08782ae7 306TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
ffde94bd 307
08782ae7 308world: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) $(TARGETS)
ffde94bd 309
a5c23541
EA
310.PHONY: all world clean dirclean distclean source $(TARGETS) \
311 $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE)
ffde94bd 312
08782ae7 313include make/*.mk
ffde94bd 314
08782ae7
EA
315#############################################################
316#
317# staging and target directories do NOT list these as
318# dependancies anywhere else
319#
320#############################################################
321$(DL_DIR):
322 mkdir $(DL_DIR)
ffde94bd 323
08782ae7
EA
324$(BUILD_DIR):
325 mkdir $(BUILD_DIR)
c79e9982 326
08782ae7
EA
327$(STAGING_DIR):
328 rm -rf $(STAGING_DIR)
de2ae8dc 329 mkdir -p $(STAGING_DIR)/lib
2394ee58 330 mkdir -p $(STAGING_DIR)/usr
9168e838 331ifneq ($(GCC_2_95_TOOLCHAIN),true)
de2ae8dc 332 mkdir -p $(STAGING_DIR)/include
9168e838
MNI
333else
334 mkdir -p $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/include
335 (cd $(STAGING_DIR); ln -fs $(REAL_GNU_TARGET_NAME)/include)
336endif
2394ee58 337 ln -fs ../lib $(STAGING_DIR)/usr/lib
ffde94bd 338
08782ae7 339$(TARGET_DIR):
ffde94bd 340 rm -rf $(TARGET_DIR)
08782ae7
EA
341 zcat $(SOURCE_DIR)/skel.tar.gz | tar -C $(BUILD_DIR) -xf -
342 cp -a $(SOURCE_DIR)/target_skeleton/* $(TARGET_DIR)/
339f2f49 343 -find $(TARGET_DIR) -type d -name CVS -exec rm -rf {} \; > /dev/null 2>&1
08782ae7 344
a5c23541 345source: $(TARGETS_SOURCE)
08782ae7
EA
346
347#############################################################
348#
349# Cleanup and misc junk
350#
351#############################################################
352clean: $(TARGETS_CLEAN)
353 rm -rf $(TARGET_DIR) $(STAGING_DIR) $(IMAGE)
354
355dirclean: $(TARGETS_DIRCLEAN)
356 rm -rf $(TARGET_DIR) $(STAGING_DIR) $(IMAGE)
357
358distclean:
359 rm -rf $(DL_DIR) $(BUILD_DIR) $(LINUX_KERNEL) $(IMAGE)
360
361sourceball:
362 rm -rf $(BUILD_DIR)
363 set -e; \
364 cd ..; \
365 rm -f buildroot.tar.bz2; \
366 tar -cvf buildroot.tar buildroot; \
367 bzip2 -9 buildroot.tar; \
This page took 0.091957 seconds and 4 git commands to generate.