2.6 [BuildOptions] Section

Content in the [BuildOptions] section defines module specific tool chain flags that must be used as the default flags for a module. These flags are appended to any standard flags that are defined by the build process. In order to replace the standard flags that are defined by the build process, an alternate assignment operator must be used; "==" is used for replacement, while "=" is used to append the flag lines. Flags specified in this section can either be appended to the standard flags (defined in the Conf/tools_def.txt) or replace the standard flags. In addition to flags, other tool attributes may have the item either appended or replaced.

The left side content of a statement may appear in both common and architectural sections. For example, MSFT:DEBUG_*_*_CC_FLAGS may be listed in a common section, while MSFT:DEBUG_*_IA32_CC_FLAGS may be listed in the architectural section. If the operator is a single "=" character, the flags from the architectural section are appended to the flags from the common section. Using this section may limit the ability of a module to be compiled with different tool chains or with different build systems and is therefore, discouraged.

Valid content is within this section is limited to the following description.

Table 2 EDK II [BuildOptions] Section Elements

In this section, the following table describes each of the variables that are shown above.

Table 3 EDK II [BuildOptions] Variable Descriptions

Developers should use extreme caution when specifying items in this section. The EDK II build is designed to support multiple compilers and tool chains, expecting that code is written in ANSI C. If custom tool flags are required by a module, developers must make sure that all consumers of the module are aware of the specific tools and tag names required.

Note: The lines are shown with the backslash "\" character to indicate a line continuation, they are not allowed in the actual INF file.

[BuildOptions.common]
  MSFT:DEBUG_*_IA32_DLINK_FLAGS = /out:"$(BIN_DIR)SecMain.exe"/base:0x10000000 /pdb:"$(BIN_DIR)SecMain.pdb"/LIBPATH:"$(VCINSTALLDIR)Lib"/LIBPATH:"$(VCINSTALLDIR)PlatformSdkLib"/NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086/MAP /OPT:REF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib Gdi32.lib User32.libWinmm.lib
  MSFT:DEBUG_*_IA32_CC_FLAGS    = /nologo /W4 /WX /Gy /c /D UNICODE/D EFI32 /Od /DSTRING_ARRAY_NAME=SecMainStrings /FI$(DEST_DIR_DEBUG)/AutoGen.h /EHs-c- /GF /Gs8192/Zi /Gm

For [BuildOptions] sections in the INF file, the entries with a common left side (of the "=") will be either appended or replace previous entries based on the "==" replace or "=" append assignment character sequence. Sections with identical architecture modifiers are appended to each other.

Common Section + Architectural Section

Example:

[BuildOptions.Common]
  MSFT:*_*_*_CC_FLAGS = /nologo

[BuildOptions.Common]
  MSFT:*_*_*_CC_FLAGS = /Od

[BuildOptions.IA32]
  MSFT:*_*_IA32_CC_FLAGS = /D EFI32

For IA32 architecture builds of an EDK II INF file would logically be:

MSFT:*_*_IA32_CC_FLAGS = /nologo /Od /D EFI32

For X64 architecture builds of an EDK II INF file would logically be:

MSFT:*_*_IA32_CC_FLAGS = /nologo /Od

Last updated