Let's say we have models r1 and r2 where r1 is a model reference inside r2. When we generate code (Simulink coder – Generate code only) for r2, everything works fine and we get the artifacts. In the artifacts, we have a 'r2.bat' file in 'r2_grt_rtw\'.
When we run 'r2_grt_rtw\r2.bat' the make process fails as it does not know how to make or find 'r1' model libs. Now, the 'r2_grt_rtw\r2.bat' build will pass if we manually make 'r1.bat' found in 'slprj\grt\r1' and we also need to build the shared lib using 'slprj\grt\_sharedutils\rtwshared.bat'. (See reproduction steps for more clarity)
Questions:
- How to automate this such that the making of model references & shared libs i.e. executing 'slprj\grt\r1\r1.bat' & 'slprj\grt\_sharedutils\rtwshared.bat' becomes part of 'r2_grt_rtw\r2.bat' ??
- If the first question is not feasible then how can we add custom hooks into 'r2_grt_rtw\r2.bat' or 'r2_grt_rtw\r2.mk' through Simulink Coder, to achieve the execution of 'slprj\grt\r1\r1.bat', 'slprj\grt\_sharedutils\rtwshared.bat' & may be more model references batch scripts ?? My assumption is that hooks in a makefile can help us in executing make commands for referenced models.
Best Answer