sources文件内宏含义的理解和疑问

英文来自MSDN。中文是我的理解。

DEFFILE: This macro definition specifies the name for the module-definition file (.def), known as an export file, for TARGETNAME 指明了定义导出函数的文件的名字。

WINCETARGETFILE0: This macro definition specifies nonstandard target files that Build.exe should build before Build.exe builds the source code in the current directory. If this macro definition is present, custom rules that you define in Makefile.inc, which is an optional file that can exist in the same directory as a sources file, are also applied. 指明了需要先编译的文件。如果用了这个宏,在Makefile.inc中将指明该文件的编译方法,MSDN中给的例子说明了这一点。但是在D:/WINCE600/PUBLIC/COMMON/OAK/DRIVERS/USB/CLASS/USBSER的source文件中,有这个宏定义,“WINCETARGETFILE0=$(_COMMONOAKROOT)/lib/$(_CPUINDPATH)/$(TARGETDEFNAME).def”,却没有对应的makefile.inc;当然,这个def也不能算是需要先编译的文件,有点糊涂。或许这句在这个USB串口驱动中非必要。

SOURCELIBS: This macro definition specifies library (.lib) files to be linked with the module specified in TARGETNAME. This macro definition is typically only used when you are linking to a static library. It is linked to the module when the executable file is built. To link to an export library instead, use the TARGETLIBS macro. 当编译中需要链接static library时,就用此宏。

TARGETLIBS: This macro definition specifies additional library (.lib) files and object (.obj) files that should be linked into the target executable (.exe or .dll) file. This macro definition is typically only used when you are linking to an export library. 当编译中需要链接export library时,就用此宏。

static library指的是包含对象、函数和数据的文件;export library指的是导出一些功能供其他模块使用的文件,两者都是.lib文件。个人认为,前者打开后的内容形如“IsTerminated@CMiniThread@@QAAHXZ ?”,指明了函数实现的位置;后者打开后的内容形如“__imp_USBDeviceAttach USBUnInstallDriver __imp_USBUnInstallDriver COM_Init”,只是将函数接口导出,实际还是指向了dll。但是在采用http://blog.csdn.net/zhaojuncq/archive/2010/07/23/5757376.aspx中提供的方法,用sysgen_capture生成source文件时,文件中有一句“TARGETLIBS=$(_PUBLICROOT)/common/oak/lib/$(_CPUINDPATH)/usbser_lib.lib”。这是一个形如“CreateStatusIn@UsbSerClientDriver@@MAAHPBU_USB_ENDPOINT@@@Z ?”的文件,怎么就给放到targetfiles里了?

OS驱动的文件夹下还有makefile文件,这个文件用来指明编译方法。但在wince中,该文件不需要编辑,所有都指向公用的makefile.def文件。后者涵盖了PB下OS的所有编译方法,其中包含了诸如

!IF EXIST($(MAKEDIR)/makefile.inc)
!  IFDEF WINCETARGETFILES
!    INCLUDE $(MAKEDIR)/makefile.inc
!  ELSE IFDEF WINCETARGETFILE0
!    INCLUDE $(MAKEDIR)/makefile.inc

的语句,说明各子文件夹下的makefile.inc(如果有的话),也在makefile.def的控制下工作。

 

你可能感兴趣的:(File,Module,include,library,makefile,WinCE)