]> rtime.felk.cvut.cz Git - jenkicar/rpp-simulink.git/blob - rpp/blocks/Makefile
Change license to MIT
[jenkicar/rpp-simulink.git] / rpp / blocks / Makefile
1 # Copyright (C) 2013, 2015 Czech Technical University in Prague
2 #
3 # Authors:
4 #     - Michal Sojka <sojkam1@fel.cvut.cz>
5 #
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
13 # conditions:
14
15 # The above copyright notice and this permission notice shall be
16 # included in all copies or substantial portions of the Software.
17
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.
26 #
27 # File : Makefile
28 # Abstract:
29 #     Build documentation
30
31 include ../lib/Makefile.config
32
33 SF = $(wildcard sfunction_*.c)
34 HTML = $(SF:%.c=%.html)
35 MEX = $(SF:%.c=%.mexa64)
36
37 all: $(MEX) $(HTML) rpp_lib.slx
38
39 clean::
40         rm -rf $(MEX) $(HTML) rpp_lib.slx
41
42 ################################
43 # S-functions and documentation
44 ################################
45
46 %.mexa64: %.c
47         mex $(CFLAGS) $^
48
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
53
54 %.html: %.c
55         scripts/doc_parse.py --printhelp --html $< > $@
56
57 diff-doc: $(HTML)
58         matlab -nodesktop -nojvm -r "exit(rpp_update_doc('diff') > 0)"
59
60 update-doc: $(HTML)
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
62
63 generate-lib:
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
66
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)
69 endef
70
71 commit-doc: update-doc
72         $(PRINT_COMMIT_MSG) | git commit -F - $$(git ls-files -m '*.slx')
73
74 ################################
75 # Block library
76 ################################
77
78 rpp_lib.slx:
79         matlab -nodesktop -nojvm -r "try, rpp_generate_lib $(BLOCKS); catch ME, disp(getReport(ME)); exit(1); end; exit(0)"