1234567891011121314151617181920212223242526272829303132333435363738 |
- #!/bin/bash
- # TDDE18 - Lab 3
-
- echo "Compilation, execution and debugging script for TDDE18 C ++ labs."
- echo "Pass the \"-v\" argument to run Valgrind and \"-q\" for synthetic output."
- echo ""
-
- echo "Starting building..."
- if [ "$1" = "-q" ]
- then g++ -Wall -Wextra -Wpedantic -std=c++17 *.cc *.h -o out.o
- else time g++ -v -Wall -Wextra -Wpedantic -std=c++17 *.cc *.h -o out.o
- fi
-
- if test $? -eq 0
- then
- echo "Build finished. Running..."
- echo ""
- if [ "$1" = "-q" ]
- then ./out.o
- else ./out.o -s
- fi
- echo ""
- if [ "$1" = "-v" ]
- then
- echo "Done. Launching valgrind..."
- echo ""
- valgrind --tool=memcheck --leak-check=yes ./out.o
- echo ""
- fi
- echo "Done. Cleaning..."
- rm out.o
- echo "Done."
- else
- echo "Build failed."
- exit 1
- fi
-
- exit 0
|