Main Content

addTMFTokens

Add template makefile (TMF) tokens to build information

Description

addTMFTokens(buildinfo,tokennames,tokenvalues,groups) specifies TMF tokens and values to add to the build information.

To provide build-time information to help customize makefile generation, call the addTMFTokens function inside a post-code-generation command. The tokens specified in the addTMFTokens function call must be handled in the template makefile (TMF) for the target selected for your project. For example, you can call addTMFTokens in a post-code-generation command to add a TMF token named |>CUSTOM_OUTNAME<| with a token value that specifies an output file name for the build. To achieve the result you want, the TMF must apply an action with the value of |>CUSTOM_OUTNAME<|. (See Examples.)

The addTMFTokens function adds specified TMF token names and values to the build information. The code generator stores the TMF tokens in a vector. The function adds the tokens to the end of the vector in the order that you specify them.

The function requires the buildinfo, tokennames, and tokenvalues arguments. You can use an optional groups argument to group your options. You can specify groups as a character vector or as an array of character vectors.

example

Examples

collapse all

Inside a post-code-generation command, add the TMF token |>CUSTOM_OUTNAME<| and its value to build information myBuildInfo, and place the token in the group LINK_INFO.

myBuildInfo = RTW.BuildInfo;
addTMFTokens(myBuildInfo, ...
             '|>CUSTOM_OUTNAME<|', 'foo.exe', 'LINK_INFO');

In the TMF for the target selected for your project, this code uses the token value to achieve the result that you want:

CUSTOM_OUTNAME = |>CUSTOM_OUTNAME<|
...
target:
$(LD) -o $(CUSTOM_OUTNAME) ...

Input Arguments

collapse all

RTW.BuildInfo object that contains information for compiling and linking generated code.

You can specify the tokennames argument as a character vector, as an array of character vectors, or as a string. If you specify the tokennames argument as multiple character vectors, for example, '|>CUSTOM_OUTNAME<|' '|>COMPUTER<|', the tokennames argument is added to the build information as an array of character vectors.

Example: '|>CUSTOM_OUTNAME<|' '|>COMPUTER<|'

You can specify the tokenvalues argument as a character vector, as an array of character vectors, or as a string. If you specify the tokenvalues argument as multiple character vectors, for example, '|>CUSTOM_OUTNAME<|' 'PCWIN64', the tokennames argument is added to the build information as an array of character vectors.

Example: 'foo.exe' 'PCWIN64'

You can specify the groups argument as a character vector, as an array of character vectors, or as a string. If you specify multiple groups, for example, 'LINK_INFO' 'COMPUTER_INFO', the function relates the groups to the tokennames in order of appearance. For example, the tokennames argument '|>CUSTOM_OUTNAME<|' '|>COMPUTER<|' is an array of character vectors with two elements. The first element is in the 'LINK_INFO' group, and the second element is in the 'COMPUTER_INFO' group.

Example: 'LINK_INFO' 'COMPUTER_INFO'

Version History

Introduced in R2009b