NMAKE Help (nmake.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Accumulating Targets in Dependencies
                                             Up Contents Index Back
─────NMAKE──────────────────────────────────────────────────────────────────
 
     Dependency lines are cumulative when the same target appears more
     than once in a single description block.
     See: Dependencies
          Targets
 
     For example, the makefile
 
          bounce.exe : jump.obj
          bounce.exe : up.obj
            echo Building bounce.exe...
 
     is evaluated by NMAKE as
 
          bounce.exe : jump.obj up.obj
            echo Building bounce.exe...
 
     This evaluation has several effects. Since NMAKE builds the
     dependency tree based on one target at a time, the lines can
     contain other targets, as in:
 
          bounce.exe leap.exe : jump.obj
          bounce.exe climb.exe : up.obj
            echo Building bounce.exe...
 
     NMAKE evaluates a dependency for each of the three targets as if
     each were specified in a separate description block. If bounce.exe
     or climb.exe is out-of-date, NMAKE runs the given command. If
     leap.exe is out-of-date, the given command does not apply, and
     NMAKE tries to use an inference rule.
 
     Caution
 
     If a target is specified in single-colon dependencies in different
     locations in the makefile, and if commands appear after only one
     of the lines, NMAKE interprets the dependencies as if they were
     adjacent or combined. This can cause an unwanted side effect:
     NMAKE does not invoke an inference rule for the dependency that
     has no commands. Instead, it accumulates the dependencies and
     executes the commands specified with the other dependency.
     See: Inference Rules
 
     For example, the following makefile is interpreted in the same way
     as the preceding examples:
 
          bounce.exe : jump.obj
            echo Building bounce.exe...
          .
          .
          .
          bounce.exe : up.obj
 
     This does not occur if the colons are doubled (::) after the
     duplicate targets. A double-colon dependency with no commands
     invokes an inference rule, even if another double-colon dependency
     containing the same target is followed by commands.
     See: Targets in Multiple Dependencies
                                    -♦-