10.4 Command-Line Options

NMAKE accepts a number of options, listed in Table 10.10. You can specify options in uppercase or lowercase and use either a slash or dash. For example, –A, /A, –a, and /a all represent the same option. This book uses a slash and uppercase letters.

Table 10.10 NMAKE Options

Option Action
/A Forces execution of all commands in description blocks in the description file even if targets are not out-of-date with respect to their dependents. Does not affect the behavior of incremental commands such as ILINK; using /A does not force a full link.
/C Suppresses nonfatal error or warning messages and the NMAKE copyright message.
/D Displays the modification time of each file.
/E Causes environment variables to override macro definitions in description files. See Section 10.3.4, “Macros.”
/F filename Specifies filename as the name of the description file. If you supply a dash () instead of a filename, NMAKE gets description-file input from the standard input device. (Terminate keyboard input with either F6 or CTRL+Z.) If you omit /F, NMAKE searches the current directory for a file called MAKEFILE and uses it as the description file. If MAKEFILE doesn't exist, NMAKE uses inference rules for the command-line targets.
/HELP Calls the QuickHelp utility. If NMAKE cannot locate the help file or QuickHelp, it displays a brief summary of NMAKE command-line syntax and exits to the operating system.
/I Ignores exit codes from commands listed in the description file. NMAKE processes the whole description file even if errors occur.
/N Displays but does not execute the description file's commands. This option is useful for debugging description files and checking which targets are out-of-date.
/NOLOGO Suppresses the NMAKE copyright message.
/P Displays all macro definitions, inference rules, target descriptions, and the .SUFFIXES list on the standard output device.
/Q Checks modification times for command-line targets (or first target in description file if no command-line targets are specified). NMAKE returns a zero exit code if all such targets are up-to-date and a nonzero exit code if any target is out-of-date. Only preprocessing commands in the description file are executed. This option is useful when running NMAKE from a batch file.
/R Ignores inference rules and macros that are defined in the TOOLS.INI file or that are predefined.
/S Suppresses the display of commands listed in the description file.
/T Changes modification times for command-line targets (or first target in description file if no command-line targets are specified). Only preprocessing commands in the description file are executed. Contents of target files are not modified.
/X filename Sends all error output to filename, which can be a file or a device. If you supply a dash () instead of a filename, error output is sent to the standard output device.
/Z Used for internal communication between NMAKE (or NMK) and PWB.
/? Displays a brief summary of NMAKE command-line syntax and exits to the operating system.

Example

The following command line specifies two NMAKE options:

NMAKE /F sample.mak /C targ1 targ2

The /F option tells NMAKE to read the description file SAMPLE.MAK. The /C option tells NMAKE not to display nonfatal error messages and warnings. The command specifies two targets (targ1 and targ2) to update.

In the following example, NMAKE updates the target targ1:

NMAKE /D /N targ1

Since no description file is specified, NMAKE searches the current directory for a description file named MAKEFILE. The /D option displays the modification time of each file; the /N option displays the commands in MAKEFILE without executing them.