1 # Copyright (C) 2013, 2015 Czech Technical University in Prague
4 # - Michal Sojka <sojkam1@fel.cvut.cz>
6 # Permission is hereby granted, free of charge, to any person
7 # obtaining a copy of this software and associated documentation
8 # files (the "Software"), to deal in the Software without
9 # restriction, including without limitation the rights to use,
10 # copy, modify, merge, publish, distribute, sublicense, and/or sell
11 # copies of the Software, and to permit persons to whom the
12 # Software is furnished to do so, subject to the following
15 # The above copyright notice and this permission notice shall be
16 # included in all copies or substantial portions of the Software.
18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 # OTHER DEALINGS IN THE SOFTWARE.
31 include ../lib/Makefile.config
33 SF = $(wildcard sfunction_*.c)
34 HTML = $(SF:%.c=%.html)
35 MEX = $(SF:%.c=%.mexa64)
37 all: $(MEX) $(HTML) rpp_lib.slx
40 rm -rf $(MEX) $(HTML) rpp_lib.slx
42 ################################
43 # S-functions and documentation
44 ################################
49 MATLAB=$(shell cd $(dir $(shell readlink -f $$(which mex)))/..; pwd)
50 CAN_BLOCKS=sfunction_cantransmit.mexa64 sfunction_canreceive.mexa64
51 $(CAN_BLOCKS): CFLAGS=-I$(MATLAB)/toolbox/shared/can/src/scanutil -I$(MATLAB)/toolbox/rtw/targets/common/can/datatypes
52 $(CAN_BLOCKS): $(MATLAB)/toolbox/rtw/targets/common/can/datatypes/sfun_can_util.c $(MATLAB)/toolbox/rtw/targets/common/can/datatypes/can_msg.c
55 scripts/doc_parse.py --printhelp --html $< > $@
58 matlab -nodesktop -nojvm -r "exit(rpp_update_doc('diff') > 0)"
61 matlab -nodesktop -nojvm -r "try, rpp_update_doc('update'); catch ME, disp(getReport(ME)); exit(1); end; exit(0)" | sed -e "s/\x1b\(\[?1[hl]\|[=>]\)//g" | tee update-doc.log
64 matlab -nodesktop -nojvm -r "try, rpp_generate_lib('_$(TARGET)', $(rpp_blocks_set)); catch ME, disp(getReport(ME)); exit(1); end; exit(0)" | sed -e "s/\x1b\(\[?1[hl]\|[=>]\)//g" | tee generate-lib.log
65 cp --force ./_$(TARGET)/rpp_lib.slx ./rpp_lib.slx
67 define PRINT_COMMIT_MSG
68 (echo "Update block masks by running rpp_update_doc.m"; echo; echo "Changelog:"; sed -n -e '/^Processing /,$$ p' update-doc.log)
71 commit-doc: update-doc
72 $(PRINT_COMMIT_MSG) | git commit -F - $$(git ls-files -m '*.slx')
74 ################################
76 ################################
79 matlab -nodesktop -nojvm -r "try, rpp_generate_lib $(BLOCKS); catch ME, disp(getReport(ME)); exit(1); end; exit(0)"