Книга: Microsoft Windows Embedded CE 6.0 Exam Preparation Kit

Sources Files

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)
SOURCES=
Init.cpp
PDSocket.cpp
PcmSock.cpp
PcmWin.cpp
#xref VIGUID {549CAC8D_8AF0_4789_9ACF_2BB92 599470D}
#xref VSGUID {0601CE65_BF4D_453A_966B_E20250AD2E8E}

You can define the following directives in a Sources file:

TARGETNAME This is the name of the target file, without file name extension.

TARGETTYPE Defines the type of file to be built, as follows:

DYNLINK A dynamic-link library (.dll).

LIBRARY A static-link library (.lib).

PROGRAM An executable file (.exe).

NOTARGET Build no file.

RELEASETYPE Specifies the directory where Nmake.exe places the target file, as follows:

 ? PLATFORM PLATFORM<BSP Name><Target>.

 ? OAK, SDK, DDK %_PROJECTROOT%Oak<Target>.

 ? LOCAL The current directory.

 ? CUSTOM A directory specified in TARGETPATH.

 ? MANAGED %_PROJECTROOT%Oak<Target>Managed.

TARGETPATH Defines the path for RELEASETYPE=CUSTOM.

SOURCELIBS Specifies libraries to be linked with the target file specified in TARGETNAME to create the final binary output. This option is typically used for creating a .lib file but not .dll or .exe files.

TARGETLIBS Specifies additional libraries and object files to link to the final binary output, typically used for creating .dll or .exe files but not for .lib files.

INCLUDES Lists additional directories to search for include files.

SOURCES Defines the source files to be used for this particular component.

ADEFINES Specifies parameters for the assembler.

CDEFINES Specifies parameters for the compiler, which can be used as additional DEFINE statements for use in IFDEF statements.

LDEFINES Sets linker definitions.

RDEFINES Specifies DEFINE statements for the resource compiler.

DLLENTRY Defines the entry point for a DLL.

DEFFILE Defines the .def file which contains a DLL's exported symbols.

EXEENTRY Sets the entry point of an executable file.

SKIPBUILD Marks the build of the target as successful without an actual build of the target.

WINCETARGETFILE0 Specifies nonstandard files that should be built before building the current directory.

WINCETARGETFILES This macro definition specifies nonstandard target files that Build.exe should build after Build.exe links all other targets in the current directory.

WINCE_OVERRIDE_CFLAGS Defines compiler flags to override default settings.

WINCECPU Specifies that the code requires a certain CPU type and should only be built for that particular CPU.

NOTE

Performing specific actions before and after the build

In addition to the standard directives, Windows Embedded CE Sources files support the direc­tives PRELINK_PASS_CMD and POSTLINK_PASS_CMD. You can use these directives to perform custom actions based on command-line tools or batch files before and after the build process, such as PRELINK_PASS_CMD = pre_action.bat and POSTLINK_PASS_CMD = post_action.bat. This is useful, for example, if you want to copy additional files to the release directory when developing a custom application.

Оглавление книги

Оглавление статьи/книги

Генерация: 1.200. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз