Add support to build g++
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@1703 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
parent
c50ce0493d
commit
efe90cb9cb
|
@ -21,4 +21,9 @@ buildroot-0.1.3 2008-02-28 <spudmonkey@racsa.co.cr>
|
|||
buildroot-0.1.4 2008-xx-xx <spudmonkey@racsa.co.cr>
|
||||
|
||||
* Add support for a blackfin toolchain using GCC 4.2.4 and binutils 2.19
|
||||
* GCC 4.2.4 no longer attempts to build libstdc++. Now we can build g++!
|
||||
* The ARM GCC-4.2.4 configuration was changed so that it now builds g++.
|
||||
* Removed building of initial and final GCC. that is not necessary because
|
||||
we do not build a libc. Now it builds almost twice as fast.
|
||||
* Removed logic to build the target GCC. That is never used.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
ReleaseNotes v0.1.3:
|
||||
ReleaseNotes v0.1.4:
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This is a highly hacked up version of the buildroot (see
|
||||
|
@ -20,7 +20,10 @@ o sh-elf toolchain needed for the SH-1 NuttX port.
|
|||
|
||||
o m32c-elf toolchain needed for the Renesas M16C NuttX port.
|
||||
|
||||
0 H8/300 toolchain (not currently used in any NuttX
|
||||
o H8/300 toolchain (not currently used in any NuttX
|
||||
configuration).
|
||||
|
||||
o bfin-elf toolchain not currently used in any NuttX
|
||||
configuration).
|
||||
|
||||
Instructions:
|
||||
|
|
|
@ -5,10 +5,14 @@ arm-defconfig
|
|||
Builds an ARM toolchain using gcc 3.4.5
|
||||
|
||||
arm-defconfig-4.2.4
|
||||
Builds an ARM toolchain using gcc 4.2.4
|
||||
Builds an ARM toolchain using gcc 4.2.4. This configuration
|
||||
builds both gcc and g++.
|
||||
|
||||
NOTE: At present, there are issues with some of the binutils
|
||||
programes (arm-elf-objcopy in particular) that cause Floating
|
||||
point exceptions when trying to build NuttX
|
||||
programs (arm-elf-objcopy in particular) that cause Floating
|
||||
point exceptions when trying to build NuttX. This is probably
|
||||
due to improperly positioned sections and can probably fixed
|
||||
by changing the architectures .ldscript file.
|
||||
|
||||
bfin-defconfig-4.2.4
|
||||
Builds an Blackfin toolchain using gcc 4.2.4
|
||||
|
@ -93,7 +97,7 @@ Cygwin GCC BUILD NOTES
|
|||
and, apparently, the make variable "exeext" is set incorrectly. A work around after the
|
||||
above occurs is:
|
||||
|
||||
cd toolchain_build_<arch>/gcc-4.2.4-initial/gcc # Go to the directory where error occurred
|
||||
cd toolchain_build_<arch>/gcc-4.2.4-build/gcc # Go to the directory where error occurred
|
||||
mv cc1-dummy.exe cc1-dummy # Rename the executable without .exe
|
||||
rm cc1-checksum.c # Get rid of the bad generated file
|
||||
|
||||
|
@ -102,9 +106,21 @@ Cygwin GCC BUILD NOTES
|
|||
cd - # Back to the buildroot make directory
|
||||
make # Restart the build
|
||||
|
||||
GCC is built twice. First a initial, "bootstap" GCC is produced in
|
||||
toolchain_build_<arch>/gcc-4.2.4-initial, then the final GCC is produced in
|
||||
toolchain_build_<arch>/gcc-4.2.4-final. The above error will occur twice: Once for
|
||||
the intial GCC build (see above) and once for the final GCC build. For the final GCC
|
||||
build, the workaround is the same except that the directory will be
|
||||
toolchain_build_<arch>/gcc-4.2.4-final/gcc.
|
||||
If you build g++, you will see another similar error:
|
||||
|
||||
...
|
||||
build/genchecksum cc1plus-dummy > cc1plus-checksum.c
|
||||
opening cc1plus-dummy: No such file or directory
|
||||
...
|
||||
|
||||
The fix is similar:
|
||||
|
||||
cd toolchain_build_<arch>/gcc-4.2.4-build/gcc # Go to the directory where error occurred
|
||||
mv cc1plus-dummy.exe cc1plus-dummy # Rename the executable without .exe
|
||||
rm cc1plus-checksum.c # Get rid of the bad generated file
|
||||
|
||||
Then resume the buildroot make:
|
||||
|
||||
cd - # Back to the buildroot make directory
|
||||
make # Restart the build
|
||||
|
|
@ -6,8 +6,10 @@ BR2_HAVE_DOT_CONFIG=y
|
|||
BR2_arm=y
|
||||
# BR2_armeb is not set
|
||||
# BR2_avr32 is not set
|
||||
# BR2_bfin is not set
|
||||
# BR2_cris is not set
|
||||
# BR2_i386 is not set
|
||||
# BR2_m32c is not set
|
||||
# BR2_m68k is not set
|
||||
# BR2_m68hc11 is not set
|
||||
# BR2_m68hc12 is not set
|
||||
|
@ -66,24 +68,7 @@ BR2_GNU_TARGET_SUFFIX="elf"
|
|||
#
|
||||
# Binutils Options
|
||||
#
|
||||
# BR2_BINUTILS_VERSION_2_14_90_0_8 is not set
|
||||
# BR2_BINUTILS_VERSION_2_15 is not set
|
||||
# BR2_BINUTILS_VERSION_2_15_94_0_2_2 is not set
|
||||
# BR2_BINUTILS_VERSION_2_16_1 is not set
|
||||
# BR2_BINUTILS_VERSION_2_16_90_0_3 is not set
|
||||
# BR2_BINUTILS_VERSION_2_16_91_0_5 is not set
|
||||
# BR2_BINUTILS_VERSION_2_16_91_0_6 is not set
|
||||
# BR2_BINUTILS_VERSION_2_16_91_0_7 is not set
|
||||
# BR2_BINUTILS_VERSION_2_17 is not set
|
||||
# BR2_BINUTILS_VERSION_2_17_50_0_2 is not set
|
||||
# BR2_BINUTILS_VERSION_2_17_50_0_3 is not set
|
||||
# BR2_BINUTILS_VERSION_2_17_50_0_4 is not set
|
||||
# BR2_BINUTILS_VERSION_2_17_50_0_5 is not set
|
||||
# BR2_BINUTILS_VERSION_2_17_50_0_6 is not set
|
||||
# BR2_BINUTILS_VERSION_2_17_50_0_7 is not set
|
||||
# BR2_BINUTILS_VERSION_2_17_50_0_8 is not set
|
||||
# BR2_BINUTILS_VERSION_2_17_50_0_9 is not set
|
||||
# BR2_BINUTILS_VERSION_2_17_50_0_10 is not set
|
||||
BR2_BINUTILS_VERSION_2_19=y
|
||||
BR2_BINUTILS_VERSION="2.19"
|
||||
BR2_EXTRA_BINUTILS_CONFIG_OPTIONS=""
|
||||
|
@ -91,28 +76,14 @@ BR2_EXTRA_BINUTILS_CONFIG_OPTIONS=""
|
|||
#
|
||||
# GCC Options
|
||||
#
|
||||
# BR2_GCC_VERSION_3_3_5 is not set
|
||||
# BR2_GCC_VERSION_3_3_6 is not set
|
||||
# BR2_GCC_VERSION_3_4_2 is not set
|
||||
# BR2_GCC_VERSION_3_4_3 is not set
|
||||
# BR2_GCC_VERSION_3_4_4 is not set
|
||||
# BR2_GCC_VERSION_3_4_5 is not set
|
||||
# BR2_GCC_VERSION_3_4_6 is not set
|
||||
# BR2_GCC_VERSION_4_0_0 is not set
|
||||
# BR2_GCC_VERSION_4_0_1 is not set
|
||||
# BR2_GCC_VERSION_4_0_2 is not set
|
||||
# BR2_GCC_VERSION_4_0_3 is not set
|
||||
# BR2_GCC_VERSION_4_0_4 is not set
|
||||
# BR2_GCC_VERSION_4_1_0 is not set
|
||||
# BR2_GCC_VERSION_4_1_1 is not set
|
||||
# BR2_GCC_VERSION_4_1_2 is not set
|
||||
# BR2_GCC_VERSION_4_2 is not set
|
||||
BR2_GCC_VERSION_4_2_4=y
|
||||
BR2_GCC_SUPPORTS_SYSROOT=y
|
||||
BR2_GCC_VERSION="4.2.4"
|
||||
# BR2_GCC_USE_SJLJ_EXCEPTIONS is not set
|
||||
BR2_EXTRA_GCC_CONFIG_OPTIONS=""
|
||||
# BR2_INSTALL_LIBSTDCPP is not set
|
||||
BR2_INSTALL_LIBSTDCPP=y
|
||||
# BR2_INSTALL_LIBGCJ is not set
|
||||
# BR2_INSTALL_OBJC is not set
|
||||
# BR2_INSTALL_FORTRAN is not set
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
--- gcc-4.2.4/configure.orig 2009-04-18 18:07:18.250951700 -0400
|
||||
+++ gcc-4.2.4/configure 2009-04-18 18:20:20.369521100 -0400
|
||||
@@ -1649,6 +1649,10 @@
|
||||
;;
|
||||
esac
|
||||
|
||||
+# If we are building against NuttX, then don't attempt to build libstdc++
|
||||
+# (should be conditioned on --with-nuttx)
|
||||
+noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3"
|
||||
+
|
||||
# If we aren't building newlib, then don't build libgloss, since libgloss
|
||||
# depends upon some newlib header files.
|
||||
case "${noconfigdirs}" in
|
|
@ -134,12 +134,12 @@ config BR2_EXTRA_GCC_CONFIG_OPTIONS
|
|||
Any additional gcc configure options you may want to include....
|
||||
|
||||
config BR2_INSTALL_LIBSTDCPP
|
||||
bool "Build/install c++ compiler and libstdc++?"
|
||||
bool "Build C++ compiler?"
|
||||
default n
|
||||
# >= 4.2.0 work fine without LARGEFILE
|
||||
select BR2_LARGEFILE if !BR2_GCC_SUPPORTS_SYSROOT
|
||||
help
|
||||
Build/install c++ compiler and libstdc++?
|
||||
Build/install c++ compiler? NOTE: libstdc++ is not built for NuttX?
|
||||
|
||||
config BR2_INSTALL_LIBGCJ
|
||||
bool "Build/install java compiler and libgcj?"
|
||||
|
|
|
@ -55,5 +55,4 @@ EXTRA_TARGET_GCC_CONFIG_OPTIONS+=--enable-intermodule
|
|||
endif
|
||||
endif # BR2_PREFER_IMA=y
|
||||
|
||||
TARGETS+=gcc_target
|
||||
endif
|
||||
|
|
|
@ -63,10 +63,9 @@ endif
|
|||
|
||||
#############################################################
|
||||
#
|
||||
# build the first pass gcc compiler
|
||||
# build the gcc compiler
|
||||
#
|
||||
#############################################################
|
||||
GCC_BUILD_DIR1:=$(TOOL_BUILD_DIR)/gcc-$(GCC_VERSION)-initial
|
||||
|
||||
$(DL_DIR)/$(GCC_SOURCE):
|
||||
mkdir -p $(DL_DIR)
|
||||
|
@ -103,68 +102,12 @@ endif
|
|||
endif
|
||||
touch $@
|
||||
|
||||
# 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)/.patched
|
||||
mkdir -p $(GCC_BUILD_DIR1)
|
||||
(cd $(GCC_BUILD_DIR1); PATH=$(TARGET_PATH) \
|
||||
CC="$(HOSTCC)" \
|
||||
$(GCC_DIR)/configure \
|
||||
--prefix=$(STAGING_DIR) \
|
||||
--build=$(GNU_HOST_NAME) \
|
||||
--host=$(GNU_HOST_NAME) \
|
||||
--target=$(REAL_GNU_TARGET_NAME) \
|
||||
--enable-languages=c \
|
||||
--disable-__cxa_atexit \
|
||||
--enable-target-optspace \
|
||||
--with-gnu-ld \
|
||||
--disable-shared \
|
||||
$(DISABLE_NLS) \
|
||||
$(THREADS) \
|
||||
$(MULTILIB) \
|
||||
$(SOFT_FLOAT_CONFIG_OPTION) \
|
||||
$(GCC_WITH_CPU) $(GCC_WITH_ARCH) $(GCC_WITH_TUNE) \
|
||||
$(EXTRA_GCC_CONFIG_OPTIONS));
|
||||
touch $@
|
||||
|
||||
$(GCC_BUILD_DIR1)/.compiled: $(GCC_BUILD_DIR1)/.configured
|
||||
PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR1) all-gcc
|
||||
touch $@
|
||||
|
||||
$(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
|
||||
|
||||
gcc_initial: binutils $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gcc
|
||||
|
||||
gcc_initial-clean:
|
||||
rm -rf $(GCC_BUILD_DIR1)
|
||||
|
||||
gcc_initial-dirclean:
|
||||
rm -rf $(GCC_BUILD_DIR1) $(GCC_DIR)
|
||||
|
||||
#############################################################
|
||||
#
|
||||
# second pass compiler build. Build the compiler targeting
|
||||
# the newly built shared 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_STAGING_PREREQ)
|
||||
mkdir -p $(GCC_BUILD_DIR2)
|
||||
GCC_BUILD_DIR:=$(TOOL_BUILD_DIR)/gcc-$(GCC_VERSION)-final
|
||||
$(GCC_BUILD_DIR)/.configured: $(GCC_DIR)/.patched $(GCC_STAGING_PREREQ)
|
||||
mkdir -p $(GCC_BUILD_DIR)
|
||||
# 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) \
|
||||
(cd $(GCC_BUILD_DIR); PATH=$(TARGET_PATH) \
|
||||
CC="$(HOSTCC)" \
|
||||
$(GCC_DIR)/configure \
|
||||
--prefix=$(STAGING_DIR) \
|
||||
|
@ -186,12 +129,12 @@ $(GCC_BUILD_DIR2)/.configured: $(GCC_DIR)/.patched $(GCC_STAGING_PREREQ)
|
|||
$(EXTRA_GCC_CONFIG_OPTIONS));
|
||||
touch $@
|
||||
|
||||
$(GCC_BUILD_DIR2)/.compiled: $(GCC_BUILD_DIR2)/.configured
|
||||
PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR2) all
|
||||
$(GCC_BUILD_DIR)/.compiled: $(GCC_BUILD_DIR)/.configured
|
||||
PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR) all
|
||||
touch $@
|
||||
|
||||
$(GCC_BUILD_DIR2)/.installed: $(GCC_BUILD_DIR2)/.compiled
|
||||
PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR2) install
|
||||
$(GCC_BUILD_DIR)/.installed: $(GCC_BUILD_DIR)/.compiled
|
||||
PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR) install
|
||||
if [ -d "$(STAGING_DIR)/lib64" ] ; then \
|
||||
if [ ! -e "$(STAGING_DIR)/lib" ] ; then \
|
||||
mkdir "$(STAGING_DIR)/lib" ; \
|
||||
|
@ -246,9 +189,10 @@ endif
|
|||
#
|
||||
touch $@
|
||||
|
||||
$(GCC_BUILD_DIR2)/.libs_installed: $(GCC_BUILD_DIR2)/.installed
|
||||
$(GCC_BUILD_DIR)/.libs_installed: $(GCC_BUILD_DIR)/.installed
|
||||
ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
|
||||
-cp -dpf $(STAGING_DIR)/lib/libstdc++.so* $(TARGET_DIR)/lib/
|
||||
# We have disabled building of libstdc++ for NuttX
|
||||
#-cp -dpf $(STAGING_DIR)/lib/libstdc++.so* $(TARGET_DIR)/lib/
|
||||
endif
|
||||
ifeq ($(BR2_INSTALL_LIBGCJ),y)
|
||||
-cp -dpf $(STAGING_DIR)/lib/libgcj.so* $(TARGET_DIR)/lib/
|
||||
|
@ -260,141 +204,20 @@ ifeq ($(BR2_INSTALL_LIBGCJ),y)
|
|||
endif
|
||||
touch $@
|
||||
|
||||
gcc: binutils gcc_initial $(LIBFLOAT_TARGET) \
|
||||
$(GCC_BUILD_DIR2)/.installed $(GCC_BUILD_DIR2)/.libs_installed \
|
||||
gcc: binutils $(LIBFLOAT_TARGET) \
|
||||
$(GCC_BUILD_DIR)/.installed $(GCC_BUILD_DIR)/.libs_installed \
|
||||
$(GCC_TARGETS)
|
||||
|
||||
gcc-source: $(DL_DIR)/$(GCC_SOURCE)
|
||||
|
||||
gcc-clean:
|
||||
rm -rf $(GCC_BUILD_DIR2)
|
||||
rm -rf $(GCC_BUILD_DIR)
|
||||
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
|
||||
|
||||
gcc-dirclean: gcc_initial-dirclean
|
||||
rm -rf $(GCC_BUILD_DIR2)
|
||||
gcc-dirclean:
|
||||
rm -rf $(GCC_BUILD_DIR)
|
||||
|
||||
#############################################################
|
||||
#
|
||||
# Next build target gcc compiler
|
||||
#
|
||||
#############################################################
|
||||
GCC_BUILD_DIR3:=$(BUILD_DIR)/gcc-$(GCC_VERSION)-target
|
||||
|
||||
$(GCC_BUILD_DIR3)/.prepared: $(GCC_BUILD_DIR2)/.libs_installed $(GCC_TARGET_PREREQ)
|
||||
mkdir -p $(GCC_BUILD_DIR3)
|
||||
touch $@
|
||||
|
||||
$(GCC_BUILD_DIR3)/.configured: $(GCC_BUILD_DIR3)/.prepared
|
||||
(cd $(GCC_BUILD_DIR3); rm -rf config.cache ; \
|
||||
PATH=$(TARGET_PATH) \
|
||||
CC_FOR_BUILD="$(HOSTCC)" \
|
||||
CFLAGS_FOR_BUILD="-g -O2" \
|
||||
$(TARGET_GCC_FLAGS) \
|
||||
$(GCC_DIR)/configure \
|
||||
--prefix=/usr \
|
||||
--build=$(GNU_HOST_NAME) \
|
||||
--host=$(REAL_GNU_TARGET_NAME) \
|
||||
--target=$(REAL_GNU_TARGET_NAME) \
|
||||
--enable-languages=$(GCC_TARGET_LANGUAGES) \
|
||||
--with-gxx-include-dir=/usr/include/c++ \
|
||||
--disable-__cxa_atexit \
|
||||
--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) \
|
||||
$(DISABLE_LARGEFILE) \
|
||||
$(EXTRA_GCC_CONFIG_OPTIONS) \
|
||||
$(EXTRA_TARGET_GCC_CONFIG_OPTIONS));
|
||||
touch $@
|
||||
|
||||
$(GCC_BUILD_DIR3)/.compiled: $(GCC_BUILD_DIR3)/.configured
|
||||
PATH=$(TARGET_PATH) \
|
||||
$(MAKE) -C $(GCC_BUILD_DIR3) all
|
||||
touch $@
|
||||
|
||||
#
|
||||
# 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)
|
||||
ifneq ($(findstring 4.2.,$(GCC_VERSION)),4.2.)
|
||||
REAL_GCC_VERSION=$(shell cat $(GCC_DIR)/gcc/BASE-VER)
|
||||
GCC_LIB_SUBDIR=lib/gcc/$(REAL_GNU_TARGET_NAME)/$(REAL_GCC_VERSION)
|
||||
else
|
||||
GCC_LIB_SUBDIR=lib/gcc/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)
|
||||
endif
|
||||
#XXX: FIXME: cleanup BR2_ARCH selection and establish BR2_CPU
|
||||
#GCC_WITH_ARCH=--with-arch=$(BR2_ARCH)
|
||||
#GCC_WITH_TUNE=--with-tune=$(BR2_ARCH)
|
||||
#GCC_WITH_CPU=--with-cpu=$(BR2_ARCH)
|
||||
endif
|
||||
|
||||
$(TARGET_DIR)/usr/bin/gcc: $(GCC_BUILD_DIR3)/.compiled
|
||||
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/$(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/$(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)
|
||||
#
|
||||
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
|
||||
# Work around problem of missing syslimits.h
|
||||
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
|
||||
|
||||
gcc_target: binutils_target $(TARGET_DIR)/usr/bin/gcc
|
||||
|
||||
gcc_target-clean:
|
||||
rm -rf $(GCC_BUILD_DIR3)
|
||||
rm -f $(TARGET_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)*
|
||||
|
||||
gcc_target-dirclean:
|
||||
rm -rf $(GCC_BUILD_DIR3)
|
||||
endif
|
||||
|
|
|
@ -64,10 +64,10 @@ endif
|
|||
|
||||
#############################################################
|
||||
#
|
||||
# build the first pass gcc compiler
|
||||
# build the gcc compiler
|
||||
#
|
||||
#############################################################
|
||||
GCC_BUILD_DIR1:=$(TOOL_BUILD_DIR)/gcc-$(GCC_VERSION)-initial
|
||||
GCC_BUILD_DIR:=$(TOOL_BUILD_DIR)/gcc-$(GCC_VERSION)-build
|
||||
|
||||
$(DL_DIR)/$(GCC_SOURCE):
|
||||
mkdir -p $(DL_DIR)
|
||||
|
@ -104,67 +104,11 @@ endif
|
|||
endif
|
||||
touch $@
|
||||
|
||||
# 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)/.patched
|
||||
mkdir -p $(GCC_BUILD_DIR1)
|
||||
(cd $(GCC_BUILD_DIR1); rm -rf config.cache; PATH=$(TARGET_PATH)\
|
||||
CC="$(HOSTCC)" \
|
||||
$(GCC_DIR)/configure \
|
||||
--prefix=$(STAGING_DIR) \
|
||||
--build=$(GNU_HOST_NAME) \
|
||||
--host=$(GNU_HOST_NAME) \
|
||||
--target=$(REAL_GNU_TARGET_NAME) \
|
||||
--enable-languages=c \
|
||||
--disable-__cxa_atexit \
|
||||
--disable-libssp \
|
||||
--enable-target-optspace \
|
||||
--with-gnu-ld \
|
||||
--disable-shared \
|
||||
$(DISABLE_NLS) \
|
||||
$(THREADS) \
|
||||
$(MULTILIB) \
|
||||
$(SOFT_FLOAT_CONFIG_OPTION) \
|
||||
$(GCC_WITH_CPU) $(GCC_WITH_ARCH) $(GCC_WITH_TUNE) \
|
||||
$(EXTRA_GCC_CONFIG_OPTIONS));
|
||||
touch $@
|
||||
|
||||
$(GCC_BUILD_DIR1)/.compiled: $(GCC_BUILD_DIR1)/.configured
|
||||
PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR1) all-gcc
|
||||
touch $@
|
||||
|
||||
$(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gcc: $(GCC_BUILD_DIR1)/.compiled
|
||||
PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR1) install-gcc
|
||||
|
||||
gcc_initial: binutils $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gcc
|
||||
|
||||
gcc_initial-clean:
|
||||
rm -rf $(GCC_BUILD_DIR1)
|
||||
|
||||
gcc_initial-dirclean:
|
||||
rm -rf $(GCC_BUILD_DIR1) $(GCC_DIR)
|
||||
|
||||
#############################################################
|
||||
#
|
||||
# second pass compiler build. Build the compiler targeting
|
||||
# the newly built shared 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_STAGING_PREREQ)
|
||||
mkdir -p $(GCC_BUILD_DIR2)
|
||||
$(GCC_BUILD_DIR)/.configured: $(GCC_DIR)/.patched $(GCC_STAGING_PREREQ)
|
||||
mkdir -p $(GCC_BUILD_DIR)
|
||||
# Important! Required for limits.h to be fixed.
|
||||
ln -snf ../include/ $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include
|
||||
(cd $(GCC_BUILD_DIR2); rm -rf config.cache; PATH=$(TARGET_PATH) \
|
||||
(cd $(GCC_BUILD_DIR); rm -rf config.cache; PATH=$(TARGET_PATH) \
|
||||
CC="$(HOSTCC)" \
|
||||
$(GCC_DIR)/configure \
|
||||
--prefix=$(STAGING_DIR) \
|
||||
|
@ -187,12 +131,12 @@ $(GCC_BUILD_DIR2)/.configured: $(GCC_DIR)/.patched $(GCC_STAGING_PREREQ)
|
|||
$(EXTRA_GCC_CONFIG_OPTIONS));
|
||||
touch $@
|
||||
|
||||
$(GCC_BUILD_DIR2)/.compiled: $(GCC_BUILD_DIR2)/.configured
|
||||
PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR2) all
|
||||
$(GCC_BUILD_DIR)/.compiled: $(GCC_BUILD_DIR)/.configured
|
||||
PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR) all
|
||||
touch $@
|
||||
|
||||
$(GCC_BUILD_DIR2)/.installed: $(GCC_BUILD_DIR2)/.compiled
|
||||
PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR2) install
|
||||
$(GCC_BUILD_DIR)/.installed: $(GCC_BUILD_DIR)/.compiled
|
||||
PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR) install
|
||||
if [ -d "$(STAGING_DIR)/lib64" ] ; then \
|
||||
if [ ! -e "$(STAGING_DIR)/lib" ] ; then \
|
||||
mkdir "$(STAGING_DIR)/lib" ; \
|
||||
|
@ -247,9 +191,10 @@ endif
|
|||
#
|
||||
touch $@
|
||||
|
||||
$(GCC_BUILD_DIR2)/.libs_installed: $(GCC_BUILD_DIR2)/.installed
|
||||
$(GCC_BUILD_DIR)/.libs_installed: $(GCC_BUILD_DIR)/.installed
|
||||
ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
|
||||
-cp -dpf $(STAGING_DIR)/lib/libstdc++.so* $(TARGET_DIR)/lib/
|
||||
# We have disabled building of libstdc++ for NuttX
|
||||
#-cp -dpf $(STAGING_DIR)/lib/libstdc++.so* $(TARGET_DIR)/lib/
|
||||
endif
|
||||
ifeq ($(BR2_INSTALL_LIBGCJ),y)
|
||||
-cp -dpf $(STAGING_DIR)/lib/libgcj.so* $(TARGET_DIR)/lib/
|
||||
|
@ -261,136 +206,20 @@ ifeq ($(BR2_INSTALL_LIBGCJ),y)
|
|||
endif
|
||||
touch $@
|
||||
|
||||
gcc: binutils gcc_initial $(LIBFLOAT_TARGET) \
|
||||
$(GCC_BUILD_DIR2)/.installed $(GCC_BUILD_DIR2)/.libs_installed \
|
||||
gcc: binutils $(LIBFLOAT_TARGET) \
|
||||
$(GCC_BUILD_DIR)/.installed $(GCC_BUILD_DIR)/.libs_installed \
|
||||
$(GCC_TARGETS)
|
||||
|
||||
gcc-source: $(DL_DIR)/$(GCC_SOURCE)
|
||||
|
||||
gcc-clean:
|
||||
rm -rf $(GCC_BUILD_DIR2)
|
||||
rm -rf $(GCC_BUILD_DIR)
|
||||
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
|
||||
|
||||
gcc-dirclean: gcc_initial-dirclean
|
||||
rm -rf $(GCC_BUILD_DIR2)
|
||||
gcc-dirclean:
|
||||
rm -rf $(GCC_BUILD_DIR)
|
||||
|
||||
#############################################################
|
||||
#
|
||||
# Next build target gcc compiler
|
||||
#
|
||||
#############################################################
|
||||
GCC_BUILD_DIR3:=$(BUILD_DIR)/gcc-$(GCC_VERSION)-target
|
||||
|
||||
$(GCC_BUILD_DIR3)/.prepared: $(GCC_BUILD_DIR2)/.libs_installed $(GCC_TARGET_PREREQ)
|
||||
mkdir -p $(GCC_BUILD_DIR3)
|
||||
touch $@
|
||||
|
||||
$(GCC_BUILD_DIR3)/.configured: $(GCC_BUILD_DIR3)/.prepared
|
||||
(cd $(GCC_BUILD_DIR3); rm -rf config.cache ; \
|
||||
PATH=$(TARGET_PATH) \
|
||||
CC_FOR_BUILD="$(HOSTCC)" \
|
||||
CFLAGS_FOR_BUILD="-g -O2" \
|
||||
$(TARGET_GCC_FLAGS) \
|
||||
$(GCC_DIR)/configure \
|
||||
--prefix=/usr \
|
||||
--build=$(GNU_HOST_NAME) \
|
||||
--host=$(REAL_GNU_TARGET_NAME) \
|
||||
--target=$(REAL_GNU_TARGET_NAME) \
|
||||
--enable-languages=$(GCC_TARGET_LANGUAGES) \
|
||||
--with-gxx-include-dir=/usr/include/c++ \
|
||||
--disable-__cxa_atexit \
|
||||
--with-gnu-ld \
|
||||
--with-gnu-as \
|
||||
--disable-libssp \
|
||||
$(GCC_SHARED_LIBGCC) \
|
||||
$(DISABLE_NLS) \
|
||||
$(THREADS) \
|
||||
$(MULTILIB) \
|
||||
$(SOFT_FLOAT_CONFIG_OPTION) \
|
||||
$(GCC_WITH_CPU) $(GCC_WITH_ARCH) $(GCC_WITH_TUNE) \
|
||||
$(GCC_USE_SJLJ_EXCEPTIONS) \
|
||||
$(DISABLE_LARGEFILE) \
|
||||
$(EXTRA_GCC_CONFIG_OPTIONS) \
|
||||
$(EXTRA_TARGET_GCC_CONFIG_OPTIONS));
|
||||
touch $@
|
||||
|
||||
$(GCC_BUILD_DIR3)/.compiled: $(GCC_BUILD_DIR3)/.configured
|
||||
PATH=$(TARGET_PATH) \
|
||||
$(MAKE) -C $(GCC_BUILD_DIR3) all
|
||||
touch $@
|
||||
|
||||
#
|
||||
# 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)
|
||||
ifneq ($(findstring 4.2.,$(GCC_VERSION)),4.2.)
|
||||
REAL_GCC_VERSION=$(shell cat $(GCC_DIR)/gcc/BASE-VER)
|
||||
GCC_LIB_SUBDIR=lib/gcc/$(REAL_GNU_TARGET_NAME)/$(REAL_GCC_VERSION)
|
||||
else
|
||||
GCC_LIB_SUBDIR=lib/gcc/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)
|
||||
endif
|
||||
endif
|
||||
|
||||
$(TARGET_DIR)/usr/bin/gcc: $(GCC_BUILD_DIR3)/.compiled
|
||||
PATH=$(TARGET_PATH) DESTDIR=$(TARGET_DIR) \
|
||||
$(MAKE) -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/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs
|
||||
endif
|
||||
endif
|
||||
#
|
||||
# Ok... that's enough of that.
|
||||
#
|
||||
-(cd $(TARGET_DIR)/bin && find -type f | xargs $(STRIPCMD) > /dev/null 2>&1)
|
||||
-(cd $(TARGET_DIR)/usr/bin && find -type f | xargs $(STRIPCMD) > /dev/null 2>&1)
|
||||
-(cd $(TARGET_DIR)/usr/$(GCC_LIB_SUBDIR) && $(STRIPCMD) cc1 cc1plus collect2 > /dev/null 2>&1)
|
||||
-(cd $(TARGET_DIR)/usr/lib && $(STRIPCMD) libstdc++.so.*.*.* > /dev/null 2>&1)
|
||||
-(cd $(TARGET_DIR)/lib && $(STRIPCMD) libgcc_s*.so.*.*.* > /dev/null 2>&1)
|
||||
|
||||
#
|
||||
rm -f $(TARGET_DIR)/usr/lib/*.la*
|
||||
# Work around problem of missing syslimits.h
|
||||
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;
|
||||
touch -c $@
|
||||
|
||||
gcc_target: binutils_target $(TARGET_DIR)/usr/bin/gcc
|
||||
|
||||
gcc_target-clean:
|
||||
rm -rf $(GCC_BUILD_DIR3)
|
||||
rm -f $(TARGET_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)*
|
||||
|
||||
gcc_target-dirclean:
|
||||
rm -rf $(GCC_BUILD_DIR3)
|
||||
endif
|
||||
|
|
Loading…
Reference in New Issue