forked from riscv-software-src/riscv-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.common
44 lines (39 loc) · 1023 Bytes
/
build.common
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
# Script to build RISC-V ISA simulator, proxy kernel, and GNU toolchain.
# Tools will be installed to $RISCV.
if [ "x$RISCV" = "x" ]
then
echo "Please set the RISCV environment variable to your preferred install path."
exit 1
fi
# Use gmake instead of make if it exists.
MAKE=`command -v gmake || command -v make`
PATH="$RISCV/bin:$PATH"
#GCC_VERSION=`gcc -v 2>&1 | tail -1 | awk '{print $3}'`
set -e
function build_project {
PROJECT="$1"
shift
echo
if [ -e "$PROJECT/build" ]
then
echo "Removing existing $PROJECT/build directory"
rm -rf "$PROJECT/build"
fi
if [ ! -e "$PROJECT/configure" ]
then
(
cd "$PROJECT"
find . -iname configure.ac | sed s/configure.ac/m4/ | xargs mkdir -p
autoreconf -i
)
fi
mkdir -p "$PROJECT/build"
cd "$PROJECT/build"
echo "Configuring project $PROJECT"
../configure $* > build.log
echo "Building project $PROJECT"
$MAKE >> build.log
echo "Installing project $PROJECT"
$MAKE install >> build.log
cd - > /dev/null
}