Export (0) Print
Expand All

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.


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.


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.





The following code example shows the placement of the common sources file, Sources.cmn, and other sources files in a sample directory.


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:

  • %_WINCEROOT%\Public\Common
  • %_WINCEROOT%\Platform\Cepc
© 2014 Microsoft