diff --git a/.gitignore b/.gitignore
index 670dfeb97a923e2c775af0b2cbb9e1505f74031b..e02dd8523c9037a9af29a8b72180cf1a23f09522 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,8 @@
 *~
 .DS_Store
+
 externals/*
+m-unit-tests/*
+
 src/git.info
-src/git.last-commit-hash
\ No newline at end of file
+src/git.last-commit-hash
diff --git a/Makefile b/Makefile
index dc901657fc6c717ed4ca6032da546ef55620204b..0fb0d145b4f2a59ae9a0f6fc6460397765f12f2b 100644
--- a/Makefile
+++ b/Makefile
@@ -3,12 +3,17 @@ MATLAB=`which matlab`
 
 all: check-octave check-matlab
 
-check-octave:
+m-unit-tests/src/mtest.m:
+	git clone https://git.dynare.org/Dynare/m-unit-tests
+
+check-octave: m-unit-tests/src/mtest.m
 	@cd tests ;\
 	$(OCTAVE) --no-init-file --silent --no-history --eval "addpath([pwd() '/../m-unit-tests/src']); runalltests" && [ ! -f ./failed ] && [ -f ./pass ]
 
-check-matlab:
+check-matlab: m-unit-tests/src/mtest.m
 	@$(MATLAB)  -nosplash -nodisplay -r "addpath m-unit-tests/src; cd tests; runalltests; quit" && [ ! -f ./tests/failed ] && [ -f ./tests/pass ]
 
 check-clean:
 	rm -f tests/*_test_*.m tests/*.csv tests/*.xls tests/*.xlsx tests/*.mat tests/failed tests/datafile_for_test
+	rm -f git.info git.last-commit-hash tests/pass tests/failed tests/*.spc
+	rm -rf m-unit-tests