Previous Next

dirs File

You can instruct the Build utility to recursively build an entire source tree by using the dirs file.

The dirs file resides in a directory that contains subdirectories (that is, at the root of a source code tree or subtree). Each subdirectory can be a source directory or another source tree. A dirs file should exist at the root of each source code subtree, and a sources file should exist in each "leaf" directory (that is, the directories that contain actual source code).

You should define the following macros in your dirs file:

DIRS This macro contains a list of subdirectories that the Build utility will build every time it runs.
OPTIONAL_DIRS This macro contains a list of subdirectories that the Build utility will build only if specified on the build.exe command line.

Entries in these lists must be separated by spaces or tabs. Each subdirectory name is relative to the directory containing the dirs file.

When you build a product, all subdirectories listed as DIRS arguments are scanned. Subdirectories listed as OPTIONAL_DIRS arguments are scanned only if they are specifically listed as Build utility command arguments, or if they are assigned to the BUILD_OPTIONS environment variable.

If you follow a distinct pattern in naming your directories, it is trivial to use dirs files to build multiple versions of a product. List the current version in the DIRS macro, and the new or earlier versions in the OPTIONAL_DIRS macro. After you set this up, your build machine will be able to build whichever version you request..

Example

DIRS=dir1 dir2 dir3
OPTIONAL_DIRS=dir4 dir5

The <currentdir>\dir1, <currentdir>\dir2, and <currentdir>\dir3 directories will be built in this order every time. The <currentdir>\dir4 and <currentdir>\dir5 directories will only be built if you so specify on the Build utility command line or by using the BUILD_OPTIONS environment variable.

The Build utility supports a "not" switch (~) that removes a directory from the default build. Using the preceding example,

build -cZ ~dir1 ~dir3 dir4

would build only dir2 and dir4.

An asterisk (*) as a parameter means that the Build utility should build all optional source directories.

DDK Installation and dirs Files

Each time you reinstall or partially uninstall the DDK, new dirs files are created dynamically and existing dirs files are deleted. If you need to create dirs files for additional subdirectories, run the Makedirs utility (included with the DDK), specifying the drive and starting path. For example:

makedirs d:\winddk\mydriver

The example creates dirs files in mydriver and any other parent directories subordinate to it.