Build.exe is the tool tool that builds a source code tree.  Build.exe traverses a source tree by reading DIRS and SOURCES files to find the code that needs to be built.

DIRS files indicate the sub-folders that build.exe should move down into to build. Note that the DIRS file can only be used to indicate direct sub-folders, that means it cannot be used to descend multiple sub-folders or to move up in the tree.

SOURCES files are the leaves on the tree.  When build.exe finds a SOURCES file, it stops and builds the target in the folder based on the rules in the SOURCES file.  A SOURCES file sets environment variables that are then passed to nmake.

Any folder can have a DIRS or a SOURCES file, but it cannot have both.  Build.exe will generate an error if it finds both in one folder.  This rule can cause trouble when porting code from another build system.  In that case, you may need to get creative to change the build tree to fit the needs of build.exe.

When you run build.exe, it will check the current folder for a DIRS or SOURCES file.  If it finds neither, it will stop with an error.  But if it finds a DIRS file, it will start descending through the tree looking for a SOURCES file to build.  If it finds a SOURCES file build.exe will read go back up the tree looking for the top most folder that contains a DIRS file.  When it finds the DIRS file, it will look for a SOURCES.CMN file and read in the environment variables in it before reading in the environment variables in the SOURCES file in the current folder.

Once build.exe has processes the SOURCES file, it will start nmake and tell nmake to use the makefile in the current folder.  Typically the makefile will include %_WINCEROOT%\Public\Common\OAK\MISC\Makefile.def which contains the numerous rules needed to build your source code and link to create your target.

Build.exe does have some options.  Many of them are really for expert users so I will leave most of them for you to research when you need to do more.  For day to day use while you are modifying code, you probably only need the -c option.  The -c option will delete the object files prior to building which allows you to force a rebuild of the code.  I use the -c option often when modifying SOURCES file or environment variables because build.exe cannot know that it needs to rebuild when those changes are made.

To use build.exe to speed up your modify, build, test cycle:

  • Run "build" in the lowest level folder that builds the exe or dll that are working on.
  • Run "build -c" in the lowest level folder that effected by your changes to SOURCES or environment variables.  Of course by environment variables here, I mean variables that only affect the code that you are working on.  If you modify an environment variable that effect the sysgen, then you need to do more than run build.

Go to Summary of Building Windows CE

Copyright © 2008 – Bruce Eitman
All Rights Reserved