Real-Time Workshop | ![]() ![]() |
Choosing and Configuring Your Compiler
The Real-Time Workshop build process depends upon the correct installation of one or more supported compilers. Note that compiler, in this context, refers to a development environment containing a linker and make utility, in addition to a high-level language compiler.
The build process also requires the selection of a template makefile. The template makefile determines which compiler will be run, during the make phase of the build, to compile the generated code.
This section discusses how to install a compiler and choose an appropriate template makefile, on both Windows and UNIX systems.
Choosing and Configuring Your Compiler on Windows
On Windows, you must install one or more supported compilers, In addition, you must define an environment variable associated with each compiler.Make sure that your compiler is installed as described in Third-Party Compiler Installation on Windows.
You can select a template makefile that is specific to your compiler. For example, grt_bc.tmf
designates the Borland C/C++ compiler, and grt_vc.tmf
designates the Visual C/C++ compiler.
Alternatively, you can choose a default template makefile that will select the default compiler for your system. The default compiler is the compiler MATLAB uses to build MEX-files. You can set up the default compiler by using the MATLAB mex
command as shown below.
See the External Interfaces/API in the MATLAB online documentation for information on the mex
command.
Default template makefiles are named target
_default_tmf
. For example, the default template makefile for the generic real-time (GRT) target is grt_default_tmf
.
The build process uses the following logic to locate a compiler for the generated code:
grt_default_tmf
), the build process uses the same compiler as those used for building C MEX-files.
MSDevDir
or DEVSTUDIO
(defining the path to the Microsoft Visual C/C++)
WATCOM
(defining the path to the Watcom C/C++ compiler)
BORLAND
(defining the path to the Borland C/C++ compiler)
lcc
compiler, which is shipped and installed with MATLAB.
Compile/Build Options for Visual C/C++. Real-Time Workshop offers two sets of template makefiles designed for use with Visual C/C++.
To compile under Visual C/C++ and build an executable within the Real-Time Workshop build process, use one of the target
_vc.tmf
template makefiles:
Alternatively, you can choose to create a project makefile (model
.mak
) suitable for use with the Visual C/C++ IDE. In this case, you must compile and link your code within the Visual C/C++ environment. To create a Visual C/C++ project makefile, choose one of the Visual C/C++ Project Makefile versions of the grt
, ert
, or grt_malloc
target configurations. These configurations use the target
_msvc.tmf
template makefiles:
Choosing and Configuring Your Compiler On UNIX
On UNIX, the Real-Time Workshop build process uses the default compiler. cc
is the default on all platforms except SunOS, where gcc
is the default.
You should choose the UNIX-specific template makefile that is appropriate to your target. For example, grt_unix.tmf
is the correct template makefile to build a generic real-time program under UNIX.
Available Compiler/Makefile/Target Configurations
To determine which template makefiles are appropriate for your compiler and target, see Table 2-1, Targets Available from the System Target File Browser,.
![]() | Compilation and Linking | Template Makefiles and Make Options | ![]() |