Example

.OBJ.EXE:
  LINK $<;

EXAMPLE1.EXE: EXAMPLE1.OBJ

EXAMPLE2.EXE: EXAMPLE2.OBJ
  LINK /CO EXAMPLE2,,,LIBV3.LIB

The first line above defines an inference rule that causes the LINK command to create an executable file whenever a change is made in the corresponding object file. The file name in the inference rule is specified with the special macro $< so that the rule applies to any .OBJ file with an out-of-date executable file.

When NMAKE does not find any commands in the first description block, it checks for a rule that might apply and finds the rule defined on the first two lines of the description file. NMAKE applies the rule, replacing $< with EXAMPLE1.OBJ when it executes the command, so that the LINK command becomes

LINK EXAMPLE1.OBJ;

NMAKE does not search for an inference rule when examining the second description block, because a command is explicitly given.


[Back: Special Features]
[Next: Inference-Rule Path Specifications]