Targets

In a dependency line, specify one or more targets, using any valid file name, directory name, or pseudotargets. Separate multiple targets with one or more spaces or tabs. Targets are not case-sensitive. Paths are permitted with file names. A target cannot exceed 256 characters. If the target preceding the colon is a single character, use a separating space; otherwise, Nmake.exe interprets the combined letter and colon as a drive specifier.

A pseudotarget is a label that is used in place of a file name in a dependency line. It is interpreted as a file that does not exist, and so is out-of-date. Nmake.exe assumes that a pseudotarget's time stamp is the most recent of all its dependents. If it has no dependents, the current time is assumed. If a pseudotarget is used as a target, its commands are always executed. A pseudotarget that is used as a dependent must also appear as a target in another dependency. However, that dependency does not have to have a commands block.

Pseudotarget names follow the file name syntax rules for targets. However, if the name does not have a file name extension, which includes a period, it can exceed the 8-character limit for file names and can be up to 256 characters long.

The following table shows how Nmake.exe evaluates multiple targets in a single dependency as if each were specified in a separate description block.

Statement Evaluation
Bounce.exe Leap.exe : Bounce.exe : Jump.obj
Jump.obj echo Building
echo Building Leap.exe : Jump.obj
  echo Building

The following table shows that dependencies are cumulative in a description block, if a target is repeated.

Statement Evaluation
Bounce.exe : Jump.obj Bounce.exe : Jump.obj
Bounce.exe : Up.obj Up.obj
echo Building echo Building
Bounce.exe Bounce.exe

Multiple targets in multiple dependency lines in a single description block are evaluated as if each were specified in a separate description block, but targets that are not in the last dependency line do not use the commands block. The following table shows how Nmake.exe handles multiple targets in multiple dependency lines in a single description block.

Statement Evaluation
Bounce.exe Leap.exe : Bounce.exe : Jump.obj
Jump.obj Up.obj
Bounce.exe Climb.exe : echo Building
Up.obj Bounce.exe
echo Building Climb.exe : Up.obj
  echo Building
  Climb.exe
  Leap.exe : Jump.obj
  # invoke an inference rule

The following code example shows how to update a target in more than one description block by using different commands and specifying a double colon (::) between targets and dependents.

Target.lib :: one.asm two.asm three.asm
    ml one.asm two.asm three.asm
    lib target one.obj two.obj three.obj
target.lib :: four.c five.c
    cl /c four.c five.c
    lib target four.obj five.obj

If a target is specified with a colon (:) in two dependency lines in different locations, and if commands appear after only one of the lines, Nmake.exe interprets the dependencies as if they are adjacent or combined. It does not invoke an inference rule for the dependency that has no commands, but instead assumes that the dependencies belong to one description block and executes the commands that are specified with the other dependency.

The following table shows how Nmake.exe interprets dependencies.

Statement Evaluation
Bounce.exe : Jump.obj Bounce.exe : Jump.obj
echo Building Up.obj
Bounce.exe echo Building
Bounce.exe : Up.obj Bounce.exe

This effect does not occur if a double colon (::) is used.

The following table shows how Nmake.exe interprets dependencies if a double colon is used.

Statement Evaluation
Bounce.exe :: Jump.obj Bounce.exe : Jump.obj
echo Building echo Building
Bounce.exe Bounce.exe
Bounce.exe :: Up.obj Bounce.exe : Up.obj
  # invokes an inference rule

See Also

Description Blocks | Dependents

 Last updated on Friday, October 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.