Specifying the Location of Created Files
The location of the files that the Build utility produces depends on the value of certain environment variables and Sources macros. In most cases, you will want to accept the default locations determined by the Windows Driver Kit (WDK) build environments.
Default Paths and File Names in the WDK
The Build utility creates three log files: the command log, the warning log, and the error log. (For information about the contents of these files, see Using Log Files.) These log files are put in the current directory and named as follows:
buildType_Version_Cpu.log
buildType_Version_Cpu.wrn
buildType_Version_Cpu.err
When the Build utility creates object files or library files, it puts them in a subdirectory of the root directory where the binaries are built. This subdirectory is named as follows:
objType_Version_Cpu\Cpu
Note This subdirectory is used only for libraries that the Build utility creates. When you link to existing libraries, you have to specify their locations by using environment variables such as SDK_LIB_PATH and DDK_LIB_PATH. For a full list of variables, see Build Utility Environment Variables.
These directory and file names include the following elements:
Type
Indicates the build type: fre in the free build environment or chk in the checked build environment.Version
Indicates the version of Windows that the build environment supports: wxp for Windows XP, wnet for Windows Server 2003, wlh for Windows Vista, or win7 for Windows 7.Cpu
Indicates the processor. For an x86 processor, Cpu is x86 when used in the log file name or in the first part of the object file directory, and it is i386 when used in the second part of the object file directory. For an Itanium-based processor, Cpu is ia64. For an x64-based processor, Cpu is amd64.
For example, if you build x86 binaries for Windows XP in the free build environment, the object files are put under the build directory in the subdirectory objfre_wxp_x86\i386. The three build logs are put in the current directory and named buildfre_wxp_x86.log, buildfre_wxp_x86.wrn, and buildfre_wxp_x86.err.
Because output files are put in subdirectories that are specific to the build environment, you can keep your source files in a single directory tree and maintain free and checked build products for a variety of platforms under this one tree.
Controlling the Location and Names of Log Files
The -j command-line switch controls the name of log files. The file name extensions .log, .wrn, and .err are appended to the specified name.
If the -j switch is not used, and the environment variable BUILD_ALT_DIR is not set, the three log files are named as follows:
build.log
build.wrn
build.err
If the -j switch is not used, and the BUILD_ALT_DIR is set equal to the value String, the log files are named as follows:
buildString.log
buildString.wrn
buildString.err
If you use the -j switch to specify a file name, you can also specify the complete directory path. Alternatively, you can use the -jpath switch to specify the directory path. If you do not use either of these methods, the log files are put in the current directory.
Controlling the Location of Build Products
When the Build utility creates object files, it puts them in a subdirectory of the root directory where the binaries are built.
As long as the TARGETPATH macro appears in your Sources file, object files are placed in a directory that is determined in the following manner:
If neither BUILD_ALT_DIR nor CHECKED_ALT_DIR is defined, the path used is ***obj\***Cpu.
If BUILD_ALT_DIR is not defined, but CHECKED_ALT_DIR is defined, the path used is ***objd\***Cpu.
If BUILD_ALT_DIR is defined and equal to the value String, the path used is objString***\***Cpu.
In each of these cases, Cpu represents the processor. For an x86 processor, Cpu is i386; for an Itanium-based processor, Cpu is ia64; for an x64-based processor, Cpu is amd64.
If the TARGETPATH macro has the value obj, executable files and symbol files are put in the same directory as the object files.
If the TARGETPATH macro has the value MyPath, object files are saved to the path that begins with obj as described earlier. However, executable files and symbol files are saved to a different directory. This directory path is identical to that used for the object files, except that the string obj will be replaced with MyPath.
Note It is recommended that you always set TARGETPATH equal to obj. The sum of the lengths of BUILD_ALT_DIR and TARGETPATH must not exceed MAX_PATH (about 256 characters).
If you are creating link libraries (.lib and .exp files), and the TARGETPATHLIB macro does not appear in your Sources file, these libraries are put in the same directory as your object files. If TARGETPATHLIB does appear and is set equal to the string MyLibPath, library files are put in a path identical to that of the object files, except that the string obj is replaced with MyLibPath.
In the Windows Driver Kit (WDK), the BUILD_ALT_DIR environment variable is set to a fixed value in each build environment.
Send comments about this topic to Microsoft
Build date: 5/3/2011