1 % Copyright (C) 2013-2014 Czech Technical University in Prague
4 % - Carlos Jenkins <carlos@jenkins.co.cr>
6 % This document contains proprietary information belonging to Czech
7 % Technical University in Prague. Passing on and copying of this
8 % document, and communication of its contents is not permitted
9 % without prior written authorization.
11 % File : compile_blocks.m
13 % Compile all the C-MEX S-Function in current folder.
16 % http://www.mathworks.com/help/matlab/ref/mex.html
17 % http://www.mathworks.com/help/matlab/matlab_external/custom-building-mex-files.html
20 function compile_blocks()
23 % -g Create a binary MEX-file containing additional symbolic
24 % information for use in debugging. This option disables the mex
25 % default behavior of optimizing built object code
26 % (see the -O option).
27 % -v Verbose mode. Print the values for important internal variables
28 % after the options file is processed and all command-line
29 % arguments are considered. Prints each compile step and final
30 % link step fully evaluated.
33 mex = fullfile(matlabroot(), 'bin', 'mex');
34 sources = dir('sfunction_*.c');
38 if strcmp(i.name, 'sfunction_canreceive.c') || ...
39 strcmp(i.name, 'sfunction_cantransmit.c'),
40 local_opts = [local_opts ' ' ...
41 '-I' matlabroot '/toolbox/shared/can/src/scanutil ' ...
42 '-I' matlabroot '/toolbox/rtw/targets/common/can/datatypes ' ...
43 matlabroot '/toolbox/rtw/targets/common/can/datatypes/sfun_can_util.c '...
44 matlabroot '/toolbox/rtw/targets/common/can/datatypes/can_msg.c'];
46 command = [mex ' ' i.name ' ' local_opts];
48 [status, result] = system(command);
51 throw(MException('rpp:compile_block_failure', [i.name, ' failed to compile']))