1 # Makefile for to build a gcc/uClibc toolchain
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
19 ifneq ($(GCC_2_95_TOOLCHAIN
),true
)
22 #GCC_SITE:=ftp://ftp.gnu.org/gnu/gcc/
23 #GCC_SOURCE:=gcc-3.3.tar.bz2
24 #GCC_DIR:=$(TOOL_BUILD_DIR)/gcc-3.3
29 #GCC_SITE:=ftp://ftp.gnu.org/gnu/gcc/gcc-$(GCC_VERSION)
30 #GCC_SITE:=http://www.binarycode.org/gcc/releases/gcc-$(GCC_VERSION)
31 GCC_SITE
:=http
://gcc.get-software.com
/releases
/gcc-
$(GCC_VERSION
)
35 #GCC_VERSION:=3.3-20031013
36 #GCC_SITE:=http://gcc.get-software.com/snapshots/$(GCC_VERSION)
38 GCC_SOURCE
:=gcc-
$(GCC_VERSION
).
tar.bz2
39 GCC_DIR
:=$(TOOL_BUILD_DIR
)/gcc-
$(GCC_VERSION
)
42 #############################################################
44 # Setup some initial stuff
46 #############################################################
48 ifeq ($(INSTALL_LIBSTDCPP
),true
)
49 TARGET_LANGUAGES
:=c
,c
++
54 #############################################################
56 # build the first pass gcc compiler
58 #############################################################
59 GCC_BUILD_DIR1
:=$(TOOL_BUILD_DIR
)/gcc-
$(GCC_VERSION
)-initial
61 $(DL_DIR
)/$(GCC_SOURCE
):
62 # $(WGET) -P $(DL_DIR) $(GCC_SITE)/$(GCC_SOURCE)
64 $(GCC_DIR
)/.unpacked
: $(DL_DIR
)/$(GCC_SOURCE
)
65 $(GCC_CAT
) $(DL_DIR
)/$(GCC_SOURCE
) |
tar -C
$(TOOL_BUILD_DIR
) -xvf
-
66 $(GCC_CAT
) $(DL_DIR
)/gcc-
$(GCC_VERSION
).
tar.bz2 |
tar -C
$(TOOL_BUILD_DIR
) -xvf
-
67 touch
$(GCC_DIR
)/.unpacked
69 $(GCC_DIR
)/.patched
: $(GCC_DIR
)/.unpacked
70 # Apply any files named gcc-*.patch from the source directory to gcc
71 $(SOURCE_DIR
)/patch-kernel.sh
$(GCC_DIR
) $(SOURCE_DIR
) gcc
/$(GCC_VERSION
)/*.patch
72 touch
$(GCC_DIR
)/.patched
74 $(GCC_DIR
)/.gcc3_3_build_hacks
: $(GCC_DIR
)/.patched
76 # Hack things to use the correct shared lib loader
78 (cd
$(GCC_DIR
); set
-e
; export LIST
=`grep -lr -- "-dynamic-linker.*\.so[\.0-9]*" *`;\
79 if
[ -n
"$$LIST" ] ; then \
80 $(SED
) "s,-dynamic-linker.*\.so[\.0-9]*},\
81 -dynamic-linker /lib/ld-uClibc.so.0},;" $$LIST; fi
);
83 # Prevent gcc from using the unwind-dw2-fde-glibc code used for
84 # unwinding stack frames for C++ exception handling. The
85 # unwind-dw2-fde-glibc code depends on glibc's ldso, we want to
86 # use the generic version instead.
88 $(SED
) "s,^#ifndef inhibit_libc,#define inhibit_libc\n\
89 #ifndef inhibit_libc,g;" $(GCC_DIR
)/gcc
/unwind-dw2-fde-glibc.c
;
91 # Prevent system glibc start files from leaking in uninvited...
93 $(SED
) "s,standard_startfile_prefix_1 = \".*,standard_startfile_prefix_1 =\
94 \"$(STAGING_DIR)/lib/\";,;" $(GCC_DIR
)/gcc
/gcc.c
;
95 $(SED
) "s,standard_startfile_prefix_2 = \".*,standard_startfile_prefix_2 =\
96 \"$(STAGING_DIR)/usr/lib/\";,;" $(GCC_DIR
)/gcc
/gcc.c
;
98 # Prevent system glibc include files from leaking in uninvited...
100 $(SED
) "s,^NATIVE_SYSTEM_HEADER_DIR.*,NATIVE_SYSTEM_HEADER_DIR=\
101 $(STAGING_DIR)/include,;" $(GCC_DIR
)/gcc
/Makefile.in
;
102 $(SED
) "s,^CROSS_SYSTEM_HEADER_DIR.*,CROSS_SYSTEM_HEADER_DIR=\
103 $(STAGING_DIR)/include,;" $(GCC_DIR
)/gcc
/Makefile.in
;
104 $(SED
) "s,^#define.*STANDARD_INCLUDE_DIR.*,#define STANDARD_INCLUDE_DIR \
105 \"$(STAGING_DIR)/include\",;" $(GCC_DIR
)/gcc
/cppdefault.h
;
107 # Prevent system glibc libraries from being found by collect2
108 # when it calls locatelib() and rummages about the system looking
109 # for libraries with the correct name...
111 $(SED
) "s,\"/lib,\"$(STAGING_DIR)/lib,g;" $(GCC_DIR
)/gcc
/collect2.c
112 $(SED
) "s,\"/usr/,\"$(STAGING_DIR)/usr/,g;" $(GCC_DIR
)/gcc
/collect2.c
113 touch
$(GCC_DIR
)/.gcc3_3_build_hacks
115 # The --without-headers option stopped working with gcc 3.0 and has never been
116 # # fixed, so we need to actually have working C library header files prior to
117 # # the step or libgcc will not build...
118 $(GCC_BUILD_DIR1
)/.configured
: $(GCC_DIR
)/.gcc3_3_build_hacks
119 mkdir
-p
$(GCC_BUILD_DIR1
)
120 echo
-e
"#!/bin/sh\nexec $(GCC_BUILD_DIR1)/gcc/xgcc -B$(GCC_BUILD_DIR1)/gcc/ -B$(STAGING_DIR)/$(ARCH)-linux/bin/ -B$(STAGING_DIR)/$(ARCH)-linux/lib/ -isystem $(STAGING_DIR)/$(ARCH)-linux/include $(TARGET_SOFT_FLOAT) \$$@" > $(GCC_BUILD_DIR1
)/target_gcc
121 chmod a
+x
$(GCC_BUILD_DIR1
)/target_gcc
122 (cd
$(GCC_BUILD_DIR1
); PATH
=$(TARGET_PATH
) AR
=$(TARGET_CROSS
)ar \
123 RANLIB
=$(TARGET_CROSS
)ranlib \
125 LDFLAGS
="$(HOSTLDFLAGS)" \
126 gcc_cv_as_hidden
=no \
127 $(GCC_DIR
)/configure \
128 --target
=$(GNU_TARGET_NAME
) \
129 --host
=$(GNU_HOST_NAME
) \
130 --build
=$(GNU_HOST_NAME
) \
131 --prefix=$(STAGING_DIR
) \
132 --exec-prefix
=$(STAGING_DIR
) \
133 --bindir=$(STAGING_DIR
)/bin \
134 --sbindir
=$(STAGING_DIR
)/sbin \
135 --sysconfdir
=$(STAGING_DIR
)/etc \
136 --datadir=$(STAGING_DIR
)/share \
137 --includedir=$(STAGING_DIR
)/include \
138 --libdir=$(STAGING_DIR
)/lib \
139 --localstatedir
=$(STAGING_DIR
)/var \
140 --mandir=$(STAGING_DIR
)/man \
141 --infodir=$(STAGING_DIR
)/info \
142 --with-local-prefix
=$(STAGING_DIR
)/usr
/local \
143 --oldincludedir=$(STAGING_DIR
)/include $(MULTILIB
) \
144 --enable-target-optspace
$(DISABLE_NLS
) --with-gnu-ld \
145 --disable-shared
--enable-languages
=c
--disable-__cxa_atexit \
146 $(SOFT_FLOAT_CONFIG_OPTION
) \
147 $(EXTRA_GCC_CONFIG_OPTIONS
) --program-prefix
=$(ARCH
)-linux-uclibc-
);
148 touch
$(GCC_BUILD_DIR1
)/.configured
150 $(GCC_BUILD_DIR1
)/.compiled
: $(GCC_BUILD_DIR1
)/.configured
151 PATH
=$(TARGET_PATH
) $(MAKE
) $(JLEVEL
) -C
$(GCC_BUILD_DIR1
) \
153 LDFLAGS
="$(HOSTLDFLAGS)" \
154 AR_FOR_TARGET
=$(STAGING_DIR
)/bin
/$(ARCH
)-linux-uclibc-ar \
155 RANLIB_FOR_TARGET
=$(STAGING_DIR
)/bin
/$(ARCH
)-linux-uclibc-ranlib \
156 CC_FOR_TARGET
=$(GCC_BUILD_DIR1
)/target_gcc \
157 GCC_FOR_TARGET
=$(GCC_BUILD_DIR1
)/target_gcc
158 touch
$(GCC_BUILD_DIR1
)/.compiled
160 $(STAGING_DIR
)/bin
/$(ARCH
)-linux-uclibc-gcc
: $(GCC_BUILD_DIR1
)/.compiled
161 PATH
=$(TARGET_PATH
) $(MAKE
) $(JLEVEL
) \
163 LDFLAGS
="$(HOSTLDFLAGS)" \
164 -C
$(GCC_BUILD_DIR1
) install;
165 #Cleanup then mess when --program-prefix mysteriously fails
166 -mv
$(STAGING_DIR
)/bin
/$(GNU_TARGET_NAME
)-cpp $(STAGING_DIR
)/bin
/$(ARCH
)-linux-uclibc-cpp
167 -mv
$(STAGING_DIR
)/bin
/$(GNU_TARGET_NAME
)-gcc
$(STAGING_DIR
)/bin
/$(ARCH
)-linux-uclibc-gcc
168 if
[ -n
"$(strip $(TARGET_SOFT_FLOAT))" ] ; then \
169 for app in gcc c
++ g
++ ; do \
170 if
[ -x
$(STAGING_DIR
)/bin
/$(ARCH
)-linux-uclibc-
$${app} ] ; then \
171 (cd
$(STAGING_DIR
)/bin
; \
172 rm -f
$(ARCH
)-linux-uclibc-
$${app}$(TARGET_SOFT_FLOAT
); \
173 echo
-e
"#!/bin/sh\nexec $(STAGING_DIR)/bin/$(ARCH)-linux-uclibc-$${app} -msoft-float \$$@" > $(ARCH
)-linux-uclibc-
$${app}$(TARGET_SOFT_FLOAT
); \
174 chmod a
+x
$(ARCH
)-linux-uclibc-
$${app}$(TARGET_SOFT_FLOAT
); \
179 rm -f
$(STAGING_DIR
)/bin
/gccbug
$(STAGING_DIR
)/bin
/gcov
180 rm -rf
$(STAGING_DIR
)/info $(STAGING_DIR
)/man
$(STAGING_DIR
)/share
/doc \
181 $(STAGING_DIR
)/share
/locale
183 gcc3_3_initial
: binutils uclibc-configured
$(STAGING_DIR
)/bin
/$(ARCH
)-linux-uclibc-gcc
185 gcc3_3_initial-clean
:
186 rm -rf
$(GCC_BUILD_DIR1
)
187 rm -f
$(STAGING_DIR
)/bin
/$(GNU_TARGET_NAME
)*
189 gcc3_3_initial-dirclean
:
190 rm -rf
$(GCC_BUILD_DIR1
)
192 #############################################################
194 # second pass compiler build. Build the compiler targeting
195 # the newly built shared uClibc library.
197 #############################################################
198 GCC_BUILD_DIR2
:=$(TOOL_BUILD_DIR
)/gcc-
$(GCC_VERSION
)-final
199 $(GCC_BUILD_DIR2
)/.configured
: $(GCC_DIR
)/.patched
200 mkdir
-p
$(GCC_BUILD_DIR2
)
201 echo
-e
"#!/bin/sh\nexec $(GCC_BUILD_DIR2)/gcc/xgcc -B$(GCC_BUILD_DIR2)/gcc/ -B$(STAGING_DIR)/$(ARCH)-linux/bin/ -B$(STAGING_DIR)/$(ARCH)-linux/lib/ -isystem $(STAGING_DIR)/$(ARCH)-linux/include $(TARGET_SOFT_FLOAT) \$$@" > $(GCC_BUILD_DIR2
)/target_g
++
202 chmod a
+x
$(GCC_BUILD_DIR2
)/target_g
++
203 echo
-e
"#!/bin/sh\nexec $(GCC_BUILD_DIR2)/gcc/xgcc -B$(GCC_BUILD_DIR2)/gcc/ -B$(STAGING_DIR)/$(ARCH)-linux/bin/ -B$(STAGING_DIR)/$(ARCH)-linux/lib/ -isystem $(STAGING_DIR)/$(ARCH)-linux/include $(TARGET_SOFT_FLOAT) \$$@" > $(GCC_BUILD_DIR2
)/target_gcc
204 chmod a
+x
$(GCC_BUILD_DIR2
)/target_gcc
205 (cd
$(GCC_BUILD_DIR2
); PATH
=$(TARGET_PATH
) AR
=$(TARGET_CROSS
)ar \
206 RANLIB
=$(TARGET_CROSS
)ranlib LD
=$(TARGET_CROSS
)ld \
207 NM
=$(TARGET_CROSS
)nm \
209 LDFLAGS
="$(HOSTLDFLAGS)" \
210 gcc_cv_as_hidden
=no \
211 $(GCC_DIR
)/configure \
212 --target
=$(GNU_TARGET_NAME
) \
213 --host
=$(GNU_HOST_NAME
) \
214 --build
=$(GNU_HOST_NAME
) \
215 --prefix=$(STAGING_DIR
) \
216 --exec-prefix
=$(STAGING_DIR
) \
217 --bindir=$(STAGING_DIR
)/bin \
218 --sbindir
=$(STAGING_DIR
)/sbin \
219 --sysconfdir
=$(STAGING_DIR
)/etc \
220 --datadir=$(STAGING_DIR
)/share \
221 --localstatedir
=$(STAGING_DIR
)/var \
222 --mandir=$(STAGING_DIR
)/man \
223 --infodir=$(STAGING_DIR
)/info \
224 --with-local-prefix
=$(STAGING_DIR
)/usr
/local \
225 --libdir=$(STAGING_DIR
)/lib \
226 --includedir=$(STAGING_DIR
)/include \
227 --with-gxx-include-dir
=$(STAGING_DIR
)/include/c
++ \
228 --oldincludedir=$(STAGING_DIR
)/include \
229 --enable-shared
$(MULTILIB
) \
230 --enable-target-optspace
$(DISABLE_NLS
) \
231 --with-gnu-ld
--disable-__cxa_atexit \
232 --enable-languages
=$(TARGET_LANGUAGES
) \
233 $(EXTRA_GCC_CONFIG_OPTIONS
) \
234 --program-prefix
=$(ARCH
)-linux-uclibc- \
236 touch
$(GCC_BUILD_DIR2
)/.configured
238 $(GCC_BUILD_DIR2
)/.compiled
: $(GCC_BUILD_DIR2
)/.configured
239 # $(SED) 's/\-lc//' $(GCC_BUILD_DIR2)/gcc/Makefile
240 PATH
=$(TARGET_PATH
) $(MAKE
) $(JLEVEL
) \
242 LDFLAGS
="$(HOSTLDFLAGS)" \
243 AR_FOR_TARGET
=$(TARGET_CROSS
)ar RANLIB_FOR_TARGET
=$(TARGET_CROSS
)ranlib \
244 LD_FOR_TARGET
=$(TARGET_CROSS
)ld NM_FOR_TARGET
=$(TARGET_CROSS
)nm \
245 CC_FOR_TARGET
=$(GCC_BUILD_DIR2
)/target_gcc \
246 GCC_FOR_TARGET
=$(GCC_BUILD_DIR2
)/target_gcc \
247 CXX_FOR_TARGET
=$(GCC_BUILD_DIR2
)/target_g
++ \
249 touch
$(GCC_BUILD_DIR2
)/.compiled
251 $(GCC_BUILD_DIR2
)/.installed
: $(GCC_BUILD_DIR2
)/.compiled
$(STAGING_DIR
)/lib
/libc.a
252 PATH
=$(TARGET_PATH
) $(MAKE
) $(JLEVEL
) \
254 LDFLAGS
="$(HOSTLDFLAGS)" \
255 -C
$(GCC_BUILD_DIR2
) install;
256 -mv
$(STAGING_DIR
)/bin
/gcc
$(STAGING_DIR
)/usr
/bin
;
257 -mv
$(STAGING_DIR
)/bin
/protoize
$(STAGING_DIR
)/usr
/bin
;
258 -mv
$(STAGING_DIR
)/bin
/unprotoize
$(STAGING_DIR
)/usr
/bin
;
259 -mv
$(STAGING_DIR
)/bin
/$(GNU_TARGET_NAME
)-cpp $(STAGING_DIR
)/bin
/$(ARCH
)-linux-uclibc-cpp
260 -mv
$(STAGING_DIR
)/bin
/$(GNU_TARGET_NAME
)-gcc
$(STAGING_DIR
)/bin
/$(ARCH
)-linux-uclibc-gcc
261 -mv
$(STAGING_DIR
)/bin
/$(GNU_TARGET_NAME
)-c
++ $(STAGING_DIR
)/bin
/$(ARCH
)-linux-uclibc-c
++
262 -mv
$(STAGING_DIR
)/bin
/$(GNU_TARGET_NAME
)-g
++ $(STAGING_DIR
)/bin
/$(ARCH
)-linux-uclibc-g
++
263 -mv
$(STAGING_DIR
)/bin
/$(GNU_TARGET_NAME
)-c
++filt
$(STAGING_DIR
)/bin
/$(ARCH
)-linux-uclibc-c
++filt
264 rm -f
$(STAGING_DIR
)/bin
/cpp $(STAGING_DIR
)/bin
/gcov
$(STAGING_DIR
)/bin
/*gccbug
265 rm -f
$(STAGING_DIR
)/bin
/$(GNU_TARGET_NAME
)-$(ARCH
)-linux-uclibc-
*
266 rm -rf
$(STAGING_DIR
)/info $(STAGING_DIR
)/man
$(STAGING_DIR
)/share
/doc \
267 $(STAGING_DIR
)/share
/locale
268 # Strip the host binaries
269 -strip --strip-all
-R .note
-R .comment
$(STAGING_DIR
)/bin
/*
270 if
[ -n
"$(strip $(TARGET_SOFT_FLOAT))" ] ; then \
271 for app in gcc c
++ g
++ ; do \
272 if
[ -x
$(STAGING_DIR
)/bin
/$(ARCH
)-linux-uclibc-
$${app} ] ; then \
273 (cd
$(STAGING_DIR
)/bin
; \
274 rm -f
$(ARCH
)-linux-uclibc-
$${app}$(TARGET_SOFT_FLOAT
); \
275 echo
-e
"#!/bin/sh\nexec $(STAGING_DIR)/bin/$(ARCH)-linux-uclibc-$${app} -msoft-float \$$@" > $(ARCH
)-linux-uclibc-
$${app}$(TARGET_SOFT_FLOAT
); \
276 chmod a
+x
$(ARCH
)-linux-uclibc-
$${app}$(TARGET_SOFT_FLOAT
); \
282 for app in
cc gcc c89
cpp c
++ g
++ ; do \
283 if
[ -x
$(STAGING_DIR
)/bin
/$(ARCH
)-linux-uclibc-
$${app} ] ; then \
284 (cd
$(STAGING_DIR
)/usr
/bin
; \
285 ln
-fs ..
/..
/bin
/$(ARCH
)-linux-uclibc-
$${app} $${app}; \
289 (cd
$(STAGING_DIR
)/usr
/bin
; \
292 touch
$(GCC_BUILD_DIR2
)/.installed
294 ifneq ($(TARGET_DIR
),)
295 $(TARGET_DIR
)/lib
/libstdc
++.so
.5.0.5: $(GCC_BUILD_DIR2
)/.installed
296 cp
-a
$(STAGING_DIR
)/lib
/libstdc
++.so
* $(TARGET_DIR
)/lib
/
298 $(GCC_BUILD_DIR2
)/.shared_libgcc
: $(GCC_BUILD_DIR2
)/.installed
299 cp
-fa
$(STAGING_DIR
)/lib
/libgcc_s.so
* $(TARGET_DIR
)/lib
/ ; \
300 touch
$(GCC_BUILD_DIR2
)/.shared_libgcc
302 GCC_TARGETS
:=$(GCC_BUILD_DIR2
)/.shared_libgcc
303 ifeq ($(INSTALL_LIBSTDCPP
),true
)
304 GCC_TARGETS
+=$(TARGET_DIR
)/lib
/libstdc
++.so
.5.0.5
309 gcc3_3
: binutils uclibc-configured gcc3_3_initial
$(LIBFLOAT_TARGET
) uclibc \
310 $(GCC_BUILD_DIR2
)/.installed
$(GCC_TARGETS
)
312 gcc3_3-source
: $(DL_DIR
)/$(GCC_SOURCE
)
315 rm -rf
$(GCC_BUILD_DIR2
)
316 rm -f
$(STAGING_DIR
)/bin
/$(GNU_TARGET_NAME
)*
319 rm -rf
$(GCC_BUILD_DIR2
)
321 #############################################################
323 # Next build target gcc compiler
325 #############################################################
326 GCC_BUILD_DIR3
:=$(BUILD_DIR
)/gcc-
$(GCC_VERSION
)-target
328 TARGET_GCC_ARGS
= $(TARGET_CONFIGURE_OPTS
) \
333 RANLIB_FOR_BUILD
=ranlib \
335 LDFLAGS
="$(HOSTLDFLAGS)" \
336 CC_FOR_BUILD
="$(HOSTCC)" \
337 GCC_FOR_BUILD
="$(HOSTCC)" \
338 CXX_FOR_BUILD
="$(HOSTCC)" \
339 AR_FOR_TARGET
=$(TARGET_CROSS
)ar \
340 AS_FOR_TARGET
=$(TARGET_CROSS
)as \
341 LD_FOR_TARGET
=$(TARGET_CROSS
)ld \
342 NM_FOR_TARGET
=$(TARGET_CROSS
)nm \
343 CC
="$(TARGET_CROSS)gcc$(TARGET_SOFT_FLOAT) -isystem $(STAGING_DIR)/include" \
344 GCC
="$(TARGET_CROSS)gcc$(TARGET_SOFT_FLOAT) -isystem $(STAGING_DIR)/include" \
345 CXX
="$(TARGET_CROSS)g++$(TARGET_SOFT_FLOAT) -isystem $(STAGING_DIR)/include" \
346 CC_FOR_TARGET
="$(TARGET_CROSS)gcc$(TARGET_SOFT_FLOAT) -isystem $(STAGING_DIR)/include" \
347 GCC_FOR_TARGET
="$(TARGET_CROSS)gcc$(TARGET_SOFT_FLOAT) -isystem $(STAGING_DIR)/include" \
348 CXX_FOR_TARGET
="$(TARGET_CROSS)g++$(TARGET_SOFT_FLOAT) -isystem $(STAGING_DIR)/include" \
349 RANLIB_FOR_TARGET
=$(TARGET_CROSS
)ranlib
351 # We need to unpack a pristine source tree to avoid some of
352 # the previously applied hacks, which do not apply here...
353 $(GCC_BUILD_DIR3
)/.unpacked
: $(DL_DIR
)/$(GCC_SOURCE
)
354 $(GCC_CAT
) $(DL_DIR
)/$(GCC_SOURCE
) |
tar -C
$(BUILD_DIR
) -xvf
-
355 mv
$(BUILD_DIR
)/gcc-
$(GCC_VERSION
) $(GCC_BUILD_DIR3
)
356 touch
$(GCC_BUILD_DIR3
)/.unpacked
358 $(GCC_BUILD_DIR3
)/.patched
: $(GCC_BUILD_DIR3
)/.unpacked
359 # Apply any files named gcc-*.patch from the source directory to gcc
360 $(SOURCE_DIR
)/patch-kernel.sh
$(GCC_BUILD_DIR3
) $(SOURCE_DIR
) gcc
/$(GCC_VERSION
)/*.patch
361 touch
$(GCC_BUILD_DIR3
)/.patched
363 $(GCC_BUILD_DIR3
)/.gcc3_3_build_hacks
: $(GCC_BUILD_DIR3
)/.patched
365 # Hack things to use the correct shared lib loader
367 (cd
$(GCC_BUILD_DIR3
); set
-e
; export LIST
=`grep -lr -- "-dynamic-linker.*\.so[\.0-9]*" *`;\
368 if
[ -n
"$$LIST" ] ; then \
369 $(SED
) "s,-dynamic-linker.*\.so[\.0-9]*},\
370 -dynamic-linker /lib/ld-uClibc.so.0},;" $$LIST; fi
);
372 # Prevent gcc from using the unwind-dw2-fde-glibc code used for
373 # unwinding stack frames for C++ exception handling. The
374 # unwind-dw2-fde-glibc code depends on glibc's ldso, we want to
375 # use the generic version instead.
377 $(SED
) "s,^#ifndef inhibit_libc,#define inhibit_libc\n\
378 #ifndef inhibit_libc,g;" $(GCC_BUILD_DIR3
)/gcc
/unwind-dw2-fde-glibc.c
;
379 touch
$(GCC_BUILD_DIR3
)/.gcc3_3_build_hacks
381 $(GCC_BUILD_DIR3
)/.configured
: $(GCC_BUILD_DIR3
)/.gcc3_3_build_hacks
382 mkdir
-p
$(GCC_BUILD_DIR3
)
383 #(cd $(GCC_BUILD_DIR3); ln -fs $(ARCH)-linux-uclibc- build-$(GNU_TARGET_NAME))
384 (cd
$(GCC_BUILD_DIR3
); \
386 gcc_cv_as_hidden
=no \
389 --target
=$(GNU_TARGET_NAME
) \
390 --host
=$(GNU_TARGET_NAME
) \
391 --build
=`./config.guess` \
394 --infodir=/usr
/info \
395 --with-gxx-include-dir
=/usr
/include/c
++/$(GCC_VERSION
) \
396 --enable-target-optspace \
400 --with-gnu-ld
--disable-__cxa_atexit \
401 --enable-languages
=$(TARGET_LANGUAGES
) \
402 $(EXTRA_GCC_CONFIG_OPTIONS
) \
404 touch
$(GCC_BUILD_DIR3
)/.configured
406 $(GCC_BUILD_DIR3
)/.compiled
: $(GCC_BUILD_DIR3
)/.configured
407 $(MAKE
) $(JLEVEL
) $(TARGET_GCC_ARGS
) -C
$(GCC_BUILD_DIR3
)
408 touch
$(GCC_BUILD_DIR3
)/.compiled
410 $(TARGET_DIR
)/usr
/bin
/gcc
: $(GCC_BUILD_DIR3
)/.compiled
411 $(MAKE
) $(JLEVEL
) $(TARGET_GCC_ARGS
) DESTDIR
=$(TARGET_DIR
) \
412 -C
$(GCC_BUILD_DIR3
) install
413 (cd
$(TARGET_DIR
)/usr
/bin
; ln
-fs gcc
cc)
414 (cd
$(TARGET_DIR
)/lib
; ln
-fs
/usr
/bin
/cpp)
415 rm -rf
$(TARGET_DIR
)/usr
/$(GNU_TARGET_NAME
)/include
416 rm -rf
$(TARGET_DIR
)/usr
/$(GNU_TARGET_NAME
)/sys-include
417 rm -rf
$(TARGET_DIR
)/usr
/include/include $(TARGET_DIR
)/usr
/usr
418 -mv
$(TARGET_DIR
)/lib
/*.a
$(TARGET_DIR
)/usr
/lib
/
419 -mv
$(TARGET_DIR
)/lib
/*.la
$(TARGET_DIR
)/usr
/lib
/
420 rm -f
$(TARGET_DIR
)/lib
/libstdc
++.so
*
421 # Make sure gcc does not think we are cross compiling
422 $(SED
) "s/^1/0/;" $(TARGET_DIR
)/usr
/lib
/gcc-lib
/$(ARCH
)-linux
/$(GCC_VERSION
)/specs
423 -(cd
$(TARGET_DIR
)/bin
; find
-type f | xargs
$(STRIP
) > /dev
/null
2>&1)
424 -(cd
$(TARGET_DIR
)/usr
/bin
; find
-type f | xargs
$(STRIP
) > /dev
/null
2>&1)
425 -(cd
$(TARGET_DIR
)/usr
/lib
/gcc-lib
/$(ARCH
)-linux
/$(GCC_VERSION
); $(STRIP
) cc1 cc1plus collect2
> /dev
/null
2>&1)
426 -(cd
$(TARGET_DIR
)/usr
/lib
; $(STRIP
) libstdc
++.so.
*.
*.
* > /dev
/null
2>&1)
427 -(cd
$(TARGET_DIR
)/lib
; $(STRIP
) libgcc_s.so.
*.
*.
* > /dev
/null
2>&1)
429 rm -f
$(TARGET_DIR
)/usr
/lib
/*.la
*
430 rm -rf
$(TARGET_DIR
)/share
/locale
$(TARGET_DIR
)/usr
/info \
431 $(TARGET_DIR
)/usr
/man
$(TARGET_DIR
)/usr
/share
/doc
432 # Work around problem of missing syslimits.h
433 cp
-f
$(STAGING_DIR
)/usr
/lib
/gcc-lib
/$(ARCH
)-linux
/$(GCC_VERSION
)/include/syslimits.h
$(TARGET_DIR
)/usr
/lib
/gcc-lib
/$(ARCH
)-linux
/$(GCC_VERSION
)/include/
434 # These are in /lib, so...
435 # rm -rf $(TARGET_DIR)/usr/lib/libgcc_s.so*
436 touch
-c
$(TARGET_DIR
)/usr
/bin
/gcc
438 gcc3_3_target
: uclibc_target binutils_target
$(TARGET_DIR
)/usr
/bin
/gcc
441 rm -rf
$(GCC_BUILD_DIR3
)
442 rm -f
$(TARGET_DIR
)/bin
/$(GNU_TARGET_NAME
)*
444 gcc3_3_target-dirclean
:
445 rm -rf
$(GCC_BUILD_DIR3
)