Command Modifiers

Command modifiers provide extra control over the commands in a description block. You can use more than one modifier for a single command. Specify a command modifier preceding the command being modified, optionally separated by spaces or tabs. Like a command, a modifier cannot appear at the beginning of a line. It must be preceded by one or more spaces or tabs.

The following describes the three NMAKE command modifiers.

@command

Prevents NMAKE from displaying the command. Any results displayed by commands are not suppressed. Spaces and tabs can appear before the command. By default, NMAKE echoes all makefile commands that it executes. The /S option (described on page 650) suppresses display for the entire makefile; the .SILENT directive (described on topic ) suppresses display for part of the makefile.

[[number ]] command

Turns off error checking for the command. Spaces and tabs can appear before the command. By default, NMAKE halts when any command returns an error in the form of a nonzero exit code. This modifier tells NMAKE to ignore errors from the specified command. If the dash is followed by a number, NMAKE stops if the exit code returned by the command is greater than that number. No spaces or tabs can appear between the dash and the number; they must appear between the number and the command. (For more information on using this number, see “Exit Codes from Commands”.) The /I option (described on page 649) turns off error checking for the entire makefile; the .IGNORE directive (described on topic ) turns off error checking for part of the makefile.

!command

Executes the command for each dependent file if the command preceded by the exclamation point uses the predefined macros $** or $?. (See “Filename Macros”.) Spaces and tabs can appear before the command. The $** macro represents all dependent files in the dependency line. The $? macro refers to all dependent files in the dependency line that have a later time stamp than the target.

Example 1

In the following example, the at sign (@) suppresses display of the ECHO command line:

sort.exe : sort.obj

@ECHO Now sorting...

The output of the ECHO command is not suppressed.

Example 2

In the following description block, if the program sample returns a nonzero exit code, NMAKE does not halt; if sort returns an exit code that is greater than 5, NMAKE stops:

light.lst : light.txt

-sample light.txt

-5 sort light.txt

Example 3

The description block

print : one.txt two.txt three.txt

!print $** lpt1:

generates the following commands:

print one.txt lpt1:

print two.txt lpt1:

print three.txt lpt1: