天天看点

makefile和source文件的编写

在xp下使用window ddk里面的build对ndis程序进行编译得到ndis驱动程序时,在ndis程序包里面需要有  makefile文件和source文件,如果在ndis程序包里面还有子目录的话,那还需要有dirs文件 source: TARGETNAME=passthru // 生成的驱动程序名为passthru.sys

TARGETPATH=obj  //生成的驱动程序放在obj目录下

TARGETTYPE=DRIVER // 生成驱动程序 C_DEFINES=$(C_DEFINES) -DNDIS_MINIPORT_DRIVER -DNDIS_WDM=1 C_DEFINES=$(C_DEFINES) -DNDIS51_MINIPORT=1

C_DEFINES=$(C_DEFINES) -DNDIS51=1 PRECOMPILED_INCLUDE=precomp.h

PRECOMPILED_PCH=precomp.pch

PRECOMPILED_OBJ=precomp.obj TARGETLIBS=$(DDK_LIB_PATH)/ndis.lib // 可选项,表示除了ddk lib外其他的库文件 USE_MAPSYM=1 INCLUDES=  // 可选项,表示除了ddk inc外其他的头文件 SOURCES=/  // 驱动程序的源文件,也就是要编译的源文件

    miniport.c /

    passthru.c /

    passthru.rc /

    protocol.c   makefile 所有的驱动程序的makefile文件都是一样的 #

# 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 NT

#

!INCLUDE $(NTMAKEENV)/makefile.def   dirs文件 DIRS= /

     driver /

     notifyob/      .......

继续阅读