Share via


SOURCES (Compact 2013)

3/26/2014

This macro definition contains a list of files that are processed during the build process to become the contents of a library (.lib) file or dynamic-link library (.dll) file.

The list of files consists of assembly files and source files with extensions. These include the following file types: .cxx, .cpp, .c, .asm, .s, .src, .rc, .obj, .ire, .res, .odl, .tlb, .i, .cs, and .resx.

Header files cannot be included in the SOURCES macro definition.

Remarks

The file list defined in the SOURCES macro is used by build.exe to generate a list of build targets, and to identify build targets that are outdated. For example, if you specify MyFile.cpp in this file list, build.exe will add MyFile.obj to the list of build targets.

When the build process starts, build.exe determines whether MyFile.cpp or any files that MyFile.cpp depends on, for example header files, are newer than MyFile.obj. If the file or files are newer, build.exe deletes MyFile.obj to force it to be rebuilt.

In most cases, the values specified in the SOURCES macro are not used directly by Nmake.exe. Instead, Nmake.exe uses the list of build targets and applies inference rules to determine how the build target should be generated.

As a result, Nmake.exe can only find source code in specific locations. These locations include:

  • the directory that contains the Sources file
  • its parent directory
  • a subdirectory of $(_TGTCPUFAMILY) that contains the Sources file
  • a subdirectory of the parent directory of $(_TGTCPUFAMILY)

As another result, multiple Source files might match the inference rules in Nmake.exe that are used for building a specific build target. For example, MyFile.obj could be created by compiling any one of the following files: MyFile.c, MyFile.cpp, MyFile.cxx, MyFile.s, MyFile.src, MyFile.asm. Nmake.exe will search for a file that matches these filenames in the directory that contains the Sources file, in the parent directory, in the subdirectory of $(_TGTCPUFAMILY), and in subdirectories of the parent directory of $(_TGTCPUFAMILY). It will compile the first file that it finds which matches an inference rule. The order in which Nmake.exe checks its inference rules is not defined and is subject to change. Therefore, make sure that you avoid putting multiple files with the same base name but with different file extensions into the same part of your %_WINCEROOT% tree project.

See Also

Concepts

Sources File