Main Content

Build Process Customization

Cross-compilation, post-code-generation processing, target build process customization

Customize the build process and, if necessary, the build process infrastructure for your application development environment and run-time requirements. Control the files and flags for compiling and linking code.

If your system includes referenced models, reduce build time and control whether the code generator regenerates code for the top model.


expand all

addCompileFlagsAdd compiler options to build information
addDefinesAdd preprocessor macro definitions to build information
addIncludeFilesAdd include files to build information
addIncludePathsAdd include paths to build information
addLinkFlagsAdd link options to build information
addLinkObjectsAdd link objects to build information
addNonBuildFilesAdd nonbuild-related files to build information
addSourceFilesAdd source files to build information
addSourcePathsAdd source paths to build information
addTMFTokensAdd template makefile (TMF) tokens to build information
removeSourceFilesRemove source files from build information object
findBuildArgFind a specific build argument in build information
findIncludeFilesFind and add include (header) files to build information
getBuildArgsGet build arguments from build information
getCompileFlagsGet compiler options from build information
getDefinesGet preprocessor macro definitions from build information
getFullFileListGet list of files from build information
getIncludeFilesGet include files from build information
getIncludePathsGet include paths from build information
getLinkFlagsGet link options from build information
getNonBuildFilesGet nonbuild-related files from build information
getSourceFilesGet source files from build information
getSourcePathsGet source paths from build information
setTargetProvidesMainDisable inclusion of code generator provided (generated or static) main.c source file during build
updateFilePathsAndExtensionsUpdate files in build information with missing paths and file extensions
updateFileSeparatorUpdate file separator character for file lists in build information
slConfigUIGetValReturn current value for any model configuration parameter
slConfigUISetEnabledEnable or disable any model configuration parameter
slConfigUISetValSet value for any model configuration parameter
codebuildCompile and link generated code


expand all

RTW.BuildInfoProvide information for compiling and linking generated code


Customize Build Process

Approaches for Building Code Generated from Simulink Models

Choose CMake, toolchain, or template makefile approach for building generated code.

Template Makefiles and Make Options

Template makefiles that are built into the code generator.

Control Build Process Compiling and Linking

Select whether build process ends after code generation and (for template makefile approach) select template makefile options.

Control Compiler Optimizations

Control compiler optimizations for your makefile at the Simulink UI level.

Control Library Location and Naming During Build

Choose the location for precompiled, non-precompiled, and model reference libraries and select the file extension that the build process applies to libraries.

Control Regeneration of Top Model Code

Choose options for regenerating code for the top-level model.

Reduce Build Time for Referenced Models by Using Parallel Builds

Apply parallel builds to reduce build time for large model reference hierarchies.

Use makecfg to Customize Generated Makefiles for S-Functions

Configure makefile generation for the S-function build process.

Customize Post-Code-Generation Build Processing

Modify the build process with a post-code-generation command and (optionally) use build information objects to augment this process.

Recompile Precompiled Libraries

Apply custom setting to precompiled libraries for platforms or environments through recompile process.

Relocate Code to Another Development Environment

Use code generation and packaging options to relocate code and artifacts to another development environment.

Compile Code in Another Development Environment

Relocate generated code and compile in another environment.

Customize Build Process Infrastructure

Register Custom Toolchain and Build Executable

Register and use a toolchain to build an executable program.

Customize Build Process with STF_make_rtw_hook File

Modify the build process with the build process hook mechanism in a custom STF_make_rtw_hook.m hook file.

Customize Build Process with sl_customization.m

Modify the build process with the build process hook mechanism in a custom sl_customization.m hook file.

Replace STF_rtw_info_hook Supplied Target Data

For custom targets created prior to MATLAB® Release 14, update use of custom STF_make_rtw_hook hook for specifying target-specific characteristics.

Develop a Custom Target

Custom Targets

Create software to deploy MATLAB and Simulink® designs to hardware platforms.

Customize System Target Files

Develop a custom system target file to meet development goals and to control code generation.

Custom Target Optional Features

Add optional feature support to a custom system target file for compliance with code generation features, such as toolchain compliance and model reference compliance.

Support Toolchain Approach with Custom Target

Add toolchain approach support to a custom system target file for more user-interface controls of the build process.

Support C Function Prototype Control

Add C function prototype control support to a custom system target file for more build process control.

Support C++ Class Interface Control

Add C++ class interface control support to a custom system target file for more build process control.

Support Model Referencing

Add model reference support to a custom system target file for model reference builds.

Support Compiler Optimization Level Control

Add compiler optimization level control support to a custom system target file for more build process control.

Support Concurrent Execution of Multiple Tasks

Add multitasking execution support to a custom system target file for multicore target models.

Device Drivers

Use device drivers as part of a real-time development project.