Dirs Files
Dirs files identify directories that contain source-code files to be included in the build process. When Build.exe finds a Dirs file in the folder in which it is run, it traverses the subdirectories referenced in the Dirs file to build the source code in these subdirectories. Among other things, this mechanism enables you to update parts of a run-time image selectively. If you make changes to the source code in Subprojectl, you can rebuild this subproject selectively by running Build.exe in the Subprojectl directory. You can also exclude directories in the source code tree from the build process by removing the corresponding directory references from the Dirs file, or by using conditional statements.
Dirs files are text files with a straightforward content structure. You can use the DIRS, DIRS_CE, or OPTIONAL_DIRS keyword, and then specify the list of subdirectories on a single line, or on multiple lines if you terminate each line with a backslash to continue on the next line. Directories referenced by using the DIRS keyword are always included in the build process. If you use the DIRS_CE keyword instead, Build.exe only builds the source code if the source code is written specifically for a Windows Embedded CE run-time image. The OPTIONAL_DIRS keyword designates optional directories. Keep in mind, however, that Dirs files can contain only one DIRS directive. Build.exe processes the directories in the order they are listed, so be sure to list prerequisites first. It is also possible to use the wildcard '*' to include all directories.
The following listing, taken from default Windows Embedded CE components, illustrates how to include source code directories in the build process by using Dirs files.
# C:WINCE600PLATFORMDEVICEEMULATORSRCDirs
# ---------------------------------------------------
DIRS=common
drivers
apps
kitl
oal
bootloader
# C:WINCE600PLATFORMH4SAMPLESRCDRIVERSDirs
# ---------------------------------------------------
DIRS=
# @CESYSGEN IF CE_MODULES_DEVICE
buses
dma
triton
# @CESYSGEN IF CE_MODULES_KEYBD
keypad
# @CESYSGEN ENDIF CE_MODULES_KEYBD
# @CESYSGEN IF CE_MODULES_WAVEAPI
wavedev
# @CESYSGEN ENDIF CE_MODULES_WAVEAPI
# @CESYSGEN IF CE_MODULES_POINTER
touch
tpagent
# @CESYSGEN ENDIF CE_MODULES_POINTER
# @CESYSGEN IF CE_MODULES_FSDMGR
nandflsh
# @CESYSGEN ENDIF CE_MODULES_FSDMGR
# @CESYSGEN IF CE_MODULES_SDBUS
sdhc
# @CESYSGEN ENDIF CE_MODULES_SDBUS
# @CESYSGEN IF CE_MODULES_DISPLAY
backlight
# @CESYSGEN ENDIF CE_MODULES_DISPLAY
# @CESYSGEN IF CE_MODULES_USBFN
usbd
# @CESYSGEN ENDIF CE_MODULES_USBFN
# @CESYSGEN ENDIF CE_MODULES_DEVICE
# @CESYSGEN IF CE_MODULES_DISPLAY
display
# @CESYSGEN ENDIF CE_MODULES_DISPLAY
The Solution Explorer in Visual Studio with Platform Builder for Windows Embedded CE 6.0 R2 uses Dirs files to generate a dynamic view of the Windows Embedded CE directory structure in an OS design project. However, you should not add or remove directories in Solution Explorer, because editing Dirs files in Solution Explorer can lead to a changed build order, which can result in build errors that require a second build to resolve.
Sources Files
If you check the folders and files of a standard OS design, such as C:Wince6OOOSDesignsOSDesignl, you will find that the project includes no Dirs files by default. If you include subprojects for custom components and applications, you will find a Sources file in each subproject's root folder instead. The Sources file provides more detailed information about the source-code files, including build directives, which a Dirs file cannot provide. However, a source-code directory can only contain one Dirs file or one Sources file, not both. That means that a directory with a Sources file cannot contain subdirectories with more code. During the build process, Nmake.exe uses the Sources files to determine what file type to build (.lib, .dll, or .exe), and how to build it. Similar to Dirs files, Sources files expect you to specify declarations in a single line, unless you terminate the line with a backslash to continue the declaration on the next line.
The following listing shows the content of a Sources file in the Device Emulator BSP. By default, you can find this file in the C:Wince600PlatformDeviceEmulator SrcDriversPccard folder.
WINCEOEM=1
TARGETNAME=pcc_smdk2410
TARGETTYPE=DYNLINK
RELEASETYPE=PLATFORM
TARGETLIBS=$(_COMMONSDKROOT)lib$(_CPUINDPATH)coredll.lib
$(_SYSGENOAKROOT)lib$(_CPUINDPATH)ceddk.lib
SOURCELIBS=$(_SYSGENOAKROOT)lib$(_CPUINDPATH)pcc_com.lib
DEFFILE=pcc_smdk2410.def
DLLENTRY=_DllEntryCRTStartup
INCLUDES=$(_PUBLICROOT)commonoakdriverspccardcommon;$(INCLUDES)