First, let's talk about the sources file, such
!if 0Copyright (c) Microsoft Corporation. All rights reserved.!endif!if 0Use of this sample source code is subject to the terms of the Microsoftlicense agreement under which you licensed this sample source code. Ifyou did not accept the terms of the license agreement, you are notauthorized to use this sample source code. For the terms of the license,please see the license agreement between you and Microsoft or, if applicable,see the LICENSE.RTF on your install media or the root of your tools installation.THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES OR INDEMNITIES.!endif!if 0Use of this source code is subject to the terms of the Microsoft end-userlicense agreement (EULA) under which you licensed this SOFTWARE PRODUCT.If you did not accept the terms of the EULA, you are not authorized to usethis source code. For a copy of the EULA, please see the LICENSE.RTF on yourinstall media.!endifSYNCHRONIZE_DRAIN=1TARGETNAME=NULLCAMTARGETTYPE=LIBRARYTARGETDEFNAME=$(TARGETNAME)DEFFILE=$(TARGETDEFNAME).defWINCETARGETFILE0=$(_RELEASELIBDIR)\$(DEFFILE)TARGETLIBS= \$(_COMMONSDKROOT)\lib\$(_CPUINDPATH)\coredll.lib \INCLUDES=$(INCLUDES)\$(_PUBLICROOT)\directx\sdk\incSOURCES= \ CameraDevice.cpp \ CameraDriver.cpp \ PinDevice.cpp \ PinDriver.cpp \ PinHardware.cpp
In general, the sources file contains some user macro definitions which will be used by makefile and nmake to compile the project's source code. We know that the nmake program needs to use makefile to know how to compile the source code. If you need to write your own makefile for each directory and project, although the flexibility is high, the workload is huge. Is there a simple way to use makefile? A relatively simple method is to extract some parts of makefile that are common to all projects. for a specific project, you only need to add different content, this simplifies the use of makefile. The sources file was born for this purpose.
Shows the relationship between makefile and sources.In the directory to be constructed, if the directory contains the sources file, there must be another MAKEFILE file in the same directory. Generally, this makefile value contains a line of content, as shown below:
!if 0Copyright (c) Microsoft Corporation. All rights reserved.!endif!if 0Use of this sample source code is subject to the terms of the Microsoftlicense agreement under which you licensed this sample source code. Ifyou did not accept the terms of the license agreement, you are notauthorized to use this sample source code. For the terms of the license,please see the license agreement between you and Microsoft or, if applicable,see the LICENSE.RTF on your install media or the root of your tools installation.THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES OR INDEMNITIES.!endif## DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source# file to this component. This file merely indirects to the real make file# that is shared by all the components of Windows CE#!INCLUDE $(_MAKEENVROOT)\makefile.def
_ Makeenvroot is an environment variable set by wince. bat. It usually points to the directory where wince. bat is located, that is, under % _ publicroot % \ common \ oak \ Misc. The makefile. Def file contains almost 3000 rows. It is a public makefile template shared by all Windows CE projects. Many macros are defined in makefile. Def to define specific usage and derivation rules. At the same time, in makefile. Def, there is such a statement (200th rows in wince5.0 ):
!INCLUDE.\sources.
In this way, makefile. Def contains the local sources file. Therefore, when the build system calls nmake in a directory, nmake will use makefile in the directory, and then makefile will put makefile. def to local, makefile. def also includes the local sources file. In this way, the macros defined in the local sources File work together with the Macros in makefile. Def to form a complete, sadly nmake makefile.