Sources File (Compact 2013)
A sources file is a text file that sets the macro definitions for the source code in a subproject's subdirectory. Build.exe uses these macro definitions to determine how to compile and link the source code of a subproject.
After Build.exe parses a sources file, Nmake.exe incorporates the sources file into the common makefile file, Makefile.def. Build.exe follows only the macro assignments and ignores other lines, such as conditional Nmake.exe statements. Conditional statements in sources files are not supported.
If you run Build.exe on a development computer that has multiple processors and your dirs and sources files have dependencies, use the <BuildPassName>_PRODUCES and <BuildPassName>_CONSUMES macros. Otherwise you might encounter issues.
When a user project is added to the OS tree as a sources project, the dependency tree for the new project must include a common sources file that is named Sources.cmn. Any macro variables in a common sources file apply to all sources files in that directory and its associated subdirectories.
During compilation, user projects become full, unfiltered headers, and are built in separate %_WINCEROOT%\Public dependency trees. Therefore, sources files for user projects must also include macros that define root directories for the projects.
|You must include these additional macro definitions in the Sources.cmn file.|
The following code example shows how to include macros that define root directories for projects.
_COMMONPUBROOT=$(_PUBLICROOT)\common __PROJROOT = $(_PUBLICROOT)\$(WINCEPROJ)
In Windows Embedded Compact 2013, the macro $(PROJECTROOT)\cesysgen is no longer valid in a sources file. Instead, to access sysgen output from a sources file, use $(SG_OUTPUT_ROOT), or one of the following macros, which have been moved up from sysgen makefiles to $\public\common\oak\misc\sources.default.
SG_OUTPUT_SDKLIB=$(SG_OUTPUT_ROOT)\sdk\lib\$(_CPUINDPATH) SG_OUTPUT_OAKLIB=$(SG_OUTPUT_ROOT)\oak\lib\$(_CPUINDPATH) SG_OUTPUT_OAKTGT=$(SG_OUTPUT_ROOT)\oak\target\$(_CPUINDPATH) SG_OUTPUT_OAKTGTMGD=$(SG_OUTPUT_ROOT)\oak\target\managed SG_OUTPUT_SDKTGTMGD=$(SG_OUTPUT_ROOT)\sdk\target\managed SG_OUTPUT_SDK_MANAGED=$(SG_OUTPUT_ROOT)\sdk\target\managed\$(WINCEDEBUG) SG_OUTPUT_OAK_MANAGED=$(SG_OUTPUT_ROOT)\oak\target\managed\$(WINCEDEBUG) _SYSGENSDKROOT=$(SG_OUTPUT_ROOT)\sdk _SYSGENOAKROOT=$(SG_OUTPUT_ROOT)\oak _SYSGENDDKROOT=$(SG_OUTPUT_ROOT)\ddk
Having these macros available in sources.default means that they are now available to all sources projects when Build.exe runs, instead of being available only during the sysgen phase to sysgen makefiles.
The following code example shows the contents of %_WINCEROOT%\Public\Common\Sources.cmn.
|The directory and file names that are used in the code examples in this section are samples that demonstrate the way to set up a sources file. You would choose different names for sources files and directories that you create.|
The following macro definitions in this code example apply to every sources file in the Public\Common directory.
WINCEOEM=1 WINCEPROJ=COMMON WINCETREE=winceos RELEASETYPE=OAK _COMMONPUBROOT=$(_PUBLICROOT)\common __PROJROOT = $(_PUBLICROOT)\$(WINCEPROJ) WARNISERROR=1 _ISVINCPATH=$(_WINCEROOT)\public\common\sdk\inc; _OEMINCPATH=$(_WINCEROOT)\public\common\oak\inc;$(_WINCEROOT)\public\common\sdk\inc;$(_WINCEROOT)\public\common\ddk\inc;
The following code example shows the placement of the common sources file, Sources.cmn, and other sources files in a sample directory.
\Public \MyProj Sources.cmn Dirs \Proj2 Dirs Makefile Sources Proj2.cpp Proj2.h ...
Sources files are not displayed in Solution Explorer in Visual Studio, but you can edit them through the Sources Editor. To open a sources file in the Sources Editor, in Solution Explorer, right-click the subproject's icon and select Properties.
The Platform Builder sample code includes a common sources file in each of the following directories: