The dependents section of the dependency line lists zero or more dependent names. Usually a dependent is a file used to build the target. However, a depen-dent can be any valid filename, or it can be a pseudotarget. You can specify a path with the filename. Dependents are not case sensitive. Separate each dependent name with one or more spaces or tabs. A single or double colon (: or ::) separates it from the targets section.
Along with dependents you explicitly list in the dependency line, NMAKE can assume an “inferred dependent.” An inferred dependent is derived from an inference rule. (For more information, see “Inference Rules”.) NMAKE considers an inferred dependent to appear earlier in a dependents list than explicit dependents. It builds inferred dependents into the dependency tree. It is important to note that when an inferred dependent in a dependency is out-of-date with respect to a target, NMAKE invokes the commands block associated with the dependency, just as it does with an explicit dependent.
NMAKE uses the dependency tree to make sure that dependents themselves are updated before it updates their targets. If a dependent file doesn't exist, NMAKE looks for a way to build it; if it already exists, NMAKE looks for a way to make sure it is up-to-date. If the dependent is listed as a target in another dependency, or if it is implied as a target in an inference rule, NMAKE checks that the dependent is up-to-date with respect to its own dependents; if the dependent file is out-of-date or doesn't exist, NMAKE executes the commands block for that dependency.
The example in Figure 18.1 lists three dependents after MYAPP.EXE:
myapp.exe : myapp.obj another.obj myapp.def
Specifying Search Paths for Dependents
You can specify the directories in which NMAKE should search for a dependent. The syntax for a directory specification is:
{directory[[;directory...]]}dependent
Enclose one or more directory names in braces ({}). Separate multiple directories with a semicolon (;). No spaces are allowed. You can use a macro to specify part or all of a search path. NMAKE searches the current directory first, then the directories in the order specified. A search path applies only to a single dependent.
Example
The following dependency line contains a directory specification:
forward.exe : {\src\alpha;d:\proj}pass.obj
The target FORWARD.EXE has one dependent, PASS.OBJ. The directory list specifies two directories. NMAKE first searches for PASS.OBJ in the current directory. If PASS.OBJ isn't there, NMAKE searches the \SRC\ALPHA directory, then the D:\PROJ directory.