Inference rules are templates from which NMAKE infers what to do with a description block when no commands are given. Only those extensions defined in a .SUFFIXES list can have inference rules. The extensions .C, .OBJ, .ASM, and .EXE are automatically included in .SUFFIXES.
When NMAKE encounters a description block with no commands, it looks for an inference rule that specifies how to create the target from the dependent files, given the two file extensions. Similarly, if a dependent file does not exist, NMAKE looks for an inference rule that specifies how to create the dependent file from another file with the same base name.
NMAKE applies an inference rule only if the base name of the file it is trying to create matches the base name of a file that already exists.
In effect, inference rules are useful only when there is a one-to-one correspondence between the files with the "from" extension and the files with the "to" extension. You cannot, for example, define an inference rule that inserts a number of modules into a library.
The use of inference rules eliminates the need to put the same commands in several description blocks. For example, you can use inference rules to specify a single ICC command that changes any C source file (with a .C extension) to an object file (with a .OBJ extension).
You define an inference rule by including text of the following form in your description file or in your TOOLS.INI file - see "Special Features".
.fromext.toext: commands :
The elements of the inference rule are:
<fromext>
For example, an inference rule to convert C source files (with the .C extension) to C object files (with the .OBJ extension) is
.C.OBJ: ICC $<
Note: The special macro $< represents the name of a dependent file that is out-of-date relative to the target.