Build Macros

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Build Macros

2,972 Views
lpcware-support
Senior Contributor I

A list of available Build Macros (variables) can be found by

  • Selecting the project
  • Opening its properties
  • Select C/C++ Build
  • Click on Build Variables
  • Ensure Show system variables is checked

File-specific macros

The set of file-context macros is predefined by the Managed Build System (MBS). Neither a tool-integrator nor a user can define new file-context macros.

Macro

Value

Type

Description
${InputFileName}Text

Represents the input file name. The input file has the following meaning:

If a tool does not accept building multiple files of the primary input type with one tool invocation, the input file is the file of the primary input type being built.

If a tool accepts building multiple files of the primary input type with one tool invocation the input file is undefined and the macros representing the input file contain information about one of the inputs of the primary input type being built.

${InputFileExt}TextRepresents the extension of the input file.
${InputFileBaseName}TextRepresents the base name of the input file. That is the file name with an extension stripped.
${InputFileRelPath}Path(File)Represents the input file path relative to the builder current directory.
${InputDirRelPath}

Path(Dir)

Represents the input file directory path relative to the builder current directory.

${OutputFileName}

Text

Represents the output file name. The output file has the following meaning:

1.If a tool is not capable of producing multiple files of the primary output type with one tool invocation the output file is the file of the primary output type that is built with a given tool invocation.

2.If a tool is capable of producing multiple files of the primary output type with one tool invocation the output file is undefined and the macros representing the output file contain information about one of the files of the primary output type that are built with a given tool invocation.

${OutputFileExt}

Text

Represents the output file extension.
${OutputFileBaseName}

Text

Represents the output file base name. That is the output file name with an extension stripped.

${OutputFileRelPath}Path(File)Represents the output file path relative to the current builder directory.
${OutputDirRelPath}

Path(Dir)

Represents the output file directory path relative to the current builder directory.

T

Configuration-specific macros

MacroValue TypeDescription
${ConfigName}TextRepresents the name of a given configuration.
${ConfigDescription}Text

Represents the description of a given configuration.

${BuildArtifactFileName}TextRepresents the name of the build artifact.
${BuildArtifactFileExt}TextRepresents the extension of the build artifact.
${BuildArtifactFileBaseName}Text

Represents the base name of the build artifact.

${BuildArtifactFilePrefix}Text

Represents the prefix of the build artifact.

${TargetOsList}Text-ListRepresents the list of the target OS names.
${TargetArchList}Text-ListRepresents the list of the target Arch names.

Project-specific macros

${ProjName}

Text

Represents the name of a given project.
${ProjDirPath}

Path(Dir)

Represents the absolute path of a given project.

Workspace-specific macros

${WorkspaceDirPath}Path(Dir)Represents the workspace absolute path.
${DirectoryDelimiter}Text

Represents the directory delimiter used on the system. That is the “\? for Win32 systems and the “/? for Unix-like systems

This could be useful, e.g. in the case a user needs the absolute path of an input file. The absolute path would be represented in the following way: ${CWD}${DirectoryDelimiter}${InputFileRelPath}

${PathDelimiter}Text

Represents the default path delimiter used on the system to separate paths in the path environment variables. That is the “;? for Win32 systems and the “:? for Unix-like systems

This might be used in the environment variable definitions

CDT/Eclipse installation-specific macros

${EclipseVersion}Text
Represents the current Eclipse version.
${CDTVersion}TextRepresents the current CDT version.
${MBSVersion}TextRepresents the current MBS version.
${HostOsName}TextRepresents the operating system name on which eclipse is running.
${HostArchName}TextRepresents the architecture name on which eclipse is running.
${env_var:ENV_VAR}TextReplaces the macro with the value of the environment variable ENV_VAR

LPCXpresso specific macros

${TargetChip}Text

Represents the name of the MCU, for example LPC1768.

${TargetProc}Text

Represents the name of the CPU, for example cortex-m3.

${TargetVendor}Text

Represents the name of the vendor, for example NXP.

Usage


These are typically used in Pre- and Post- Build steps. For example, a Post-Build step to copy the built file to a fixed location:

cp ${BuildArtifactFileName} c:\temp;

Another example is to convert the executable file into a binary file:

arm-none-eabi-objcopy -O binary ${BuildArtifactFileName} ${BuildArtifactFileBaseName}.bin ;

For more information on post build step, please see the FAQ Post-processing your linked application

Links


More information can be found on Build Macros can be found at: http://publib.boulder.ibm.com/infocenter/rsahelp/v7r0m0/index.jsp?topic=/org.eclipse.cdt.doc.user/re...

Labels (1)
0 Kudos
0 Replies