Dirs File

A dirs file is a text file that specifies the subdirectories that contain source code to be built.

Note The directory and file names used in the code examples in this section are samples that demonstrate the way to set up a dirs file. Choose different names for any dirs files and directories that you create.

The following code example shows the placement of dirs files in a project named MyProj.

\Public
  \MyProj
    Dirs
    \Proj1
      Dirs
      \App1
      \App2
    \Proj2
    . . .

In the preceding code example, the dirs file in the MyProj directory directs Build.exe to build the code in the Proj1 and Proj2 directories. The following code example shows how to specify the dirs file.

DIRS= \
  Proj1    \
  Proj2

Each subdirectory specified in a dirs file can contain additional subdirectories.

In the preceding code example, the Proj1 subdirectory contains two subdirectories, App1 and App2. To direct Build.exe to build the code in the App1 and App2 subdirectories, add a dirs file to the Proj1 directory.

The following code example shows how to specify the dirs file in MyProj\Proj1.

DIRS= \
  App1  \
  App2

You can use the DIRS_CE keyword instead of the DIRS keyword in a dirs file. Build.exe always builds the source code in the directories that DIRS specifies. However, Build.exe builds the source code in the directories that DIRS_CE specifies only if the source code is written for a Windows CE-based platform.

Build.exe builds source code in the directory in which it is run and in any subdirectories named in the dirs file.

By running Build.exe in a selected subdirectory, you can selectively update parts of your platform without rebuilding all of it. For example, if you make changes in the source code in the Proj2 directory, and then change to Proj2 and enter build on the command line of the Proj2 directory, Build.exe rebuilds only the code in the Proj2 directory.

You can use a dirs file to exclude directories in the source code tree from the build process. For example, to exclude the Proj2 directory from the build, modify the MyProj\Dirs file so that it lists only the Proj1 subdirectory.

Use the OPTIONAL_DIRS keyword to designate optional directories.

To build the source code in an optional directory, specify the directory in the BUILD_OPTIONS environment variable or include the directory as an argument to Build.exe.

See Also

How to Create a Device Driver

 Last updated on Friday, October 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.