Sharing of my labs carried out during the TDDE18 course at Linköping University
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

build_and_run.sh 747B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. # TDDE18 - Lab 3
  3. echo "Compilation, execution and debugging script for TDDE18 C ++ labs."
  4. echo "Pass the \"-v\" argument to run Valgrind and \"-q\" for synthetic output."
  5. echo ""
  6. echo "Starting building..."
  7. if [ "$1" = "-q" ]
  8. then g++ -Wall -Wextra -Wpedantic -std=c++17 *.cc *.h -o out.o
  9. else time g++ -v -Wall -Wextra -Wpedantic -std=c++17 *.cc *.h -o out.o
  10. fi
  11. if test $? -eq 0
  12. then
  13. echo "Build finished. Running..."
  14. echo ""
  15. if [ "$1" = "-q" ]
  16. then ./out.o
  17. else ./out.o -s
  18. fi
  19. echo ""
  20. if [ "$1" = "-v" ]
  21. then
  22. echo "Done. Launching valgrind..."
  23. echo ""
  24. valgrind --tool=memcheck --leak-check=yes ./out.o
  25. echo ""
  26. fi
  27. echo "Done. Cleaning..."
  28. rm out.o
  29. echo "Done."
  30. else
  31. echo "Build failed."
  32. exit 1
  33. fi
  34. exit 0