NMAKE stops execution if a program executed by one of the commands in the NMAKE description file encounters an error. The exit code returned by the program is displayed as part of the error message.
Assume the NMAKE description file TEST contains the following lines:
TEST.OBJ : TEST.FOR
FL /c TEST.FOR
If the source code in TEST.FOR causes an error (but not a warning), you would see the following message the first time you use NMAKE with the NMAKE description file TEST:
NMAKE : fatal error U1077: 'FL /c TEST.FOR' - return code '2'
This error message indicates that the command FL /c TEST.FOR in the NMAKE description file returned exit code 2.
You can cause NMAKE to ignore an exit code for a command by preceding the command with a dash modifier (–). If you specify a number after the dash modifier (–n), NMAKE stops only if the exit code is greater than the specified number. (See Table 10.1.) You disable this behavior for the entire description file by invoking NMAKE with the /I option.
You can also test exit codes in NMAKE description files with the !IF preprocessing directive. See Section 10.3.7.2, “Executing a Program in Preprocessing.”
If you prefer to use DOS batch files instead of NMAKE description files, you can test the code returned with the IF command. See a DOS manual for more information.
NMAKE returns an exit code to the operating system or the calling program. A value of 0 indicates execution of NMAKE with no errors. Warnings return exit code 0.
Code | Meaning |
0 | No error |
2 | Program error |
4 | System error—out of memory |