Share via


Makefile.inc File

This is a make file that you can create. It must exist in the same subdirectory as the Sources file. It is typically used to build header files that are required in the subdirectories, or to add driver-specific build requirements.

This make file can be used to generate any custom targets that are required by a module.

You can add the NTTARGETFILE0, NTTARGETFILE1, NTTARGETFILE2, or NTTARGETFILES macros to your Sources file to force Makefile.def to include Makefile.inc immediately after it specifies the top level targets (all, clean, and loc) and their dependencies.

For example, the following command in a Sources file makes sure that Makefile.inc is included on Pass 0, and that the name of the target to build is Toaster.bmf.

NTTARGETFILE0 = $(OBJ_PATH)\$(O)\toaster.bmf

The following Makefile.inc file is from the Toaster sample in the src\general\toaster\wdm\featured1 directory of the Windows Driver Kit (WDK):

$(OBJ_PATH)\$(O)\toaster.bmf : toaster.mof
    mofcomp -B:$@ toaster.mof
    wmimofck $@   

The name of the target is Toaster.bmf (the relative path is included with the target name). The name of the dependent file that is built is Toaster.mof. The first command runs the MOF compiler (Mofcomp.exe) on the MOF file for the toaster sample, and the second command validates the binary .bmf file by using the WMI checker (Wmimofck.exe). The $@ symbols in the command argument represent the target that is being built, which is $(OBJ_PATH)\$(O)\toaster.bmf. When you specify $@, you do not have to change the build rules if you decide later to change the output file name.

For information about the commands that you can use in a Makefile, see Contents of a Makefile on MSDN.

 

 

Send comments about this topic to Microsoft

Build date: 5/3/2011