]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/uClibc/Makefile
uClibc-Update.
[people/pmueller/ipfire-2.x.git] / src / uClibc / Makefile
CommitLineData
cd1a2927
MT
1# Makefile for to build gcc for uClibc
2#
3# Copyright (C) 2002-2003 Erik Andersen <andersen@uclibc.org>
4#
5# This program is free software; you can redistribute it and/or modify
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.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13# General Public License for more details.
14#
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
18#
19
20#############################################################
21#
22# EDIT this stuff to suit your system and preferences
23#
24# Use := when possible to get precomputation, thereby
25# speeding up the build process.
26#
27#############################################################
28
29# What sortof target system shall we compile this for?
1d4ec104 30ARCH:=$(MACHINE)
cd1a2927
MT
31#ARCH:=arm
32#ARCH:=mips
33#ARCH:=mipsel
34# Possible issues remaining with powerpc and soft float.
35#ARCH:=powerpc
36#ARCH:=sh4
37# Busybox link failing due to needing libgcc functions that are statics.
38#ARCH:=cris
39
40# The following currently fail to build since no shared lib support.
41#ARCH:=sh64
42#ARCH:=m68k
43#ARCH:=v850
44#ARCH:=sparc
45#ARCH:=whatever
46
47# Enable this to use the uClibc daily snapshot instead of a released
48# version. Daily snapshots may contain new features and bugfixes. Or
49# they may not even compile at all, depending on what Erik is doing...
50USE_UCLIBC_SNAPSHOT:=false
51
52# Enable this to use the busybox daily snapshot instead of a released
53# version. Daily snapshots may contain new features and bugfixes. Or
54# they may not even compile at all....
55USE_BUSYBOX_SNAPSHOT:=true
56
57# Enable large file (files > 2 GB) support
58BUILD_WITH_LARGEFILE:=true
59
60# Command used to download source code
61WGET:=wget --passive-ftp
62
63# Soft floating point options.
64# Notes:
65# Currently builds with gcc 3.3 for i386, arm, mips, mipsel.
66# Only tested with multilib enabled.
67# For i386, long double is the same as double (64 bits). While this
68# is unusual for x86, it seemed the best approach considering the
69# limitations in the gcc floating point emulation library.
70# For arm, soft float uses the usual libfloat routines.
71# The uClibc built will support _only_ applications compiled with the
72# -msoft-float flag. To avoid CFLAGS problems, you may want to use
73# scripts similar to those in the build*/staging_dir/bin directory.
74# (Un)comment the appropriate line below.
75#SOFT_FLOAT:=true
76SOFT_FLOAT:=false
77
78# Any additional gcc options you may want to include....
79EXTRA_GCC_CONFIG_OPTIONS:=
80
81# Enable the following if you want locale/gettext/i18n support.
82# NOTE! Currently the pregnerated locale stuff only works for x86!
83#ENABLE_LOCALE:=true
84ENABLE_LOCALE:=false
85
86# If you want multilib enabled, enable this...
87MULTILIB:=--enable-multilib
88
89# Build/install c++ compiler and libstdc++?
90INSTALL_LIBSTDCPP:=false
91
92# For SMP machines some stuff can be run in parallel
93JLEVEL=-j3
94
95#############################################################
96#
97# You should probably leave this stuff alone unless you know
98# what you are doing.
99#
100#############################################################
101USE_UCLIBC_TOOLCHAIN:=true
9badc9e9 102TARGETS:=uclibc-configured binutils gcc
cd1a2927
MT
103
104# Optimize toolchain for which type of CPU?
105# WARNING!!! CURRENTLY BROKEN!!! LEAVE IT AS $(ARCH)!!!
106OPTIMIZE_FOR_CPU=$(ARCH)
107
108ifeq ($(SOFT_FLOAT),true)
109SOFT_FLOAT_CONFIG_OPTION:=--without-float
110TARGET_SOFT_FLOAT:=-msoft-float
111ARCH_FPU_SUFFIX:=_nofpu
112else
113SOFT_FLOAT_CONFIG_OPTION:=
114TARGET_SOFT_FLOAT:=
115ARCH_FPU_SUFFIX:=
116endif
117
118ifeq ($(ENABLE_LOCALE),true)
119EXTRA_GCC_CONFIG_OPTIONS += --enable-clocale=gnu
120endif
121
122# WARNING -- uClibc currently disables large file support on cris.
123ifeq ("$(strip $(ARCH))","cris")
124BUILD_WITH_LARGEFILE:=false
125endif
126
127ifneq ($(BUILD_WITH_LARGEFILE),true)
128DISABLE_LARGEFILE= --disable-largefile
129endif
130TARGET_OPTIMIZATION=-Os
131TARGET_DEBUGGING= #-g
132TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) $(TARGET_SOFT_FLOAT)
133
134HOSTCC:=gcc
135SED:=sed -i -e
136BASE_DIR:=${shell pwd}
137SOURCE_DIR:=$(BASE_DIR)/sources
138#DL_DIR:=$(SOURCE_DIR)/dl
139DL_DIR:=/usr/src/cache
140PATCH_DIR=$(SOURCE_DIR)/patches
141#BUILD_DIR=$(BASE_DIR)/toolchain_$(ARCH)$(ARCH_FPU_SUFFIX)
142BUILD_DIR=/opt/$(ARCH)-uClibc
143STAGING_DIR=$(BUILD_DIR)
144TOOL_BUILD_DIR=$(BASE_DIR)/toolchain_build_$(ARCH)$(ARCH_FPU_SUFFIX)
145TARGET_PATH=/usr/local/bin:$(STAGING_DIR)/bin:/bin:/sbin:/usr/bin:/usr/sbin
146#TARGET_CROSS=$(STAGING_DIR)/bin/$(ARCH)-uclibc-
1d4ec104 147TARGET_CROSS=$(STAGING_DIR)/bin/$(ARCH)-linux-uclibc-
cd1a2927
MT
148TARGET_CC=$(TARGET_CROSS)gcc$(TARGET_SOFT_FLOAT)
149STRIP=$(TARGET_CROSS)strip --remove-section=.comment --remove-section=.note
150#STRIP:=/bin/true
151IMAGE:=$(BASE_DIR)/root_fs_$(ARCH)$(ARCH_FPU_SUFFIX)
1d4ec104 152GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux-uclibc
cd1a2927 153#KERNEL_CROSS=$(STAGING_DIR)/bin/$(ARCH)-uclibc-
1d4ec104 154KERNEL_CROSS=$(STAGING_DIR)/bin/$(ARCH)-linux-uclibc-
cd1a2927
MT
155HOST_ARCH:=$(shell $(HOSTCC) -dumpmachine | sed -e s'/-.*//' \
156 -e 's/sparc.*/sparc/' \
157 -e 's/arm.*/arm/g' \
158 -e 's/m68k.*/m68k/' \
159 -e 's/alpha.*/alpha/' \
160 -e 's/ppc/powerpc/g' \
161 -e 's/v850.*/v850/g' \
162 -e 's/sh[234]/sh/' \
163 -e 's/mips-.*/mips/' \
164 -e 's/mipsel-.*/mipsel/' \
165 -e 's/cris.*/cris/' \
166 -e 's/i[3-9]86/i386/' \
167 )
168GNU_HOST_NAME:=$(HOST_ARCH)-pc-linux-gnu
169TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \
170 AR=$(TARGET_CROSS)ar \
171 AS=$(TARGET_CROSS)as \
172 LD=$(TARGET_CROSS)ld \
173 NM=$(TARGET_CROSS)nm \
174 CC=$(TARGET_CROSS)gcc$(TARGET_SOFT_FLOAT) \
175 GCC=$(TARGET_CROSS)gcc$(TARGET_SOFT_FLOAT) \
176 CXX=$(TARGET_CROSS)g++$(TARGET_SOFT_FLOAT) \
177 RANLIB=$(TARGET_CROSS)ranlib
178ifeq ($(ENABLE_LOCALE),true)
179DISABLE_NLS:=
180else
181DISABLE_NLS:=--disable-nls
182endif
183
184
185all: world
186
187TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
188TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS))
189TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
190
191world: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGETS)
192
193.PHONY: all world clean dirclean distclean source $(TARGETS) \
194 $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE)
195
9badc9e9
MT
196include make/binutils.mk
197include make/gcc.mk
198include make/uclibc.mk
cd1a2927
MT
199
200#############################################################
201#
202# staging and target directories do NOT list these as
203# dependancies anywhere else
204#
205#############################################################
206$(DL_DIR):
207 mkdir $(DL_DIR)
208
209$(STAGING_DIR):
210 rm -rf $(STAGING_DIR)
211 mkdir -p $(BUILD_DIR)
212 mkdir -p $(TOOL_BUILD_DIR)
213 mkdir -p $(STAGING_DIR)/lib
214 mkdir -p $(STAGING_DIR)/usr
215# mkdir -p $(STAGING_DIR)/include
216 ln -fs ../lib $(STAGING_DIR)/usr/lib
217
218source: $(TARGETS_SOURCE)
219
220#############################################################
221#
222# Cleanup and misc junk
223#
224#############################################################
225clean: $(TARGETS_CLEAN)
226 rm -rf $(STAGING_DIR) $(IMAGE)
227
228dirclean: $(TARGETS_DIRCLEAN)
229 rm -rf $(STAGING_DIR) $(IMAGE)
230
231distclean:
232 rm -rf $(DL_DIR) $(BUILD_DIR) $(LINUX_KERNEL) $(IMAGE)
233
234sourceball:
235 rm -rf $(BUILD_DIR)
236 set -e; \
237 cd ..; \
238 rm -f buildroot.tar.bz2; \
239 tar -cvf buildroot.tar buildroot; \
240 bzip2 -9 buildroot.tar; \