1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #!/bin/bash
- # TDDE18 - Lab 5 - 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++ -Wall -Wextra -Wpedantic -std=c++17 *.cc -o out.o
-
- if test $? -eq 0
- then
- printout "Build finished."
-
- printout `cat data.tmp`
- rm data.tmp
- printout "Running..."
-
- if [[ $1 == "" ]]
- then
- printhelp "No arguments provided, using default example.html -a."
- echo ""
- ./out.o samples/example.html -a
- else
- echo ""
- ./out.o $1 $2 $3 $4 $5
- fi
-
- 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
|