-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathstep2_make_binutils.sh
executable file
·82 lines (62 loc) · 1.92 KB
/
step2_make_binutils.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#! /bin/sh
#
# Build script for V810-GCC.
#
# Stage 2 of 8 - Build BINUTILS.
#
# If this stage fails, then you can find out what the error was, fix it, and
# re-run this script without running prepare_binutils.sh again.
#
OSNAME=`uname -s`
TARGET=v810
GITDIR=$(pwd)
echo GITDIR is $GITDIR
export DSTDIR=$GITDIR/$TARGET-gcc
echo DSTDIR is $DSTDIR
mkdir -p $DSTDIR/bin
export PATH=$DSTDIR/bin:$PATH
#---------------------------------------------------------------------------------
# Set the target and compiler flags
#---------------------------------------------------------------------------------
if [ "$OS" = "Windows_NT" ] ; then
export CFLAGS='-O2 -static'
export CXXFLAGS='-O2 -static'
export LDFLAGS='-Wl,-Bstatic'
# export LDFLAGS='-Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archive'
else
export CFLAGS='-O2'
export CXXFLAGS='-O2'
export LDFLAGS=
fi
#---------------------------------------------------------------------------------
# Build and install binutils
#---------------------------------------------------------------------------------
cd $GITDIR/build/binutils
make --jobs=$(nproc) all 2>&1 | tee binutils_make.log
if [ $? != 0 ]; then
echo "Error: building binutils";
exit 1;
fi
# !It would be nice if this worked!
#
# make check-gas 2>&1 | tee binutils_test.log
#
# if [ $? != 0 ]; then
# echo "Error: testing binutils";
# exit 1;
# fi
# make tooldir=$DSTDIR install-strip 2>&1 | tee binutils_install.log
make install-strip 2>&1 | tee binutils_install.log
if [ $? != 0 ]; then
echo "Error: installing binutils";
exit 1;
fi
cd ../../
#---------------------------------------------------------------------------------
# Remove duplicate/unnecessary files to save space
#---------------------------------------------------------------------------------
rm $DSTDIR/bin/$TARGET-ld.bfd*
rm $DSTDIR/$TARGET/bin/ld.bfd*
echo
echo "$0 finished, don't forget to check for any error messages."
exit 0;