]> rtime.felk.cvut.cz Git - jenkicar/rpp-simulink.git/blob - rpp/blocks/Makefile
Simplify building of rpp_lib
[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 # 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.
10 #
11 # File : Makefile
12 # Abstract:
13 #     Build documentation
14
15 include ../lib/Makefile.config
16
17 SF = $(wildcard sfunction_*.c)
18 HTML = $(SF:%.c=%.html)
19 MEX = $(SF:%.c=%.mexa64)
20
21 all: $(MEX) $(HTML) rpp_lib.slx
22
23 clean::
24         rm -rf $(MEX) $(HTML) rpp_lib.slx
25
26 ################################
27 # S-functions and documentation
28 ################################
29
30 %.mexa64: %.c
31         mex $(CFLAGS) $^
32
33 MATLAB=$(shell cd $(dir $(shell readlink -f $$(which mex)))/..; pwd)
34 CAN_BLOCKS=sfunction_cantransmit.mexa64 sfunction_canreceive.mexa64
35 $(CAN_BLOCKS): CFLAGS=-I$(MATLAB)/toolbox/shared/can/src/scanutil -I$(MATLAB)/toolbox/rtw/targets/common/can/datatypes
36 $(CAN_BLOCKS): $(MATLAB)/toolbox/rtw/targets/common/can/datatypes/sfun_can_util.c $(MATLAB)/toolbox/rtw/targets/common/can/datatypes/can_msg.c
37
38 %.html: %.c
39         scripts/doc_parse.py --printhelp --html $< > $@
40
41 diff-doc: $(HTML)
42         matlab -nodesktop -nojvm -r "exit(rpp_update_doc('diff') > 0)"
43
44 update-doc: $(HTML)
45         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
46
47 define PRINT_COMMIT_MSG
48 (echo "Update block masks by running rpp_update_doc.m"; echo; echo "Changelog:"; sed -n -e '/^Processing rpp_lib/,$$ p' update-doc.log)
49 endef
50
51 commit-doc: update-doc
52         $(PRINT_COMMIT_MSG) | git commit -F - rpp_lib.slx
53
54 ################################
55 # Block library
56 ################################
57
58 BLOCKS = $(blocks_$(TARGET))
59
60 blocks_rm48_hdk = $(BLOCKS_HDK)
61 blocks_tms570_hdk = $(BLOCKS_HDK)
62
63 BLOCKS_HDK =                    \
64         rpp_can_rx                      \
65         rpp_can_setup           \
66         rpp_can_tx                      \
67         rpp_gio_in                      \
68         rpp_gio_out                     \
69         rpp_hdk_ain                     \
70         rpp_overrun                     \
71         rpp_sci_cfg                     \
72         rpp_sci_printf          \
73         rpp_sci_rx                      \
74         rpp_sci_tx
75
76 rpp_lib.slx:
77         matlab -nodesktop -nojvm -r "try, rpp_generate_lib $(BLOCKS); catch ME, disp(getReport(ME)); exit(1); end; exit(0)"