You can check the following link which talks about Customizing Build Process with STF_make_rtw_hook File http://www.mathworks.com/help/rtw/ug/customizing-the-target-build-process-with-the-stf-make-rtw-hook-file.html
Additionally, you could also check the below MATLAB Answers link on how to add non-UI elements to a custom System Target file.