Macro Statements

The following EBNF describes the syntax of MACROs used in EDK II meta-data files. In the EDK II meta-data files, conditional directive blocks may be prohibited or may have restricted usage. Refer to the individual EDK II meta-data file specifications for specific restrictions.

Syntax

<MacroDefinition> := <TS> "DEFINE" <MTS> <MACRO> [<Eq> [<VALUE>]] <EOL>
‚Äč
<VALUE> := {<Number>} {<BoolType>} {<CFormatGUID>} {<PATH>}
{<CString>} {<UnicodeString>} {<CArray>}
{<Expression>} {<CFlags>} {<Filename>}

Restrictions

System Environment Variables

System environment variable may not be re-defined in this file. System environment variables cannot be overridden by the build system tools.

Parameters

Expression

C-style expression using C relational, equality and logical numeric and bitwise operators and/or arithmetic and bitwise operators that evaluate to a value (for PCDs, the value must match the Datum Type of the PCD). Precedence and associativity follow C standards. Along with absolute values, macro names and PCDs may be used within an expression. For both macro names and PCDs, the element must be previously defined before it can be used.

VALUE

The <EQ> <VALUE> is optional, and if not included, uses a default of TRUE.

Note: Some MACRO and PCD values may be defined in the Platform DSC file.

Examples:

DEFINE SECCORE = MyPlatform/SecCore
DEFINE <code>GEN_SKU <\code>= MyPlatform/GenPei
DEFINE SKU1 = MyPlatform/Sku1/Pei
DEFINE <code>FLASH_SIZE <\code>= 0x00280000
DEFINE <code>MY_MACRO

EDK_GLOBAL

The macro names defined using the EDK_GLOBAL statement in the DSC file may be used in paths, value fields and conditional statements in this file. The EDK_GLOBAL statement itself, cannot be specified in this file.