-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
61 lines (46 loc) · 1.63 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Makefile based on https://github.com/MOxUnit/MOxUnit/blob/master/Makefile
.PHONY: help \
test-matlab test-octave test
MATLAB?=matlab
OCTAVE?=octave
TESTDIR=$(CURDIR)/tests
UTILSDIR=$(CURDIR)/utils
ADDPATH=addpath('$(UTILSDIR)');
help:
@echo "Usage: make <target>, where <target> is one of:"
@echo "------------------------------------------------------------------"
@echo " test to run tests using the Matlab and GNU Octave"
@echo " search paths, whichever is present"
@echo ""
@echo " test-matlab to run tests using Matlab"
@echo " test-octave to run tests using GNU Octave"
@echo "------------------------------------------------------------------"
RUNTESTS_ARGS='${TESTDIR}'
TEST=$(ADDPATH);success=moxunit_runtests($(RUNTESTS_ARGS));exit(~success);
MATLAB_BIN=$(shell which $(MATLAB))
OCTAVE_BIN=$(shell which $(OCTAVE))
ifeq ($(MATLAB_BIN),)
# for Apple OSX, try to locate Matlab elsewhere if not found
MATLAB_BIN=$(shell ls /Applications/MATLAB_R20*/bin/${MATLAB} 2>/dev/null | tail -1)
endif
MATLAB_RUN=$(MATLAB_BIN) -nojvm -nodisplay -nosplash -r
OCTAVE_RUN=$(OCTAVE_BIN) --no-gui --quiet --eval
test-matlab:
@if [ -n "$(MATLAB_BIN)" ]; then \
$(MATLAB_RUN) "$(TEST)"; \
else \
echo "matlab binary could not be found, skipping"; \
fi;
test-octave:
@if [ -n "$(OCTAVE_BIN)" ]; then \
$(OCTAVE_RUN) "$(TEST)"; \
else \
echo "octave binary could not be found, skipping"; \
fi;
test:
@if [ -z "$(MATLAB_BIN)$(OCTAVE_BIN)" ]; then \
@echo "Neither matlab binary nor octave binary could be found" \
exit 1; \
fi;
$(MAKE) test-matlab
$(MAKE) test-octave