Package: coder.make
Represent build tool
Use coder.make.BuildTool
to get and define
an existing default coder.make.BuildTool
object,
or to create a coder.make.BuildTool
object.
To work with default BuildTool
objects, use
the get and define approach from the ToolchainInfo
properties:
coder.make.ToolchainInfo.BuildTools
coder.make.ToolchainInfo.PostbuildTools
Examples showing the get and define approach are:
Tutorial example: Adding a Custom Toolchain tutorial
An alternative to the get and define approach is the create new approach. An example showing the create new approach appears in Create a Non-Default BuildTool.
The illustration shows the relationship between the default BuildTool
objects
and ToolchainInfo
. When you examine the PHONY
TARGETS
section of the generated makefile, the difference
between the BuildTools
, PostbuildTools
,
and PrebuildTools
becomes clearer.
prebuild
– runs only the
prebuild tool.
build
– runs the build tools
after running prebuild. The build
generates the
build PRODUCT
.
postbuild
– runs the postbuild
tool after running build.
all
– runs prebuild, build,
and postbuild. The build process uses this rule on a Ctrl+B build.
clean
– cleans up all output
file extensions and derived file extensions of all the tools in the
toolchain.
info
– expands and prints
all macros used in the makefile.
creates
a h
= coder.make.BuildTool(bldtl_name
)coder.make.BuildTool
object and sets its Name
property.
addDirective | Add directive to Directives |
addFileExtension | Add new file extension entry to FileExtensions |
getCommand | Get build tool command |
getDirective | Get value of named directive from Directives |
getFileExtension | Get file extension for named file type in FileExtensions |
getName | Get build tool name |
getPath | Get path and macro of build tool in Path |
info | Display build tool properties and values |
setCommand | Set build tool command |
setCommandPattern | Set pattern of commands for build tools |
setCompilerOptionMap | Set C/C++ language standard and compiler options for selected build tool (compiler) |
setDirective | Set value of directive in Directives |
setFileExtension | Set file extension for named file type in FileExtensions |
setName | Set build tool name |
setPath | Set path and macro of build tool in Path |
validate | Validate build tool properties |
Handle. To learn how handle classes affect copy operations, see Copying Objects.
The intel_tc.m
file from Adding a Custom Toolchain uses the following lines to get a default
build tool, C Compiler
, from a ToolchainInfo
object called tc
, and then sets its
properties.
% ------------------------------ % C Compiler % ------------------------------ tool = tc.getBuildTool('C Compiler'); tool.setName('Intel C Compiler'); tool.setCommand('icl'); tool.setPath(''); tool.setDirective('IncludeSearchPath','-I'); tool.setDirective('PreprocessorDefine','-D'); tool.setDirective('OutputFlag','-Fo'); tool.setDirective('Debug','-Zi'); tool.setFileExtension('Source','.c'); tool.setFileExtension('Header','.h'); tool.setFileExtension('Object','.obj'); tool.setCommandPattern('|>TOOL<| |>TOOL_OPTIONS<| |>OUTPUT_FLAG<||>OUTPUT<|');
The following examples show the same “get and define” approach in more detail:
Tutorial example: Adding a Custom Toolchain tutorial
To create a build tool:
Create a file that defines a BuildTool
object,
such as createBuildTool_1.m
or createBuildTool_2
.
Create a file like addBuildToolToToolchainInfo.m
,
that:
Creates a ToolchainInfo
object, or
uses an existing one.
Creates a BuildTool
object from createBuildTool_1.m
or createBuildTool_2
.
Adds the BuildTool
object to the ToolchainInfo
object.
Run addBuildToolToToolchainInfo.m
.
Refer to the following examples of addBuildToolToToolchainInfo.m
, createBuildTool_1.m
,
and createBuildTool_2.m
.
The code in the addPrebuildToolToToolchainInfo.m
and
the addPostbuildToolToToolchainInfo.m
examples
show how to add prebuild and postbuild tools to a toolchain.