Sources File (Windows CE 5.0)

A sources file is a text file that sets the macro definitions for the source code in a subdirectory. Build.exe uses these macro definitions to determine how to compile and link the source code.

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 workstation that has multiple processors and your dirs and sources files have dependencies, use the SYNCHRONIZE_DRAIN and SYNCHRONIZE_BLOCK macros. Otherwise you might encounter issues.

When an 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 called 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 get 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.

Note   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)

The Platform Builder sample code includes a common sources file in each of the following directories:

  • %_WINCEROOT%\Public\Common
  • %_WINCEROOT%\Platform\Cepc

The following code example shows the contents of %_WINCEROOT%\Public\Common\Sources.cmn.

Note   The directory and file names 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
    . . .

See Also

Source Code Configuration Files | Dirs File | Build Tool | Windows CE Build Environment Tool | Nmake Tool

Last updated on Thursday, February 02, 2006

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.