Name
Build.exe – is the master command that provides developers with a single command for selecting various options of a build
Synopsis
Build.exe [-v | -q | -d] [-a <Arch>] [-p <DscFile>] [-m <InfFile>] [-b <Target>] [-t <TagName>] [-f FdfFile] [-r <RomImageName>] [-i <FvImageName>] [-C <CapsuleImageName>] [-n ThreadNum] [-x <SkuId>] [-u] [-e] [-w] [-j <LogFile>] [-s] [-D <MACROS>] [-y <ReportFile>] [-Y <ReportType>] [-F <Flags>] [All | GenC | GenMake | Fds | Libraries | Modules | Clean | CleanAll | CleanLib | run]
Build.exe –h
Build.exe --version
Description
Build.exe is the master command line (CLI) tool that provides a single command for selecting various build options. In general, it checks the environment variables, gets the user’s configuration from either the CLI or target.txt, parses the dsc, dec, inf, target.txt, tools_def.txt, generates .C, .H files and the Makefiles for one or more modules and/or the active platform, calls a make (NMake or make) program to process these Makefiles, then optionally calls GenFds to generate an fd file.
The build tool supports two kinds of path specifications on command line - an absolutely path or a relative (to the WORKSPACE environment variable) path – in command line.
Options
There are no required options. If no options are specified, it uses options specified in target.txt.
-a, --arch <ARCH>
ARCH is one of a list: IA32, X64, IPF or EBC, which overrides the target.txt's TARGET_ARCH  definition. To specify another ARCH, repeat this option.
-p, --platform PlatformName.dsc
Builds the platform specified by the DSC file. Thename argument, overrides the target.txt's  ACTIVE_PLATFORM definition.
-m, --module ModuleName.inf
Builds the module specified by the INF file name argument.
-b, --buildtarget <TARGET>
TARGET is one of a list: DEBUG, RELEASE, NOOPT， which overrides the target.txt's TARGET definition. To specify another TARGET, please repeat this option.
-t, --tagname Tagname
Uses the Tool Chain Tagname to build the platform.  It overrides target.txt's TOOL_CHAIN_TAG definition.
-f --fdf Filename.fdf
The name of the FDF file to use to override the setting in the DSC file.
-r --rom-image ROM_IMAGE_NAME
The name of FD to be generated. The name must be from [FD] section in FDF file.
-i --fv-image FV_IMAGE_NAME
The name of FV to be generated. The name must be from [FV] section in FDF file.
-C --capsule-image CAPSULE_IMAGE_NAME
The name of Capsule to be generated. The name must be from [Capsule] section in FDF file.
-n NUM
Builds the platform using multi-threaded compiler. The value overrides the target.txt's MULTIPLE_THREAD and MAX_CONCURRENT_THREAD_NUMBER. Using less than 2 will disable multi-thread builds.
-x --sku-id SKU_ID
Use SKU ID to build the platform and override the SKUID_IDENTIFIER in DSC file.
-u --skip-autogen
Use to skip the AutoGen step. Note the build may fail if there’s no AutoGen-ed files before.
-e --re-parse
Use to re-parse all meta-data files. Use this option if you encounter an inconsistency issue.
-w --warning-as-error
Use to treat warning in the tool as an error.
-j --log LOGFILE
Use to put screen output in specified file.
-s –silent
Enable  “make” tool to run “silently”. Internally, a ‘-s’ switch will be passed to “make” tool. Don’t use this option if your “make” tool doesn’t support ‘-s’. Instead, if your “make” tool uses other options you could add it to the XX_XX_XX_MAKE_FLAGS in tools_def.txt.
-d, --debug [#]
Enable debug messages at specified level. It is used by Tool itself.
-q, --quiet
Disable all messages except FATAL ERRORS.
-v, --verbose
Enable verbose output with informational messages printed.
-D, --define MACROS
Macro: "Name [= Value]".
-y, --report-file REPORTFILE
Create/overwrite the report to the specified filename.
-Y, --report-type REPORTTYPE
Flags that control the type of build report to generate.  Must be one of: [PCD, LIBRARY, FLASH, DEPEX, BUILD_FLAGS, FIXED_ADDRESS, EXECUTION_ORDER].  To specify more than one flag, repeat this option on the command line and the default flag set is [PCD, LIBRARY, FLASH, DEPEX, BUILD_FLAGS, FIXED_ADDRESS]
-F FLAG, --flag=FLAG
Specify the specific option to parse EDK UNI file. Must be one of: [-c, -s]. -c is for EDK framework UNI file, and -s is for EDK UEFI UNI file. This option can also be specified by setting *_*_*_BUILD_FLAGS in [BuildOptions] section of platform DSC. If they are both specified, this value will override the setting in [BuildOptions] section of platform DSC.
--version
Show program copyright and version number then exit.
-h, --help
Print the copyright, version and usage of this program then exit.
Target
If no target is given, then default target is ALL.
ALL           Build everything for either the platform or module.
GenC         Auto-generate all C files for either the platform or module.
GenMake     Generate the Makefiles – if auto-generated files are missing,
                    then auto-generate all C files first for either the platform or module.
Fds            Create the FD Image files.
Libraries      Build all EDK Libraries and EDK II Library Instances which are specified.
Modules       Build all EDK components and EDK II modules which are specified.
Clean         Remove intermediate files generated by the NMAKE command (leaving
                    the auto-generated C format, FD image files, PE32 output files, PCH 
                    files and LIB files).
CleanAll      Remove all intermediate, auto-generated, FV and FD image files – 
                   state of the tree should be exactly as if a fresh checkout or install has 
                   occurred.
CleanLib     Remove intermediate files generated by the NMAKE command AND LIB 
                   files (leaving the auto-generated, FV and FD image files, PE32 output 
                   files and PCH files)
run           Run platform (for emulator platform only)
Status codes returned
0	The action was completed as requested.	
Nonzero	The action failed.	

Examples
Assume that $(WORKSPACE) is C:\MyWorkspace
Build platform: Nt32Pkg.dsc
Specify the platform description file on the command line.
C:\MyWorkspace>build -p Nt32Pkg\Nt32Pkg.dsc –a IA32
Build the platform in the current working directory if it contains a platform description file.
C:\MyWorkspace\Nt32Pkg>build –a IA32
Build the active platform specified in the target.txt file.
C:\ MyWorkspace>build –a Ia32

Build Module: HelloWorld.inf
Specify the platform and Module on the command line.
C:\MyWorkspace>build -p Nt32Pkg\Nt32Pkg.dsc –a IA32 \
 –m MdeModulePkg/Application/HelloWorld/HelloWorld.inf
Specify the Module on the command line and use the active platform specified in the target.txt file.
C:\MyWorkspace>build –a IA32 \
–m MdeModulePkg/Application/HelloWorld/HelloWorld.inf
Build the module in the current working directory if it contains a module description file and specify the platform on the command line.
C:\ MyWorkspace\MdeModulePkg\Application\HelloWorld>build –a Ia32 \
–p Nt32Pkg\Nt32Pkg.dsc
Build the module in the current working directory and use the active platform specified in the target.txt file.
C:\ MyWorkspace\MdeModulePkg\Application\HelloWorld>build –a Ia32 
Bugs 
No known issues.
Report bugs to edk2-buildtools-devel@lists.sourceforge.net
Files 
target.txt, tools_def.txt, platform.dsc, flashmap.fdf, package.dec and module.inf.
See also
GenFds.exe
License
Copyright (c) 1999 - 2011, Intel Corporation. All rights reserved.

This program and the accompanying materials are licensed and made available under the terms and
conditions of the BSD License which accompanies this distribution.  The full text of the license may be
found at:
http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES
OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.