阅读:1359回复:9
有什么办法用make取代build
请各位大侠指教一下有什么办法定制 build 过程, 或者
干脆用 makefile 取代, 这样在功能控制方面更方便一些。 |
|
沙发#
发布于:2002-02-07 15:48
没有人感兴趣吗? 小生只好自问自答了, 经过一个星期的尝试,
基本能用make建立wdm驱动程序, 现将makefile贴出, 以期抛砖引玉 之效. 这个文件指定了若干测试文件, 没什么干系, 主要花头在 CFLAGS和LNKFLG里面. 我用的是GNU MAKE工具, 路径及相关 程序均为UNIX风格, 诸君宜自改之. # usage: # make -or- make all make checked version # make type=free make free version, no debug information # make clean # make install CC = cl LINKER = link LNKCMD = linker.cmd RM = rm -f INSTALL = cp type = checked INC = -Ic:/ntddk/inc -Ic:/ntddk/inc/ddk/wdm -Ic:/ntddk/inc/ddk -I. LIB = /LIBPATH:. /LIBPATH:c:/ntddk/libchk/i386 TARGET = c:/winnt/system32/drivers # for linker ignored somewhat warnings: # /IGNORE:4001,4037,4039,4044,4065,4070,4078,4087,4089,4198 ifeq ($(type),checked) DEFS = -DDBG=1 -DDEVL=1 CFLAGS = /nologo /c /W3 /Z7 /Zp8 /Gy /Gz /GF /Oxs /Oy- LNKFLG = /map /debug /stack:262144,4096 /merge:_PAGE=PAGE /merge:_TEXT=.text\\ /section:INIT,d /incremental:no /release /nodefaultlib /driver:wdm\\ /align:0x20 /subsystem:native,1.10 /base:0x10000 /entry:DriverEntry@8\\ /nologo /force:multiple /version:1.0 REBASE = else DEFS = -DNDEBUG CFLAGS = /nologo /c /W3 /Zp8 /G6 /Gy /Gz /GF /Oxs LNKFLG = /opt:ref /stack:262144,4096 /merge:_PAGE=PAGE /merge:_TEXT=.text\\ /section:INIT,d /incremental:no /release /nodefaultlib /driver:wdm\\ /align:0x20 /subsystem:native,1.10 /base:0x10000 /entry:DriverEntry@8\\ /nologo /force:multiple /version:1.0 REBASE = rebase -B 0x10000 -X . hello.sys endif OBJS = dispatch.obj fileio.obj hello.obj misc.obj pnp.obj LIBS = wdm.lib ndis.lib usbd.lib vxdwraps.clb all: $(OBJS) $(LINKER) $(LNKFLG) $(LIB) -out:hello.sys $(OBJS) $(LIBS) $(REBASE) clean: $(RM) $(OBJS) hello.sys hello.map hello.pdb install: $(INSTALL) hello.sys $(TARGET) dispatch.obj: dispatch.c $(CC) $(INC) $(DEFS) $(CFLAGS) dispatch.c fileio.obj: fileio.c $(CC) $(INC) $(DEFS) $(CFLAGS) $< hello.obj: hello.c $(CC) $(INC) $(DEFS) $(CFLAGS) $< misc.obj: misc.c $(CC) $(INC) $(DEFS) $(CFLAGS) $< pnp.obj: pnp.c $(CC) $(INC) $(DEFS) $(CFLAGS) $< |
|
板凳#
发布于:2002-02-07 16:47
Sorry. 突然想起忘了一个文件 defines.h. 这些定义原本是build从
命令行传给CL的, 我把他们摘出来单独存成一个文件, **必须在每一个编译文件的最开头处引用!** 这样就可以甩开 那两个叫什么checked和free的指定环境, 在任一DOS窗口均可 编译. #ifndef _DEFINES_H #define _DEFINES_H /* these are system definations. I catched them from win2k ddk * environment - Xuming 2002/2/6 */ #define STD_CALL #define _X86_ 1 #define i386 1 #define CONDITION_HANDLING 1 #define NT_UP 1 #define NT_INST 0 #define WIN32 100 #define _NT1X_ 100 #define WINNT 1 #define _WIN32_WINNT 0x0500 #define WINVER 0x0500 #define _WIN32_IE 0x0501 #define WIN32_LEAN_AND_MEAN 1 #define FPO 0 #define _DLL 1 #include <warning.h> #endif |
|
地板#
发布于:2002-02-08 14:49
为什么不直接用VC来编译呢?
或者把BUILD改名为MAKE,就可以输入MAKE编译了。(哈哈,开玩笑的) |
|
地下室#
发布于:2002-02-08 16:53
没听说可以用VC的IDE编译驱动程序, Programming WDM也只是
介绍了用集成环境调用build的方法. 估计也能够通过设置编译项编译 驱动程序, 不过我没有试过. MAKE有很多优点, 最重要的就是透明度高, 定制容易. |
|
5楼#
发布于:2002-02-08 17:27
VC Ide中当然也能进行Driver的编译了。
使用Build这后,看看Buildxxx.log就知道了。 |
|
|
6楼#
发布于:2002-02-08 17:39
主要是编译和连接选项的设置问题, 和具体什么工具关系不大. 用自己最熟悉为上策.
|
|
7楼#
发布于:2002-02-17 21:10
i love makefile
|
|
|
8楼#
发布于:2002-02-20 01:24
after W2K ddk, DDK itself has the compiler. I dare not to use VC compiler to compile drivers, who can be sure that there is no difference between VC compiler and the compiler of DDK.
|
|
|
9楼#
发布于:2002-02-21 09:30
在哪儿呢,老大?我怎么没找着?
|
|