How to compile and link all files generated with RTW from my .tmf file ??

Hi,
I'm generating a target and all his files. In the .tmf file I need to compile and link all the generated files in the "model directory", because they are not always the same
Thanks in advance.

Answers (1)

It's not clear exactly what kind of support you are looking for, but Customize Template Makefiles is a good place to start. I would also recommend familiarizing yourself with Makefiles first. A good beginner exercise is to actually modify the generated .mk file directly and test it until you achieve all your required build steps. Once this is done, it is fairly easy to update the corresponding.tmf file.

4 Comments

Now I'm adding the files to the linker manually, like this:
LINK32_OBJS= \
"$(INTDIR)\$(MODEL).obj" \
"$(INTDIR)\$(MODEL)_data.obj" \
and other files...
and then I use this commands to link:
"$(OUTDIR)\$(MODEL).dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
@echo "### $(BUILD_SUCCESS)"
!ENDIF
but when I try to generate a .dll with a big model, which uses some extra .c and .h files, my .tmf don't make the .obj with the new files. I have seen the macro |>MODEL_MODULES_OBJ<| that I perhaps can use to incorporate all needed files, but I don't know how concatenate $(INTDIR)\ at the beginnig of the every file of the macro |>MODEL_MODULES_OBJ<|
Have you added your additional files under the Configuration Parameters Window's Code Generation>Custom Code pane? See relevant doc here: http://www.mathworks.com/help/toolbox/rtw/ref/bq259jb-1.html
My problem is that I use a external compiler and linker:
LINK32=link.exe
And to generate the dll I need to pass the names of the .obj to the linker. For this reason, I think if I could concatenate "$(INTDIR)\" to all files in the macro |>MODEL_MODULES_OBJ<|, it could automatically link any model with different source files
Or is posible to use this type of commands:
SRCS = $(REQ_SRCS) $(USER_SRCS) $(S_FUNCTIONS)
OBJS_CPP_UPPER = $(SRCS:.CPP=.obj)
OBJS_CPP_LOWER = $(OBJS_CPP_UPPER:.cpp=.obj)
OBJS_C_UPPER = $(OBJS_CPP_LOWER:.C=.obj)
OBJS = $(OBJS_C_UPPER:.c=.obj)
SHARED_OBJS = $(SHARED_SRC:.c=.obj)
with a external linker?

Sign in to comment.

Categories

Find more on Simulink Coder in Help Center and File Exchange

Products

Asked:

on 27 Mar 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!