MATLAB: Do the before/after_make hook callbacks trigger in Real-Time Workshop 5.6 (R2010b) even when the ‘Generate code only’ option is selected

simulink coder

I'm using the System Target File (STF) hooks 'before_make' and 'after_make'. And even though I have selected 'Generate code only' from RTW Configuration Parameters dialog box, these two hooks are being called.
Since I am not building the model, no 'make' command has been invoked to compile any source files. Hence, I do not expect these two hooks should not be invoked.

Best Answer

The behavior of calling these hook functions independent of the parameter setting 'Generate code only' is expected. When 'Generate code only' is selected, Real Time Workshop will still create the makefile from the template makefile which is part of the 'before_make' phase.
As a possible workaround, modify the callbacks to use "get_param" and determine if the "Generate code only" box is checked or not, and end early if it is checked. For example:
if strcmp(get_param('mymodel','GenCodeOnly'),'off')
%run my code
end