55 lines
920 B
Bash
Executable file
55 lines
920 B
Bash
Executable file
#!/bin/bash
|
|
# TDDE18 - Lab 6 - Build script
|
|
|
|
red='\e[0;31m'
|
|
green='\e[0;32m'
|
|
orange='\e[0;33m'
|
|
neutral='\e[0;m'
|
|
|
|
printout() {
|
|
echo -e "[${green}INFO${neutral}] $@"
|
|
}
|
|
|
|
printhelp() {
|
|
echo -e "[${orange}HELP${neutral}] $@"
|
|
}
|
|
|
|
printerr() {
|
|
echo -e "[${red}ERROR${neutral}] $@"
|
|
}
|
|
|
|
valgrd() {
|
|
echo ""
|
|
valgrind --tool=memcheck --leak-check=yes ./out.o $1 $2 $3 $4 $5
|
|
echo ""
|
|
}
|
|
|
|
printhelp "Compilation, execution and debugging script for TDDE18 C ++ labs."
|
|
|
|
printout "Starting building..."
|
|
/usr/bin/time --quiet --output=data.tmp -f "Time elasped: %E (%P cpu)" g++-7 -Wall -Wextra -Wpedantic -std=c++17 test_list.cc -o out.o
|
|
|
|
if test $? -eq 0
|
|
then
|
|
printout "Build finished."
|
|
|
|
printout `cat data.tmp`
|
|
rm data.tmp
|
|
printout "Running..."
|
|
|
|
echo ""
|
|
./out.o
|
|
|
|
echo ""
|
|
printout "Done. Cleaning..."
|
|
rm out.o
|
|
printout "Done."
|
|
else
|
|
printerr "Build failed."
|
|
printout `cat data.tmp`
|
|
rm data.tmp
|
|
exit 1
|
|
fi
|
|
|
|
echo ""
|
|
exit 0
|