1 # Makefile for to build gcc for uClibc
3 # Copyright (C) 2002-2003 Erik Andersen <andersen@uclibc.org>
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.
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.
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
20 #############################################################
22 # EDIT this stuff to suit your system and preferences
24 # Use := when possible to get precomputation, thereby
25 # speeding up the build process.
27 #############################################################
29 # What sortof target system shall we compile this for?
34 # Possible issues remaining with powerpc and soft float.
37 # Busybox link failing due to needing libgcc functions that are statics.
40 # The following currently fail to build since no shared lib support.
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...
50 USE_UCLIBC_SNAPSHOT
:=false
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....
55 USE_BUSYBOX_SNAPSHOT
:=true
57 # Enable large file (files > 2 GB) support
58 BUILD_WITH_LARGEFILE
:=true
60 # Command used to download source code
61 WGET
:=wget
--passive-ftp
63 # Soft floating point options.
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.
78 # Any additional gcc options you may want to include....
79 EXTRA_GCC_CONFIG_OPTIONS
:=
81 # Enable the following if you want locale/gettext/i18n support.
82 # NOTE! Currently the pregnerated locale stuff only works for x86!
86 # If you want multilib enabled, enable this...
87 MULTILIB
:=--enable-multilib
89 # Build/install c++ compiler and libstdc++?
90 INSTALL_LIBSTDCPP
:=false
92 # For SMP machines some stuff can be run in parallel
95 #############################################################
97 # You should probably leave this stuff alone unless you know
100 #############################################################
101 USE_UCLIBC_TOOLCHAIN
:=true
102 TARGETS
:=uclibc-configured binutils gcc3_3
104 # Optimize toolchain for which type of CPU?
105 # WARNING!!! CURRENTLY BROKEN!!! LEAVE IT AS $(ARCH)!!!
106 OPTIMIZE_FOR_CPU
=$(ARCH
)
108 ifeq ($(SOFT_FLOAT
),true
)
109 SOFT_FLOAT_CONFIG_OPTION
:=--without-float
110 TARGET_SOFT_FLOAT
:=-msoft-float
111 ARCH_FPU_SUFFIX
:=_nofpu
113 SOFT_FLOAT_CONFIG_OPTION
:=
118 ifeq ($(ENABLE_LOCALE
),true
)
119 EXTRA_GCC_CONFIG_OPTIONS
+= --enable-clocale
=gnu
122 # WARNING -- uClibc currently disables large file support on cris.
123 ifeq ("$(strip $(ARCH))","cris")
124 BUILD_WITH_LARGEFILE
:=false
127 ifneq ($(BUILD_WITH_LARGEFILE
),true
)
128 DISABLE_LARGEFILE
= --disable-largefile
130 TARGET_OPTIMIZATION
=-Os
131 TARGET_DEBUGGING
= #-g
132 TARGET_CFLAGS
=$(TARGET_OPTIMIZATION
) $(TARGET_DEBUGGING
) $(TARGET_SOFT_FLOAT
)
136 BASE_DIR
:=${shell pwd
}
137 SOURCE_DIR
:=$(BASE_DIR
)/sources
138 #DL_DIR:=$(SOURCE_DIR)/dl
139 DL_DIR
:=/usr
/src
/cache
140 PATCH_DIR
=$(SOURCE_DIR
)/patches
141 #BUILD_DIR=$(BASE_DIR)/toolchain_$(ARCH)$(ARCH_FPU_SUFFIX)
142 BUILD_DIR
=/opt
/$(ARCH
)-uClibc
143 STAGING_DIR
=$(BUILD_DIR
)
144 TOOL_BUILD_DIR
=$(BASE_DIR
)/toolchain_build_
$(ARCH
)$(ARCH_FPU_SUFFIX
)
145 TARGET_PATH
=/usr
/local
/bin
:$(STAGING_DIR
)/bin
:/bin
:/sbin
:/usr
/bin
:/usr
/sbin
146 #TARGET_CROSS=$(STAGING_DIR)/bin/$(ARCH)-uclibc-
147 TARGET_CROSS
=$(STAGING_DIR
)/bin
/$(ARCH
)-linux-uclibc-
148 TARGET_CC
=$(TARGET_CROSS
)gcc
$(TARGET_SOFT_FLOAT
)
149 STRIP
=$(TARGET_CROSS
)strip --remove-section
=.comment
--remove-section
=.note
151 IMAGE
:=$(BASE_DIR
)/root_fs_
$(ARCH
)$(ARCH_FPU_SUFFIX
)
152 GNU_TARGET_NAME
=$(OPTIMIZE_FOR_CPU
)-linux-uclibc
153 #KERNEL_CROSS=$(STAGING_DIR)/bin/$(ARCH)-uclibc-
154 KERNEL_CROSS
=$(STAGING_DIR
)/bin
/$(ARCH
)-linux-uclibc-
155 HOST_ARCH
:=$(shell $(HOSTCC
) -dumpmachine | sed
-e s
'/-.*//' \
156 -e
's/sparc.*/sparc/' \
158 -e
's/m68k.*/m68k/' \
159 -e
's/alpha.*/alpha/' \
160 -e
's/ppc/powerpc/g' \
161 -e
's/v850.*/v850/g' \
163 -e
's/mips-.*/mips/' \
164 -e
's/mipsel-.*/mipsel/' \
165 -e
's/cris.*/cris/' \
166 -e
's/i[3-9]86/i386/' \
168 GNU_HOST_NAME
:=$(HOST_ARCH
)-pc-linux-gnu
169 TARGET_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
178 ifeq ($(ENABLE_LOCALE
),true
)
181 DISABLE_NLS
:=--disable-nls
187 TARGETS_CLEAN
:=$(patsubst %,%-clean,$(TARGETS
))
188 TARGETS_SOURCE
:=$(patsubst %,%-source
,$(TARGETS
))
189 TARGETS_DIRCLEAN
:=$(patsubst %,%-dirclean
,$(TARGETS
))
191 world
: $(DL_DIR
) $(BUILD_DIR
) $(STAGING_DIR
) $(TARGETS
)
193 .PHONY
: all world
clean dirclean
distclean source
$(TARGETS
) \
194 $(TARGETS_CLEAN
) $(TARGETS_DIRCLEAN
) $(TARGETS_SOURCE
)
198 #############################################################
200 # staging and target directories do NOT list these as
201 # dependancies anywhere else
203 #############################################################
208 rm -rf
$(STAGING_DIR
)
209 mkdir
-p
$(BUILD_DIR
)
210 mkdir
-p
$(TOOL_BUILD_DIR
)
211 mkdir
-p
$(STAGING_DIR
)/lib
212 mkdir
-p
$(STAGING_DIR
)/usr
213 # mkdir -p $(STAGING_DIR)/include
214 ln
-fs ..
/lib
$(STAGING_DIR
)/usr
/lib
216 source
: $(TARGETS_SOURCE
)
218 #############################################################
220 # Cleanup and misc junk
222 #############################################################
223 clean: $(TARGETS_CLEAN
)
224 rm -rf
$(STAGING_DIR
) $(IMAGE
)
226 dirclean
: $(TARGETS_DIRCLEAN
)
227 rm -rf
$(STAGING_DIR
) $(IMAGE
)
230 rm -rf
$(DL_DIR
) $(BUILD_DIR
) $(LINUX_KERNEL
) $(IMAGE
)
236 rm -f buildroot.
tar.bz2
; \
237 tar -cvf buildroot.
tar buildroot
; \
238 bzip2
-9 buildroot.
tar; \