Skip to content

Instantly share code, notes, and snippets.

@BeMg
Created September 10, 2018 10:17
Show Gist options
  • Select an option

  • Save BeMg/6cb6f7168e3dab287614e17862cc1fba to your computer and use it in GitHub Desktop.

Select an option

Save BeMg/6cb6f7168e3dab287614e17862cc1fba to your computer and use it in GitHub Desktop.
For riscv-tools build
# 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 -j32 >> build.log
echo "Installing project $PROJECT"
$MAKE install -j32 >> build.log
cd - > /dev/null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment