From 29b254fe343d16c37a7804bf946e74babbef0d4c Mon Sep 17 00:00:00 2001
From: "dario.genga" <dario.genga@etu.hesge.ch>
Date: Tue, 23 Nov 2021 01:00:06 +0100
Subject: [PATCH] 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.
---
 README.md | 5 +++++
 main.c    | 1 +
 makefile  | 6 +++---
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index ef214cb..eb89002 100644
--- a/README.md
+++ b/README.md
@@ -15,3 +15,8 @@ Use this command to compile the project.
 > `make clean`
 
 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
diff --git a/main.c b/main.c
index bf04085..ba4f418 100644
--- a/main.c
+++ b/main.c
@@ -18,6 +18,7 @@ int main() {
     matrix_init(&mat, m, n, val);
     printf("Empty matrix %dx%d\n", m, n);
     matrix_print(mat);
+    matrix_destroy(&mat);
     // Init from array
     matrix_init_from_array(&mat, m, n, data, s);
     printf("Matrix %dx%d from array\n", m, n);
diff --git a/makefile b/makefile
index 07e07fb..27ba3fe 100644
--- a/makefile
+++ b/makefile
@@ -1,12 +1,12 @@
 LIB=-lm
 CC=gcc -Wall -Wextra -g
 
-run_tests: tests
-	./$<
-
 matrix: matrix.o main.o
 	$(CC) $^ -fsanitize=address -fsanitize=leak -o $@ $(LIB)
 
+run_tests: tests
+	./$<
+
 tests: test.o matrix.o
 	$(CC) $^ -fsanitize=address -fsanitize=leak -o $@ $(LIB)
 
-- 
GitLab