diff --git a/Makefile.c b/Makefile.c index 7a04f0cc4fd16db09d611e0ce1455f147a2ef10f..5957ed3997a06a61a061fd32904f039ce7ebae13 100644 --- a/Makefile.c +++ b/Makefile.c @@ -1,41 +1,49 @@ -# Group: Q6 - gs -# Date: 23 April 2020 +# Group: Q6 +# Date: 26 April 2020 # Course: LEPL1503 - PROJECT3 -# Object: factorial +# Object: factorial programme with Cunit test, Valgrind and cppcheck modules CC = gcc # The option -Werror convert warning into error FLAGS = -Werror -pthread -#TEST_FLAGS = -I${HOME/local/include} -L${HOME/local/lib -Wall -lcunit +#TEST_FLAGS = -I${HOME}/local/include} -L${HOME}/local/lib -Wall -lcunit fact: fact.c $(CC) $(FLAGS) fact.c -o fact -lm - echo Compiler task ended - + echo "fact.c file compiled" + # File provinding wrong numbers (negative, <2, 0), command: + # ./fact incorrect_numbers.txt out.txt test: Fact_UnitTest.c - gcc -Wall -lcunit -I${HOME}/local/include Fact_UnitTest.c -L${HOME}/local/lib -o Fact_UnitTest -lm - echo "Test completed" - + $(CC) -Wall -I${HOME}/local/include Fact_UnitTest.c -L${HOME}/local/lib -o Fact_UnitTest -lcunit -lm + echo "Fact_UnitTest.c file compiled" -clean: fact +clean: rm fact # rm testing ouput files #### - rm Fact_UnitTest - rm out*.txt - echo "Clean completed" + # rm Fact_UnitTest + # rm out*.txt + ## ADDITIONAL MAKE COMMANDS: + ## make cunit, make valgrind, make cppcheck, make valgrind_cunit, make cppcheck_cunit -valgrind: - valgrind ./fact +cunit: + # Before the execution launch: + export LD_LIBRARY_PATH=$HOME/local/lib:$LD_LIBRARY_PATH + # The output of the unit test is stored in "Cunit_test_file.txt" + ./Fact_UnitTest > Cunit_test_file.txt 2>&1 + echo "Unit test launched see report in test_file.txt" -valgrind_test: - valgrind ./Fact_UnitTest +valgrind: + valgrind ./fact > valgrind_fact.txt 2>&1 cppcheck: - cppcheck ./fact + cppcheck ./fact > cppcheck_fact.txt 2>&1 + +valgrind_cunit: + valgrind ./Fact_UnitTest > valgrind_cunit.txt 2>&1 -cppcheck_test: - cppcheck ./Fact_UnitTest \ No newline at end of file +cppcheck_cunit: + cppcheck ./Fact_UnitTest > cppcheck_cunit.txt 2>&1