OPTIONAL_DIRS
The OPTIONAL_DIRS macro is used to specify a list of one or more subdirectories that the Build utility will build only if the subdirectory is specified by one of the following:
The Directories command-line parameter of the Build utility
The -DirInclude command-line parameter of the Build utility
Note The -DirInclude command-line parameter is supported in the Windows Driver Kit for Windows Vista and later versions of Windows.
The BUILD_OPTIONS environment variable.
For more information about the Directories and -DirInclude command-line parameters, see Build Utility Command-Line Parameters.
The OPTIONAL_DIRS macro is only used within the Dirs file. Subdirectory names in the list specified by the OPTIONAL_DIRS macro must be separated by spaces or tabs. Each subdirectory name is relative to the directory that contains the Dirs file.
Subdirectories can be built based on the build platform architecture. For example:
OPTIONAL_DIRS =\
dir1{i386,ia64,amd64} \
dir2{i386}
The previous settings will cause dir1 to be built for all three common architectures, while dir2 will only be built under a WDK x86 build environment. If the WDK build environment is ia64 or amd64, only dir1 will be built.
Subdirectories can also be built based on Type by using the following keywords:
OPTIONAL_DIRS =\
dir1{Test} \
dir2{Tool} \
dir3{Product}
The previous settings will be respected by the DirInclude command-line parameter of the Build utility. For example:
will build only those subdirectories marked by the Test or Tool keywords.
Example
The following example shows a typical OPTIONAL_DIRS macro setting:
OPTIONAL_DIRS =\
directoryA \
directoryB \
directoryC
In this example, each of the specified directories will be built only if you specify them on either the Build utility command-line or within the BUILD_OPTIONS environment variable.
See Also
Build Utility Command-Line Parameters
Send comments about this topic to Microsoft
Build date: 5/3/2011