uClibc-Update.
authorms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Wed, 25 Oct 2006 18:11:37 +0000 (18:11 +0000)
committerms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Wed, 25 Oct 2006 18:11:37 +0000 (18:11 +0000)
git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@328 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8

lfs/postfix
lfs/uClibc
make.sh
src/install+setup/install/main.c
src/uClibc/Makefile
src/uClibc/make/binutils.mk
src/uClibc/make/gcc.mk
src/uClibc/make/uclibc.mk

index a294b32..b0a84a3 100644 (file)
@@ -34,7 +34,7 @@ DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 TARGET     = $(DIR_INFO)/$(THISAPP)
 PROG       = postfix
-PAK_VER    = ipfire-beta1
+PAK_VER    = 1
 
 ###############################################################################
 # Top-level Rules
index 1164abb..ae0e013 100644 (file)
@@ -81,10 +81,14 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
                        -e 's/UCLIBC_HAS_FTW=y/# UCLIBC_HAS_FTW is not set/' \
                        -e 's,/usr/src/linux,&-$(KVER),' -i sources/uClibc.config-$(MACHINE)
        cd $(DIR_APP) && sed -e 's,^LINUX_DIR.*$$,&-$(KVER),' -i make/uclibc.mk
+
+       -mkdir -p /usr/src/$(THISAPP)/toolchain_build_$(MACHINE)/uClibc_dev/usr
+       ln -fs /usr/include /usr/src/$(THISAPP)/toolchain_build_$(MACHINE)/uClibc_dev/usr/include
+
        cd $(DIR_APP) && chmod +x sources/patch-kernel.sh
-       cd $(DIR_APP) && make
+       cd $(DIR_APP) && make JLEVEL=$(MAKETUNING)
        -mkdir -p /install/initrd/bin
-       cd $(DIR_APP)/toolchain_build_$(MACHINE)/$(THISAPP) && make PREFIX=/opt/$(MACHINE)-uClibc install
+       cd $(DIR_APP)/toolchain_build_$(MACHINE)/$(THISAPP) &&  make PREFIX=/opt/$(MACHINE)-uClibc install
        cd $(DIR_APP)/toolchain_build_$(MACHINE)/$(THISAPP) && make RUNTIME_PREFIX=/install/initrd/ install_runtime
        chmod 755 /install/initrd/lib/libuClibc-$(VER).so
        rm -f /install/initrd/lib/{libm*,libcrypt*,libutil*,librt*}
diff --git a/make.sh b/make.sh
index fd279d8..655a00c 100644 (file)
--- a/make.sh
+++ b/make.sh
@@ -135,11 +135,11 @@ prepareenv() {
     echo -ne "Checking for necessary space on disk $BASE_DEV" | tee -a $LOGFILE
     BASE_DEV=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $1 }'`
     BASE_ASPACE=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $4 }'`
-    if (( 2202000 > $BASE_ASPACE )); then
+    if (( 5242880 > $BASE_ASPACE )); then
        BASE_USPACE=`du -skx $BASEDIR | awk '{print $1}'`
-       if (( 2202000 - $BASE_USPACE > $BASE_ASPACE )); then
+       if (( 5242880 - $BASE_USPACE > $BASE_ASPACE )); then
                beautify message FAIL
-               exiterror "Not enough temporary space available, need at least 2.1GB on $BASE_DEV"
+               exiterror "Not enough temporary space available, need at least 5GB on $BASE_DEV"
        fi
     else
        beautify message DONE
index 2ca2f07..dcf4792 100644 (file)
@@ -553,7 +553,7 @@ int main(int argc, char *argv[])
                swap_file = 0;
        }
 
-       boot_partition = 8; /* in MB */
+       boot_partition = 20; /* in MB */
        current_free = maximum_free - boot_partition - swap_file;
 
        /* Give more place for add-on, extend root to 25% of current_free, upper limit to 8 gigas */
index b8c546e..5dcd74c 100644 (file)
@@ -99,7 +99,7 @@ JLEVEL=-j3
 #
 #############################################################
 USE_UCLIBC_TOOLCHAIN:=true
-TARGETS:=uclibc-configured binutils gcc3_3
+TARGETS:=uclibc-configured binutils gcc
 
 # Optimize toolchain for which type of CPU?
 # WARNING!!!  CURRENTLY BROKEN!!! LEAVE IT AS $(ARCH)!!!
@@ -193,7 +193,9 @@ world: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGETS)
 .PHONY: all world clean dirclean distclean source $(TARGETS) \
        $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE)
 
-include make/*.mk
+include make/binutils.mk
+include make/gcc.mk
+include make/uclibc.mk
 
 #############################################################
 #
index 47011bc..303f153 100644 (file)
@@ -24,7 +24,7 @@ $(BINUTILS_DIR)/.unpacked: $(DL_DIR)/$(BINUTILS_SOURCE)
        (cd $(STAGING_DIR)/$(GNU_TARGET_NAME); ln -fs ../lib)
        (cd $(STAGING_DIR)/$(GNU_TARGET_NAME); ln -fs ../include)
        (cd $(STAGING_DIR)/$(GNU_TARGET_NAME); ln -fs ../include sys-include)
-       $(BINUTILS_CAT) $(DL_DIR)/$(BINUTILS_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xvf -
+       $(BINUTILS_CAT) $(DL_DIR)/$(BINUTILS_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xf -
        touch $(BINUTILS_DIR)/.unpacked
 
 $(BINUTILS_DIR)/.patched: $(BINUTILS_DIR)/.unpacked
index e48de78..b0b24ab 100644 (file)
@@ -1,6 +1,7 @@
 # Makefile for to build a gcc/uClibc toolchain
 #
 # Copyright (C) 2002-2003 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2004 Manuel Novoa III <mjn3@uclibc.org>
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
-ifneq ($(GCC_2_95_TOOLCHAIN),true)
-
-# Older stuff...
-#GCC_SITE:=ftp://ftp.gnu.org/gnu/gcc/
-#GCC_SOURCE:=gcc-3.3.tar.bz2
-#GCC_DIR:=$(TOOL_BUILD_DIR)/gcc-3.3
-#GCC_CAT:=zcat
-
-# Shiny new stuff...
 GCC_VERSION:=4.0.3
-#GCC_SITE:=ftp://ftp.gnu.org/gnu/gcc/gcc-$(GCC_VERSION)
-#GCC_SITE:=http://www.binarycode.org/gcc/releases/gcc-$(GCC_VERSION)
-GCC_SITE:=http://gcc.get-software.com/releases/gcc-$(GCC_VERSION)
 
-#
-# snapshots....
-#GCC_VERSION:=3.3-20031013
-#GCC_SITE:=http://gcc.get-software.com/snapshots/$(GCC_VERSION)
-#
-GCC_SOURCE:=gcc-$(GCC_VERSION).tar.bz2
-GCC_DIR:=$(TOOL_BUILD_DIR)/gcc-$(GCC_VERSION)
-GCC_CAT:=bzip2 -dc
+ifeq ($(GCC_SNAP_DATE),)
+GCC_OFFICIAL_VER:=$(GCC_VERSION)
+GCC_SITE:=http://ftp.gnu.org/gnu/gcc/gcc-$(GCC_VERSION)
+#GCC_SITE:=ftp://ftp.ibiblio.org/pub/mirrors/gnu/ftp/gnu/gcc/gcc-$(GCC_OFFICIAL_VER)
+else
+GCC_OFFICIAL_VER:=$(GCC_VERSION)-$(GCC_SNAP_DATE)
+GCC_SITE:=ftp://sources.redhat.com/pub/gcc/snapshots/$(GCC_OFFICIAL_VER)
+endif
+
+GCC_SOURCE:=gcc-$(GCC_OFFICIAL_VER).tar.bz2
+GCC_DIR:=$(TOOL_BUILD_DIR)/gcc-$(GCC_OFFICIAL_VER)
+GCC_CAT:=bzcat
+GCC_STRIP_HOST_BINARIES:=true
 
 #############################################################
 #
@@ -45,6 +39,8 @@ GCC_CAT:=bzip2 -dc
 #
 #############################################################
 
+TARGET_LANGUAGES:=c
+
 ifeq ($(INSTALL_LIBSTDCPP),true)
 TARGET_LANGUAGES:=c,c++
 else
@@ -59,263 +55,219 @@ endif
 GCC_BUILD_DIR1:=$(TOOL_BUILD_DIR)/gcc-$(GCC_VERSION)-initial
 
 $(DL_DIR)/$(GCC_SOURCE):
+#      mkdir -p $(DL_DIR)
 #      $(WGET) -P $(DL_DIR) $(GCC_SITE)/$(GCC_SOURCE)
 
+gcc-unpacked: $(GCC_DIR)/.unpacked
 $(GCC_DIR)/.unpacked: $(DL_DIR)/$(GCC_SOURCE)
-       $(GCC_CAT) $(DL_DIR)/$(GCC_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xvf -
-       $(GCC_CAT) $(DL_DIR)/gcc-$(GCC_VERSION).tar.bz2 | tar -C $(TOOL_BUILD_DIR) -xvf -
+       mkdir -p $(TOOL_BUILD_DIR)
+       $(GCC_CAT) $(DL_DIR)/$(GCC_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xf -
+#      $(CONFIG_UPDATE) $(GCC_DIR)
        touch $(GCC_DIR)/.unpacked
 
+gcc-patched: $(GCC_DIR)/.patched
 $(GCC_DIR)/.patched: $(GCC_DIR)/.unpacked
        # Apply any files named gcc-*.patch from the source directory to gcc
-       $(SOURCE_DIR)/patch-kernel.sh $(GCC_DIR) $(SOURCE_DIR) gcc/$(GCC_VERSION)/*.patch
-       touch $(GCC_DIR)/.patched
+ifeq ($(GCC_SNAP_DATE),)
+       $(SOURCE_DIR)/patch-kernel.sh $(GCC_DIR) $(SOURCE_DIR) gcc/$(GCC_VERSION)\*.patch
+else
+ifneq ($(wildcard toolchain/gcc/$(GCC_OFFICIAL_VER)),)
+       $(SOURCE_DIR)/patch-kernel.sh $(GCC_DIR) $(SOURCE_DIR) gcc/$(GCC_OFFICIAL_VER)\*.patch
+else
+       $(SOURCE_DIR)/patch-kernel.sh $(GCC_DIR) $(SOURCE_DIR) gcc/$(GCC_VERSION)\*.patch
+endif
+endif
 
-$(GCC_DIR)/.gcc3_3_build_hacks: $(GCC_DIR)/.patched
-       #
-       # Hack things to use the correct shared lib loader
-       #
-       (cd $(GCC_DIR); set -e; export LIST=`grep -lr -- "-dynamic-linker.*\.so[\.0-9]*" *`;\
-               if [ -n "$$LIST" ] ; then \
-               $(SED) "s,-dynamic-linker.*\.so[\.0-9]*},\
-                   -dynamic-linker /lib/ld-uClibc.so.0},;" $$LIST; fi);
-       #
-       # Prevent gcc from using the unwind-dw2-fde-glibc code used for
-       # unwinding stack frames for C++ exception handling.  The
-       # unwind-dw2-fde-glibc code depends on glibc's ldso, we want to
-       # use the generic version instead.
-       #
-       $(SED) "s,^#ifndef inhibit_libc,#define inhibit_libc\n\
-               #ifndef inhibit_libc,g;" $(GCC_DIR)/gcc/unwind-dw2-fde-glibc.c;
-       #
-       # Prevent system glibc start files from leaking in uninvited...
-       #
-       $(SED) "s,standard_startfile_prefix_1 = \".*,standard_startfile_prefix_1 =\
-               \"$(STAGING_DIR)/lib/\";,;" $(GCC_DIR)/gcc/gcc.c;
-       $(SED) "s,standard_startfile_prefix_2 = \".*,standard_startfile_prefix_2 =\
-               \"$(STAGING_DIR)/usr/lib/\";,;" $(GCC_DIR)/gcc/gcc.c;
-       #
-       # Prevent system glibc include files from leaking in uninvited...
-       #
-       $(SED) "s,^NATIVE_SYSTEM_HEADER_DIR.*,NATIVE_SYSTEM_HEADER_DIR=\
-               $(STAGING_DIR)/include,;" $(GCC_DIR)/gcc/Makefile.in;
-       $(SED) "s,^CROSS_SYSTEM_HEADER_DIR.*,CROSS_SYSTEM_HEADER_DIR=\
-               $(STAGING_DIR)/include,;" $(GCC_DIR)/gcc/Makefile.in;
-       $(SED) "s,^#define.*STANDARD_INCLUDE_DIR.*,#define STANDARD_INCLUDE_DIR \
-               \"$(STAGING_DIR)/include\",;" $(GCC_DIR)/gcc/cppdefault.h;
-       #
-       # Prevent system glibc libraries from being found by collect2 
-       # when it calls locatelib() and rummages about the system looking 
-       # for libraries with the correct name...
-       #
-       $(SED) "s,\"/lib,\"$(STAGING_DIR)/lib,g;" $(GCC_DIR)/gcc/collect2.c
-       $(SED) "s,\"/usr/,\"$(STAGING_DIR)/usr/,g;" $(GCC_DIR)/gcc/collect2.c
-       touch $(GCC_DIR)/.gcc3_3_build_hacks
+       # Note: The soft float situation has improved considerably with gcc 3.4.x.
+       # We can dispense with the custom spec files, as well as libfloat for the arm case.
+       # However, we still need a patch for arm.  There's a similar patch for gcc 3.3.x
+       # which needs to be integrated so we can kill of libfloat for good, except for
+       # anyone (?) who might still be using gcc 2.95.  mjn3
+ifeq ($(BR2_SOFT_FLOAT),y)
+ifeq ("$(strip $(ARCH))","arm")
+       $(SOURCE_DIR)/patch-kernel.sh $(GCC_DIR) toolchain/gcc/$(GCC_VERSION) arm-softfloat.patch.conditional
+endif
+ifeq ("$(strip $(ARCH))","armeb")
+       $(SOURCE_DIR)/patch-kernel.sh $(GCC_DIR) toolchain/gcc/$(GCC_VERSION) arm-softfloat.patch.conditional
+endif
+       # Not yet updated to 3.4.1.
+       #ifeq ("$(strip $(ARCH))","i386")
+       #$(SOURCE_DIR)/patch-kernel.sh $(GCC_DIR) toolchain/gcc i386-gcc-soft-float.patch
+       #endif
+endif
+       touch $(GCC_DIR)/.patched
 
 # The --without-headers option stopped working with gcc 3.0 and has never been
-# # fixed, so we need to actually have working C library header files prior to
-# # the step or libgcc will not build...
-$(GCC_BUILD_DIR1)/.configured: $(GCC_DIR)/.gcc3_3_build_hacks
+# fixed, so we need to actually have working C library header files prior to
+# the step or libgcc will not build...
+
+$(GCC_BUILD_DIR1)/.configured: $(GCC_DIR)/.patched
        mkdir -p $(GCC_BUILD_DIR1)
-       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
-       chmod a+x $(GCC_BUILD_DIR1)/target_gcc
-       (cd $(GCC_BUILD_DIR1); PATH=$(TARGET_PATH) AR=$(TARGET_CROSS)ar \
-               RANLIB=$(TARGET_CROSS)ranlib \
+       (cd $(GCC_BUILD_DIR1); PATH=$(TARGET_PATH) \
                CC="$(HOSTCC)" \
-               LDFLAGS="$(HOSTLDFLAGS)" \
-               gcc_cv_as_hidden=no \
                $(GCC_DIR)/configure \
-               --target=$(GNU_TARGET_NAME) \
-               --host=$(GNU_HOST_NAME) \
-               --build=$(GNU_HOST_NAME) \
                --prefix=$(STAGING_DIR) \
-               --exec-prefix=$(STAGING_DIR) \
-               --bindir=$(STAGING_DIR)/bin \
-               --sbindir=$(STAGING_DIR)/sbin \
-               --sysconfdir=$(STAGING_DIR)/etc \
-               --datadir=$(STAGING_DIR)/share \
-               --includedir=$(STAGING_DIR)/include \
-               --libdir=$(STAGING_DIR)/lib \
-               --localstatedir=$(STAGING_DIR)/var \
-               --mandir=$(STAGING_DIR)/man \
-               --infodir=$(STAGING_DIR)/info \
-               --with-local-prefix=$(STAGING_DIR)/usr/local \
-               --oldincludedir=$(STAGING_DIR)/include $(MULTILIB) \
-               --enable-target-optspace $(DISABLE_NLS) --with-gnu-ld \
-               --disable-shared --enable-languages=c --disable-__cxa_atexit \
+               --build=$(GNU_HOST_NAME) \
+               --host=$(GNU_HOST_NAME) \
+               --target=$(REAL_GNU_TARGET_NAME) \
+               --enable-languages=c \
+               --with-sysroot=$(TOOL_BUILD_DIR)/uClibc_dev/ \
+               --disable-__cxa_atexit \
+               --enable-target-optspace \
+               --with-gnu-ld \
+               --disable-shared \
+               $(DISABLE_NLS) \
+               $(THREADS) \
+               $(MULTILIB) \
                $(SOFT_FLOAT_CONFIG_OPTION) \
-               $(EXTRA_GCC_CONFIG_OPTIONS) --program-prefix=$(ARCH)-linux-uclibc-);
+               $(GCC_WITH_CPU) $(GCC_WITH_ARCH) $(GCC_WITH_TUNE) \
+               $(EXTRA_GCC_CONFIG_OPTIONS));
        touch $(GCC_BUILD_DIR1)/.configured
 
 $(GCC_BUILD_DIR1)/.compiled: $(GCC_BUILD_DIR1)/.configured
-       PATH=$(TARGET_PATH) $(MAKE) $(JLEVEL) -C $(GCC_BUILD_DIR1) \
-           CC="$(HOSTCC)" \
-           LDFLAGS="$(HOSTLDFLAGS)" \
-           AR_FOR_TARGET=$(STAGING_DIR)/bin/$(ARCH)-linux-uclibc-ar \
-           RANLIB_FOR_TARGET=$(STAGING_DIR)/bin/$(ARCH)-linux-uclibc-ranlib \
-           CC_FOR_TARGET=$(GCC_BUILD_DIR1)/target_gcc \
-           GCC_FOR_TARGET=$(GCC_BUILD_DIR1)/target_gcc
+       PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR1) all-gcc
        touch $(GCC_BUILD_DIR1)/.compiled
 
-$(STAGING_DIR)/bin/$(ARCH)-linux-uclibc-gcc: $(GCC_BUILD_DIR1)/.compiled
-       PATH=$(TARGET_PATH) $(MAKE) $(JLEVEL) \
-           CC="$(HOSTCC)" \
-           LDFLAGS="$(HOSTLDFLAGS)" \
-           -C $(GCC_BUILD_DIR1) install;
-       #Cleanup then mess when --program-prefix mysteriously fails 
-       -mv $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-cpp $(STAGING_DIR)/bin/$(ARCH)-linux-uclibc-cpp
-       -mv $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-gcc $(STAGING_DIR)/bin/$(ARCH)-linux-uclibc-gcc
-       if [ -n "$(strip $(TARGET_SOFT_FLOAT))" ] ; then \
-               for app in gcc c++ g++ ; do \
-                       if [ -x $(STAGING_DIR)/bin/$(ARCH)-linux-uclibc-$${app} ] ; then \
-                           (cd $(STAGING_DIR)/bin; \
-                               rm -f $(ARCH)-linux-uclibc-$${app}$(TARGET_SOFT_FLOAT); \
-                               echo -e "#!/bin/sh\nexec $(STAGING_DIR)/bin/$(ARCH)-linux-uclibc-$${app} -msoft-float \$$@" > $(ARCH)-linux-uclibc-$${app}$(TARGET_SOFT_FLOAT); \
-                               chmod a+x $(ARCH)-linux-uclibc-$${app}$(TARGET_SOFT_FLOAT); \
-                           ); \
-                       fi; \
-               done; \
-       fi; \
-       rm -f $(STAGING_DIR)/bin/gccbug $(STAGING_DIR)/bin/gcov
-       rm -rf $(STAGING_DIR)/info $(STAGING_DIR)/man $(STAGING_DIR)/share/doc \
-               $(STAGING_DIR)/share/locale
+$(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gcc: $(GCC_BUILD_DIR1)/.compiled
+       PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR1) install-gcc
+       #rm -f $(STAGING_DIR)/bin/gccbug $(STAGING_DIR)/bin/gcov
+       #rm -rf $(STAGING_DIR)/info $(STAGING_DIR)/man $(STAGING_DIR)/share/doc $(STAGING_DIR)/share/locale
 
-gcc3_3_initial: binutils uclibc-configured $(STAGING_DIR)/bin/$(ARCH)-linux-uclibc-gcc
+gcc_initial: uclibc-configured binutils $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gcc
 
-gcc3_3_initial-clean:
+gcc_initial-clean:
        rm -rf $(GCC_BUILD_DIR1)
-       rm -f $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)*
 
-gcc3_3_initial-dirclean:
-       rm -rf $(GCC_BUILD_DIR1)
+gcc_initial-dirclean:
+       rm -rf $(GCC_BUILD_DIR1) $(GCC_DIR)
 
 #############################################################
 #
-# second pass compiler build.  Build the compiler targeting 
+# second pass compiler build.  Build the compiler targeting
 # the newly built shared uClibc library.
 #
 #############################################################
+#
+# Sigh... I had to rework things because using --with-gxx-include-dir
+# causes issues with include dir search order for g++.  This seems to
+# have something to do with "path translations" and possibly doesn't
+# affect gcc-target.  However, I haven't tested gcc-target yet so no
+# guarantees.  mjn3
+
 GCC_BUILD_DIR2:=$(TOOL_BUILD_DIR)/gcc-$(GCC_VERSION)-final
-$(GCC_BUILD_DIR2)/.configured: $(GCC_DIR)/.patched
+$(GCC_BUILD_DIR2)/.configured: $(GCC_DIR)/.patched $(STAGING_DIR)/lib/libc.a
        mkdir -p $(GCC_BUILD_DIR2)
-       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++
-       chmod a+x $(GCC_BUILD_DIR2)/target_g++
-       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
-       chmod a+x $(GCC_BUILD_DIR2)/target_gcc
-       (cd $(GCC_BUILD_DIR2); PATH=$(TARGET_PATH) AR=$(TARGET_CROSS)ar \
-               RANLIB=$(TARGET_CROSS)ranlib LD=$(TARGET_CROSS)ld \
-               NM=$(TARGET_CROSS)nm \
+       # Important!  Required for limits.h to be fixed.
+       ln -snf ../include $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include
+       (cd $(GCC_BUILD_DIR2); PATH=$(TARGET_PATH) \
                CC="$(HOSTCC)" \
-               LDFLAGS="$(HOSTLDFLAGS)" \
-               gcc_cv_as_hidden=no \
                $(GCC_DIR)/configure \
-               --target=$(GNU_TARGET_NAME) \
-               --host=$(GNU_HOST_NAME) \
-               --build=$(GNU_HOST_NAME) \
                --prefix=$(STAGING_DIR) \
-               --exec-prefix=$(STAGING_DIR) \
-               --bindir=$(STAGING_DIR)/bin \
-               --sbindir=$(STAGING_DIR)/sbin \
-               --sysconfdir=$(STAGING_DIR)/etc \
-               --datadir=$(STAGING_DIR)/share \
-               --localstatedir=$(STAGING_DIR)/var \
-               --mandir=$(STAGING_DIR)/man \
-               --infodir=$(STAGING_DIR)/info \
-               --with-local-prefix=$(STAGING_DIR)/usr/local \
-               --libdir=$(STAGING_DIR)/lib \
-               --includedir=$(STAGING_DIR)/include \
-               --with-gxx-include-dir=$(STAGING_DIR)/include/c++ \
-               --oldincludedir=$(STAGING_DIR)/include \
-               --enable-shared $(MULTILIB) \
-               --enable-target-optspace $(DISABLE_NLS) \
-               --with-gnu-ld --disable-__cxa_atexit \
+               --build=$(GNU_HOST_NAME) \
+               --host=$(GNU_HOST_NAME) \
+               --target=$(REAL_GNU_TARGET_NAME) \
                --enable-languages=$(TARGET_LANGUAGES) \
-               $(EXTRA_GCC_CONFIG_OPTIONS) \
-               --program-prefix=$(ARCH)-linux-uclibc- \
-       );
+               --disable-__cxa_atexit \
+               --enable-target-optspace \
+               --with-gnu-ld \
+               $(GCC_SHARED_LIBGCC) \
+               $(DISABLE_NLS) \
+               $(THREADS) \
+               $(MULTILIB) \
+               $(SOFT_FLOAT_CONFIG_OPTION) \
+               $(GCC_WITH_CPU) $(GCC_WITH_ARCH) $(GCC_WITH_TUNE) \
+               $(GCC_USE_SJLJ_EXCEPTIONS) \
+               $(EXTRA_GCC_CONFIG_OPTIONS));
        touch $(GCC_BUILD_DIR2)/.configured
 
 $(GCC_BUILD_DIR2)/.compiled: $(GCC_BUILD_DIR2)/.configured
-       # $(SED) 's/\-lc//' $(GCC_BUILD_DIR2)/gcc/Makefile
-       PATH=$(TARGET_PATH) $(MAKE) $(JLEVEL) \
-           CC="$(HOSTCC)" \
-           LDFLAGS="$(HOSTLDFLAGS)" \
-           AR_FOR_TARGET=$(TARGET_CROSS)ar RANLIB_FOR_TARGET=$(TARGET_CROSS)ranlib \
-           LD_FOR_TARGET=$(TARGET_CROSS)ld NM_FOR_TARGET=$(TARGET_CROSS)nm \
-           CC_FOR_TARGET=$(GCC_BUILD_DIR2)/target_gcc \
-           GCC_FOR_TARGET=$(GCC_BUILD_DIR2)/target_gcc \
-           CXX_FOR_TARGET=$(GCC_BUILD_DIR2)/target_g++ \
-           -C $(GCC_BUILD_DIR2)
+       PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR2) all
        touch $(GCC_BUILD_DIR2)/.compiled
 
-$(GCC_BUILD_DIR2)/.installed: $(GCC_BUILD_DIR2)/.compiled $(STAGING_DIR)/lib/libc.a
-       PATH=$(TARGET_PATH) $(MAKE) $(JLEVEL) \
-           CC="$(HOSTCC)" \
-           LDFLAGS="$(HOSTLDFLAGS)" \
-           -C $(GCC_BUILD_DIR2) install;
-       -mv $(STAGING_DIR)/bin/gcc $(STAGING_DIR)/usr/bin;
-       -mv $(STAGING_DIR)/bin/protoize $(STAGING_DIR)/usr/bin;
-       -mv $(STAGING_DIR)/bin/unprotoize $(STAGING_DIR)/usr/bin;
-       -mv $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-cpp $(STAGING_DIR)/bin/$(ARCH)-linux-uclibc-cpp
-       -mv $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-gcc $(STAGING_DIR)/bin/$(ARCH)-linux-uclibc-gcc
-       -mv $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-c++ $(STAGING_DIR)/bin/$(ARCH)-linux-uclibc-c++
-       -mv $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-g++ $(STAGING_DIR)/bin/$(ARCH)-linux-uclibc-g++
-       -mv $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-c++filt $(STAGING_DIR)/bin/$(ARCH)-linux-uclibc-c++filt
-       rm -f $(STAGING_DIR)/bin/cpp $(STAGING_DIR)/bin/gcov $(STAGING_DIR)/bin/*gccbug
-       rm -f $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-$(ARCH)-linux-uclibc-*
-       rm -rf $(STAGING_DIR)/info $(STAGING_DIR)/man $(STAGING_DIR)/share/doc \
-               $(STAGING_DIR)/share/locale
+$(GCC_BUILD_DIR2)/.installed: $(GCC_BUILD_DIR2)/.compiled
+       PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR2) install
+       if [ -d "$(STAGING_DIR)/lib64" ] ; then \
+               if [ ! -e "$(STAGING_DIR)/lib" ] ; then \
+                       mkdir "$(STAGING_DIR)/lib" ; \
+               fi ; \
+               mv "$(STAGING_DIR)/lib64/"* "$(STAGING_DIR)/lib/" ; \
+               rmdir "$(STAGING_DIR)/lib64" ; \
+       fi
        # Strip the host binaries
+ifeq ($(GCC_STRIP_HOST_BINARIES),true)
        -strip --strip-all -R .note -R .comment $(STAGING_DIR)/bin/*
-       if [ -n "$(strip $(TARGET_SOFT_FLOAT))" ] ; then \
-               for app in gcc c++ g++ ; do \
-                       if [ -x $(STAGING_DIR)/bin/$(ARCH)-linux-uclibc-$${app} ] ; then \
-                           (cd $(STAGING_DIR)/bin; \
-                               rm -f $(ARCH)-linux-uclibc-$${app}$(TARGET_SOFT_FLOAT); \
-                               echo -e "#!/bin/sh\nexec $(STAGING_DIR)/bin/$(ARCH)-linux-uclibc-$${app} -msoft-float \$$@" > $(ARCH)-linux-uclibc-$${app}$(TARGET_SOFT_FLOAT); \
-                               chmod a+x $(ARCH)-linux-uclibc-$${app}$(TARGET_SOFT_FLOAT); \
-                           ); \
-                       fi; \
-               done; \
-       fi; \
+endif
+       # Make sure we have 'cc'.
+       if [ ! -e $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-cc ] ; then \
+               ln -snf $(REAL_GNU_TARGET_NAME)-gcc \
+                       $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-cc ; \
+       fi;
+       if [ ! -e $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/bin/cc ] ; then \
+               ln -snf gcc $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/bin/cc ; \
+       fi;
+       # Set up the symlinks to enable lying about target name.
        set -e; \
-       for app in cc gcc c89 cpp c++ g++ ; do \
-               if [ -x $(STAGING_DIR)/bin/$(ARCH)-linux-uclibc-$${app} ] ; then \
-                   (cd $(STAGING_DIR)/usr/bin; \
-                       ln -fs ../../bin/$(ARCH)-linux-uclibc-$${app} $${app}; \
-                   ); \
-               fi; \
-       done;
-       (cd $(STAGING_DIR)/usr/bin; \
-               ln -fs gcc cc; \
-       )
+       (cd $(STAGING_DIR); \
+               ln -snf $(REAL_GNU_TARGET_NAME) $(GNU_TARGET_NAME); \
+               cd bin; \
+               for app in $(REAL_GNU_TARGET_NAME)-* ; do \
+                       ln -snf $${app} \
+                       $(GNU_TARGET_NAME)$${app##$(REAL_GNU_TARGET_NAME)}; \
+               done; \
+       );
+       #
+       # Now for the ugly 3.3.x soft float hack...
+       #
+ifeq ($(BR2_SOFT_FLOAT),y)
+ifeq ($(findstring 3.3.,$(GCC_VERSION)),3.3.)
+       # Make sure we have a soft float specs file for this arch
+       if [ ! -f toolchain/gcc/$(GCC_VERSION)/specs-$(ARCH)-soft-float ] ; then \
+               echo soft float configured but no specs file for this arch ; \
+               /bin/false ; \
+       fi;
+       # Replace specs file with one that defaults to soft float mode.
+       if [ ! -f $(STAGING_DIR)/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs ] ; then \
+               echo staging dir specs file is missing ; \
+               /bin/false ; \
+       fi;
+       cp toolchain/gcc/$(GCC_VERSION)/specs-$(ARCH)-soft-float $(STAGING_DIR)/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs
+endif
+endif
+       #
+       # Ok... that's enough of that.
+       #
        touch $(GCC_BUILD_DIR2)/.installed
 
-ifneq ($(TARGET_DIR),)
-$(TARGET_DIR)/lib/libstdc++.so.5.0.5: $(GCC_BUILD_DIR2)/.installed
-       cp -a $(STAGING_DIR)/lib/libstdc++.so* $(TARGET_DIR)/lib/
-
-$(GCC_BUILD_DIR2)/.shared_libgcc: $(GCC_BUILD_DIR2)/.installed
-       cp -fa $(STAGING_DIR)/lib/libgcc_s.so* $(TARGET_DIR)/lib/ ; \
-       touch $(GCC_BUILD_DIR2)/.shared_libgcc
-
-GCC_TARGETS:=$(GCC_BUILD_DIR2)/.shared_libgcc
-ifeq ($(INSTALL_LIBSTDCPP),true)
-GCC_TARGETS+=$(TARGET_DIR)/lib/libstdc++.so.5.0.5
+$(TARGET_DIR)/lib/libgcc_s.so.1: $(GCC_BUILD_DIR2)/.installed
+       # These are in /lib, so...
+       rm -rf $(TARGET_DIR)/usr/lib/libgcc_s*.so*
+       -cp -a $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libgcc_s* $(TARGET_DIR)/lib/
+ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
+       -cp -a $(STAGING_DIR)/lib/libstdc++.so* $(TARGET_DIR)/lib/
 endif
-
+ifeq ($(BR2_INSTALL_LIBGCJ),y)
+       -cp -a $(STAGING_DIR)/lib/libgcj.so* $(TARGET_DIR)/lib/
+       -cp -a $(STAGING_DIR)/lib/lib-org-w3c-dom.so* $(TARGET_DIR)/lib/
+       -cp -a $(STAGING_DIR)/lib/lib-org-xml-sax.so* $(TARGET_DIR)/lib/
+       -mkdir -p $(TARGET_DIR)/usr/lib/security
+       -cp -a $(STAGING_DIR)/usr/lib/security/libgcj.security $(TARGET_DIR)/usr/lib/security/
+       -cp -a $(STAGING_DIR)/usr/lib/security/classpath.security $(TARGET_DIR)/usr/lib/security/
 endif
+       touch -c $(TARGET_DIR)/lib/libgcc_s.so.1
 
-gcc3_3: binutils uclibc-configured gcc3_3_initial $(LIBFLOAT_TARGET) uclibc \
+gcc: uclibc-configured binutils gcc_initial $(LIBFLOAT_TARGET) uclibc \
        $(GCC_BUILD_DIR2)/.installed $(GCC_TARGETS)
 
-gcc3_3-source: $(DL_DIR)/$(GCC_SOURCE)
+gcc-source: $(DL_DIR)/$(GCC_SOURCE)
 
-gcc3_3-clean:
+gcc-clean:
        rm -rf $(GCC_BUILD_DIR2)
-       rm -f $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)*
+       for prog in cpp gcc gcc-[0-9]* protoize unprotoize gcov gccbug cc; do \
+           rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-$$prog \
+           rm -f $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-$$prog; \
+       done
 
-gcc3_3-dirclean:
+gcc-dirclean: gcc_initial-dirclean
        rm -rf $(GCC_BUILD_DIR2)
 
 #############################################################
@@ -325,123 +277,100 @@ gcc3_3-dirclean:
 #############################################################
 GCC_BUILD_DIR3:=$(BUILD_DIR)/gcc-$(GCC_VERSION)-target
 
-TARGET_GCC_ARGS= $(TARGET_CONFIGURE_OPTS) \
-               AR_FOR_BUILD=ar \
-               AS_FOR_BUILD=as \
-               LD_FOR_BUILD=ld \
-               NM_FOR_BUILD=nm \
-               RANLIB_FOR_BUILD=ranlib \
-               CC="$(HOSTCC)" \
-               LDFLAGS="$(HOSTLDFLAGS)" \
-               CC_FOR_BUILD="$(HOSTCC)" \
-               GCC_FOR_BUILD="$(HOSTCC)" \
-               CXX_FOR_BUILD="$(HOSTCC)" \
-               AR_FOR_TARGET=$(TARGET_CROSS)ar \
-               AS_FOR_TARGET=$(TARGET_CROSS)as \
-               LD_FOR_TARGET=$(TARGET_CROSS)ld \
-               NM_FOR_TARGET=$(TARGET_CROSS)nm \
-               CC="$(TARGET_CROSS)gcc$(TARGET_SOFT_FLOAT) -isystem $(STAGING_DIR)/include" \
-               GCC="$(TARGET_CROSS)gcc$(TARGET_SOFT_FLOAT) -isystem $(STAGING_DIR)/include" \
-               CXX="$(TARGET_CROSS)g++$(TARGET_SOFT_FLOAT) -isystem $(STAGING_DIR)/include" \
-               CC_FOR_TARGET="$(TARGET_CROSS)gcc$(TARGET_SOFT_FLOAT) -isystem $(STAGING_DIR)/include" \
-               GCC_FOR_TARGET="$(TARGET_CROSS)gcc$(TARGET_SOFT_FLOAT) -isystem $(STAGING_DIR)/include" \
-               CXX_FOR_TARGET="$(TARGET_CROSS)g++$(TARGET_SOFT_FLOAT) -isystem $(STAGING_DIR)/include" \
-               RANLIB_FOR_TARGET=$(TARGET_CROSS)ranlib
-
-# We need to unpack a pristine source tree to avoid some of
-# the previously applied hacks, which do not apply here...
-$(GCC_BUILD_DIR3)/.unpacked: $(DL_DIR)/$(GCC_SOURCE)
-       $(GCC_CAT) $(DL_DIR)/$(GCC_SOURCE) | tar -C $(BUILD_DIR) -xvf -
-       mv $(BUILD_DIR)/gcc-$(GCC_VERSION) $(GCC_BUILD_DIR3)
-       touch $(GCC_BUILD_DIR3)/.unpacked
-
-$(GCC_BUILD_DIR3)/.patched: $(GCC_BUILD_DIR3)/.unpacked
-       # Apply any files named gcc-*.patch from the source directory to gcc
-       $(SOURCE_DIR)/patch-kernel.sh $(GCC_BUILD_DIR3) $(SOURCE_DIR) gcc/$(GCC_VERSION)/*.patch
-       touch $(GCC_BUILD_DIR3)/.patched
-
-$(GCC_BUILD_DIR3)/.gcc3_3_build_hacks: $(GCC_BUILD_DIR3)/.patched
-       #
-       # Hack things to use the correct shared lib loader
-       #
-       (cd $(GCC_BUILD_DIR3); set -e; export LIST=`grep -lr -- "-dynamic-linker.*\.so[\.0-9]*" *`;\
-               if [ -n "$$LIST" ] ; then \
-               $(SED) "s,-dynamic-linker.*\.so[\.0-9]*},\
-                   -dynamic-linker /lib/ld-uClibc.so.0},;" $$LIST; fi);
-       #
-       # Prevent gcc from using the unwind-dw2-fde-glibc code used for
-       # unwinding stack frames for C++ exception handling.  The
-       # unwind-dw2-fde-glibc code depends on glibc's ldso, we want to
-       # use the generic version instead.
-       #
-       $(SED) "s,^#ifndef inhibit_libc,#define inhibit_libc\n\
-               #ifndef inhibit_libc,g;" $(GCC_BUILD_DIR3)/gcc/unwind-dw2-fde-glibc.c;
-       touch $(GCC_BUILD_DIR3)/.gcc3_3_build_hacks
-
-$(GCC_BUILD_DIR3)/.configured: $(GCC_BUILD_DIR3)/.gcc3_3_build_hacks
+$(GCC_BUILD_DIR3)/.configured: $(GCC_BUILD_DIR2)/.installed
        mkdir -p $(GCC_BUILD_DIR3)
-       #(cd $(GCC_BUILD_DIR3); ln -fs $(ARCH)-linux-uclibc- build-$(GNU_TARGET_NAME))
-       (cd $(GCC_BUILD_DIR3); \
-               $(TARGET_GCC_ARGS) \
-               gcc_cv_as_hidden=no \
-               ./configure \
-               --verbose \
-               --target=$(GNU_TARGET_NAME) \
-               --host=$(GNU_TARGET_NAME) \
-               --build=`./config.guess` \
+       (cd $(GCC_BUILD_DIR3); PATH=$(TARGET_PATH) \
+               $(GCC_DIR)/configure \
                --prefix=/usr \
-               --mandir=/usr/man \
-               --infodir=/usr/info \
-               --with-gxx-include-dir=/usr/include/c++/$(GCC_VERSION) \
+               --build=$(GNU_HOST_NAME) \
+               --host=$(REAL_GNU_TARGET_NAME) \
+               --target=$(REAL_GNU_TARGET_NAME) \
+               --enable-languages=$(TARGET_LANGUAGES) \
+               --with-gxx-include-dir=/usr/include/c++ \
+               --disable-__cxa_atexit \
                --enable-target-optspace \
-               --enable-shared \
-               $(MULTILIB) \
+               --with-gnu-ld \
+               $(GCC_SHARED_LIBGCC) \
                $(DISABLE_NLS) \
-               --with-gnu-ld --disable-__cxa_atexit \
-               --enable-languages=$(TARGET_LANGUAGES) \
-               $(EXTRA_GCC_CONFIG_OPTIONS) \
-       );
+               $(THREADS) \
+               $(MULTILIB) \
+               $(SOFT_FLOAT_CONFIG_OPTION) \
+               $(GCC_WITH_CPU) $(GCC_WITH_ARCH) $(GCC_WITH_TUNE) \
+               $(GCC_USE_SJLJ_EXCEPTIONS) \
+               $(EXTRA_GCC_CONFIG_OPTIONS));
        touch $(GCC_BUILD_DIR3)/.configured
 
 $(GCC_BUILD_DIR3)/.compiled: $(GCC_BUILD_DIR3)/.configured
-       $(MAKE) $(JLEVEL) $(TARGET_GCC_ARGS) -C $(GCC_BUILD_DIR3)
+       PATH=$(TARGET_PATH) \
+       $(MAKE) $(TARGET_GCC_ARGS) -C $(GCC_BUILD_DIR3) all
        touch $(GCC_BUILD_DIR3)/.compiled
 
+#
+# gcc-lib dir changes names to gcc with 3.4.mumble
+#
+ifeq ($(findstring 3.4.,$(GCC_VERSION)),3.4.)
+GCC_LIB_SUBDIR=lib/gcc/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)
+else
+GCC_LIB_SUBDIR=lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)
+endif
+# sigh... we need to find a better way
+ifeq ($(findstring 4.0.,$(GCC_VERSION)),4.0.)
+GCC_LIB_SUBDIR=lib/gcc/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)
+endif
+ifeq ($(findstring 4.1.,$(GCC_VERSION)),4.1.)
+GCC_LIB_SUBDIR=lib/gcc/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)
+endif
+ifeq ($(findstring 4.2.,$(GCC_VERSION)),4.2.)
+GCC_LIB_SUBDIR=lib/gcc/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)
+endif
+
 $(TARGET_DIR)/usr/bin/gcc: $(GCC_BUILD_DIR3)/.compiled
-       $(MAKE) $(JLEVEL) $(TARGET_GCC_ARGS) DESTDIR=$(TARGET_DIR) \
-               -C $(GCC_BUILD_DIR3) install
-       (cd $(TARGET_DIR)/usr/bin; ln -fs gcc cc)
-       (cd $(TARGET_DIR)/lib; ln -fs /usr/bin/cpp)
-       rm -rf $(TARGET_DIR)/usr/$(GNU_TARGET_NAME)/include
-       rm -rf $(TARGET_DIR)/usr/$(GNU_TARGET_NAME)/sys-include
-       rm -rf $(TARGET_DIR)/usr/include/include $(TARGET_DIR)/usr/usr
-       -mv $(TARGET_DIR)/lib/*.a $(TARGET_DIR)/usr/lib/
-       -mv $(TARGET_DIR)/lib/*.la $(TARGET_DIR)/usr/lib/
-       rm -f $(TARGET_DIR)/lib/libstdc++.so*
+       PATH=$(TARGET_PATH) \
+       $(MAKE) DESTDIR=$(TARGET_DIR) -C $(GCC_BUILD_DIR3) install
+       # Remove broken specs file (cross compile flag is set).
+       rm -f $(TARGET_DIR)/usr/$(GCC_LIB_SUBDIR)/specs
+       #
+       # Now for the ugly 3.3.x soft float hack...
+       #
+ifeq ($(BR2_SOFT_FLOAT),y)
+ifeq ($(findstring 3.3.,$(GCC_VERSION)),3.3.)
+       # Add a specs file that defaults to soft float mode.
+       cp toolchain/gcc/$(GCC_VERSION)/specs-$(ARCH)-soft-float $(TARGET_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs
        # Make sure gcc does not think we are cross compiling
-       $(SED) "s/^1/0/;" $(TARGET_DIR)/usr/lib/gcc-lib/$(ARCH)-linux/$(GCC_VERSION)/specs
+       $(SED) "s/^1/0/;" $(TARGET_DIR)/usr/lib/gcc-lib/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs
+endif
+endif
+       #
+       # Ok... that's enough of that.
+       #
        -(cd $(TARGET_DIR)/bin; find -type f | xargs $(STRIP) > /dev/null 2>&1)
        -(cd $(TARGET_DIR)/usr/bin; find -type f | xargs $(STRIP) > /dev/null 2>&1)
-       -(cd $(TARGET_DIR)/usr/lib/gcc-lib/$(ARCH)-linux/$(GCC_VERSION); $(STRIP) cc1 cc1plus collect2 > /dev/null 2>&1)
+       -(cd $(TARGET_DIR)/usr/$(GCC_LIB_SUBDIR); $(STRIP) cc1 cc1plus collect2 > /dev/null 2>&1)
        -(cd $(TARGET_DIR)/usr/lib; $(STRIP) libstdc++.so.*.*.* > /dev/null 2>&1)
-       -(cd $(TARGET_DIR)/lib; $(STRIP) libgcc_s.so.*.*.* > /dev/null 2>&1)
+       -(cd $(TARGET_DIR)/lib; $(STRIP) libgcc_s*.so.*.*.* > /dev/null 2>&1)
        #
        rm -f $(TARGET_DIR)/usr/lib/*.la*
-       rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
-               $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc
+       #rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
+       #       $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc
        # Work around problem of missing syslimits.h
-       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/
+       if [ ! -f $(TARGET_DIR)/usr/$(GCC_LIB_SUBDIR)/include/syslimits.h ] ; then \
+               echo "warning: working around missing syslimits.h" ; \
+               cp -f $(STAGING_DIR)/$(GCC_LIB_SUBDIR)/include/syslimits.h \
+                       $(TARGET_DIR)/usr/$(GCC_LIB_SUBDIR)/include/ ; \
+       fi
+       # Make sure we have 'cc'.
+       if [ ! -e $(TARGET_DIR)/usr/bin/cc ] ; then \
+               ln -snf gcc $(TARGET_DIR)/usr/bin/cc ; \
+       fi;
        # These are in /lib, so...
-       # rm -rf $(TARGET_DIR)/usr/lib/libgcc_s.so*
-       touch -c $(TARGET_DIR)/usr/bin/gcc
+       #rm -rf $(TARGET_DIR)/usr/lib/libgcc_s*.so*
+       #touch -c $(TARGET_DIR)/usr/bin/gcc
 
-gcc3_3_target: uclibc_target binutils_target $(TARGET_DIR)/usr/bin/gcc
+gcc_target: uclibc_target binutils_target $(TARGET_DIR)/usr/bin/gcc
 
-gcc3_3_target-clean:
+gcc_target-clean:
        rm -rf $(GCC_BUILD_DIR3)
-       rm -f $(TARGET_DIR)/bin/$(GNU_TARGET_NAME)*
+       rm -f $(TARGET_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)*
 
-gcc3_3_target-dirclean:
+gcc_target-dirclean:
        rm -rf $(GCC_BUILD_DIR3)
-
-endif
index 0a136eb..accef5f 100644 (file)
@@ -94,8 +94,10 @@ endif
 
 uclibc-configured: $(UCLIBC_DIR)/.configured
 
-uclibc: $(STAGING_DIR)/bin/$(ARCH)-linux-uclibc-gcc $(STAGING_DIR)/lib/libc.a \
-       $(UCLIBC_TARGETS)
+#uclibc: $(STAGING_DIR)/bin/$(ARCH)-linux-uclibc-gcc $(STAGING_DIR)/lib/libc.a \
+#      $(UCLIBC_TARGETS)
+
+uclibc: fix_gcc $(STAGING_DIR)/lib/libc.a $(UCLIBC_TARGETS)
 
 uclibc-source: $(DL_DIR)/$(UCLIBC_SOURCE)
 
@@ -108,9 +110,6 @@ uclibc-clean:
 uclibc-dirclean:
        rm -rf $(UCLIBC_DIR)
 
-
-
-
 #############################################################
 #
 # uClibc for the target just needs its header files
@@ -136,7 +135,7 @@ $(TARGET_DIR)/usr/lib/libc.a: $(STAGING_DIR)/lib/libc.a
 ifeq ($(GCC_2_95_TOOLCHAIN),true)
 uclibc_target: gcc2_95 uclibc $(TARGET_DIR)/usr/lib/libc.a
 else
-uclibc_target: gcc3_3 uclibc $(TARGET_DIR)/usr/lib/libc.a
+uclibc_target: gcc uclibc $(TARGET_DIR)/usr/lib/libc.a
 endif
 
 uclibc_target-clean:
@@ -145,3 +144,8 @@ uclibc_target-clean:
 uclibc_target-dirclean:
        rm -f $(TARGET_DIR)/include
 
+fix_gcc:
+       cd /opt/$(MACHINE)-uClibc/bin && for i in `find . -name "-*" | cut -c 3-`; do \
+               cat < $$i > $(MACHINE)-linux-uclibc$$i; \
+               chmod 755 $(MACHINE)-linux-uclibc$$i; \
+       done