Dirs files are the direction signs for building your platform. They show the way for build.exe to find your code to build it. Dirs files are probably the best named files in the build system because what they do is tell build.exe which sub directories to descend into to build.   If you have looked around at the files in your platform, then you probably are familiar with the basic form of a dirs file, here is an example:
DIRS=\
                Serial \
                USB \
                Wave
This dirs file tells build to descend into three folders; Serial, USB and Wave.  Notice that like macro definition (#define) the dirs file uses line continuation using ‘\’ followed by a newline. So build.exe sees this as “DIRS=Serial USB Wave” and you could just as easily write it in the dirs file that way. I prefer separate lines because it makes it easier to edit the file later.
DIRS can also be set to build all sub directories using ‘*’; example
DIRS=*
 
I could stop here, but there is another powerful feature of dirs files, the OPTIONAL_DIRS setting. OPTIONAL_DIRS lets you have directories that are built sometimes and other times they are not built. The OPTIONAL_DIRS are list in the dirs files similar to the DIRS setting:
OPTIONAL_DIRS=\
                PXA \
                SMI
This tells build.exe that it may need to build the directories PXA and/or SMI. Build.exe will then build the folders if it has one of them listed in the environment variable BUILD_OPTIONS. So if we want to build SMI, we can add the following to <platform>.bat:
Set BUILD_OPTIONS=%BUILD_OPTIONS% SMI
One key rule for Dirs files is that they cannot coexist in a directory that contains a sources files.
 
 
 
Copyright © 2008 – Bruce Eitman
All Rights Reserved