mb_gnu: Intial commit for Gcc-4.6.2 sources and toolchain build scripts
[microblaze-gnu.git] / standalone_linux_scripts / build_binutils.sh
blob5bdf07c2a3016de604e31ed1bc40037522f597b1
2 # Build Binutils
5 # Source and patches
6 BINVER=2.16
8 CFLAGS="-O2"
10 . common.sh
12 # Override source directory
13 SRCDIR=$SRCDIR/../src/binutils
14 TARGET=microblaze-xilinx-elf
15 SYSROOT=$RELDIR/$TARGET
16 BLDDIR=$BLDDIR/bld_bin
17 BINDIR=$RELDIR/bin
19 DESC="Build\t\t: binutils-$BINVER"
20 echo $SEPARATOR
21 echo -e $DESC
22 echo -e "Target\t\t: $TARGET"
23 echo -e "CWD\t\t: $CURDIR"
24 echo -e "CFLAGS\t\t: $CFLAGS"
25 echo -e "Version String\t: $TOOL_VERSION"
26 echo -e "Platform\t: $PLATFORM"
27 echo -e "Build started\t: `date`"
29 rm -rf $BLDDIR/binutils
30 rm -rf $BLDDIR/build
31 rm -rf $BLDDIR/log
32 mkdir -p $BLDDIR/build
33 mkdir -p $BLDDIR/log
35 if [ ! -d $RELDIR ]; then mkdir -p $RELDIR; fi
37 errors=0
39 # Create build directory
40 cd $BLDDIR/build
42 # Use back-rev gcc if available
43 if [ -d /usr/local/bin/gcc-3.4.6 ]; then
44 PATH=/usr/local/bin/gcc-3.4.6/bin:$PATH
47 echo -n "Configuring..."
48 $SRCDIR/configure \
49 --target=$TARGET \
50 --prefix=$RELDIR \
51 --program-prefix="mb-" \
52 CFLAGS_FOR_TARGET=-O2 \
53 CFLAGS_FOR_BUILD=-O2 \
54 --with-sysroot=$SYSROOT \
55 > $BLDDIR/log/binutils-config.log 2>&1
56 print_err " rc = " $?
58 if [ $NOBUILD = 0 ]; then
59 echo -n "Compiling..."
60 $MAKE all CFLAGS="$CFLAGS" \
61 > $BLDDIR/log/binutils-make.log 2>&1
62 rc=$?
63 print_err " rc = " $rc
64 echo -n "Installing..."
65 $MAKE install CFLAGS="$CFLAGS" \
66 > $BLDDIR/log/binutils-install.log 2>&1
67 rc=$?
68 print_err " rc = " $rc
70 # Copy libbfd.a to release area
71 mkdir -p $RELDIR/$TARGET/lib
72 cp $BLDDIR/build/bfd/libbfd.a $RELDIR/$TARGET/lib
73 rc=$?
74 print_err "Installing libbfd.a... rc = " $rc
76 # Copy libbfd headers
77 mkdir -p $RELDIR/include
78 cp $BLDDIR/build/bfd/bfd.h $RELDIR/include
79 cp $SRCDIR/include/ansidecl.h $RELDIR/include
80 cp $SRCDIR/include/bfdlink.h $RELDIR/include
81 cp $SRCDIR/include/symcat.h $RELDIR/include
82 rc=$?
83 print_err "Installing libbfd headers... rc = " $rc
85 echo -n "Configuring Gprof..."
86 mkdir gprof
87 cd gprof
88 $SRCDIR/gprof/configure \
89 --target=$TARGET \
90 --prefix=$RELDIR \
91 --program-prefix="mb-" \
92 > $BLDDIR/log/gprof-config.log 2>&1
93 rc=$?
94 print_err " rc = " $rc
96 echo -n "Compiling Gprof..."
97 $MAKE all CFLAGS="$CFLAGS" \
98 > $BLDDIR/log/gprof-make.log 2>&1
99 rc=$?
100 print_err " rc = " $rc
101 echo -n "Installing Gprof..."
102 $MAKE install CFLAGS="$CFLAGS" \
103 > $BLDDIR/log/gprof-install.log 2>&1
104 rc=$?
105 print_err " rc = " $rc
108 #cd $CURDIR
109 #if [ $NOCLEAN = 0 ]; then
110 # rm -rf $BLDDIR
113 echo "Build completed: `date`."