Skip to content
Snippets Groups Projects
Commit 29b254fe authored by dario.genga's avatar dario.genga
Browse files

Update makefile to correctly compile the project

The make command was running the tests but not compiling the project.
Also added a missing matrix destroy to free the memory.
parent 6bde0e06
Branches main
No related tags found
No related merge requests found
...@@ -15,3 +15,8 @@ Use this command to compile the project. ...@@ -15,3 +15,8 @@ Use this command to compile the project.
> `make clean` > `make clean`
Use this command to clean the project. Use this command to clean the project.
### Run the tests
> `make run_tests`
Use this command to start the tests.
\ No newline at end of file
...@@ -18,6 +18,7 @@ int main() { ...@@ -18,6 +18,7 @@ int main() {
matrix_init(&mat, m, n, val); matrix_init(&mat, m, n, val);
printf("Empty matrix %dx%d\n", m, n); printf("Empty matrix %dx%d\n", m, n);
matrix_print(mat); matrix_print(mat);
matrix_destroy(&mat);
// Init from array // Init from array
matrix_init_from_array(&mat, m, n, data, s); matrix_init_from_array(&mat, m, n, data, s);
printf("Matrix %dx%d from array\n", m, n); printf("Matrix %dx%d from array\n", m, n);
......
LIB=-lm LIB=-lm
CC=gcc -Wall -Wextra -g CC=gcc -Wall -Wextra -g
run_tests: tests
./$<
matrix: matrix.o main.o matrix: matrix.o main.o
$(CC) $^ -fsanitize=address -fsanitize=leak -o $@ $(LIB) $(CC) $^ -fsanitize=address -fsanitize=leak -o $@ $(LIB)
run_tests: tests
./$<
tests: test.o matrix.o tests: test.o matrix.o
$(CC) $^ -fsanitize=address -fsanitize=leak -o $@ $(LIB) $(CC) $^ -fsanitize=address -fsanitize=leak -o $@ $(LIB)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment