summaryrefslogtreecommitdiff
path: root/Examples/test-suite/matlab/Makefile.in
blob: 422713b98ea78553ee4180fa670c6db50688d034 (plain)
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
59
60
61
62
63
64
65
66
67
68
#######################################################################
# Makefile for matlab test-suite
#######################################################################

LANGUAGE        = matlab
MATLAB          = @MATLAB@
MATLAB_OPTS     = @MATLAB_OPTS@
MATLAB_EXEC     = @MATLAB_EXEC@
SCRIPTSUFFIX    = _runme

srcdir       = @srcdir@
top_srcdir   = @top_srcdir@
top_builddir = @top_builddir@

CPP_TEST_BROKEN += \
	arrays_global

include $(srcdir)/../common.mk

# Custom tests - tests with additional commandline options
# none!

# Rules for the different types of tests
%.cpptest:
	$(setup)
	+$(swig_and_compile_cpp)
	$(run_testcase)

%.ctest:
	$(setup)
	+$(swig_and_compile_c)
	$(run_testcase)

%.multicpptest:
	$(setup)
	+$(swig_and_compile_multi_cpp)
	$(run_testcase)

# Runs the testcase. A testcase is only run if
# a file is found which has _runme.m appended after the testcase name.
run_testcase = \
	if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX).m ]; then \
	 RUNSCRIPT="\
	  try; \
	    $(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
	  catch err; \
	    fprintf(1, ['ERROR: ' err.message '\\\n']); \
	    fprintf(2, ['ERROR: ' err.message '\\\n']); \
	    exit(1); \
	    end; \
	  exit(0)" ; \
	 env LD_LIBRARY_PATH=".:$$LD_LIBRARY_PATH" MATLABPATH="$(srcdir):$(SCRIPTDIR):$$MATLAB_PATH" \
	 $(RUNTOOL) "$(MATLAB)" $(MATLAB_OPTS) $(MATLAB_EXEC) "$$RUNSCRIPT"  $(RUNPIPE); \
	 if [ $$? -ne 0 ] ; then \
	   echo "   $* failed" $(RUNPIPE) ; \
	 else \
	   echo "   $* passed" $(RUNPIPE) ; \
	 fi \
	else \
	   echo "   $* build passed (no runme test present)" $(RUNPIPE) ; \
	fi

# Clean: remove the generated .m file
%.clean:
	@rm -rf $*.m +$*;

clean:
	$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" matlab_clean