DDK通过调用build工具进行编译以及链接代码,而build又是通过传递一些编译的参数调用nmake工具进行解析makefile文件(其中,makefile文件中指定了需要编译的文件的依赖关系,指定的过程是有顺序的,要指明先编译哪些文件,后编译哪些文件;不管是build,还是nmake,甚至是VC,它们最终调用的都是cl.exe和link.exe),传参很多,可以自己查询文档;这里边makefile需要列出一系列的依赖关系,从头写makefile会很烦人,大多数情况下我们只需要写一行:
! INCLUDE $(MAKEENVNT) \makefile.def ,想要深入了解去MSDN上看一下,我之后有时间或者遇到这方面的需要的时候再深入看了。
有了自定义的编译依赖关系或者使用默认的makefile之后,得告诉build编译哪些文件,这些文件的路径在哪,这就遇到了source和 dirs文件。source里边记录了需要编译的源文件文件名、包含目录路径、库目录路径等,有了目标才能进行编译是吧?而具体设置自己查询文档,继续说整体流程;多数项目不可能仅仅用了一个文件夹,这就遇到了需要编译的文件放在不同位置,也就有了dirs文件,这个里边描述了需要编译的子目录路径,这样build会依次进入dirs里边写的子目录寻找source进而将所有需要编译的文件都编译,生成需要的静态库*.lib等等。
整体流程说完了,具体说一下:
001:生成静态库的准备:
先设置makefile为默认的那一行,之后编写dirs和source文件
dirs