The MAKE Utility

The MAKE utility (MAKE.EXE) compares dates of files and carries out commands based on the result of that comparison. Because of this single, rather basic capability, MAKE can be used to maintain complex programs built from many modules. The dates of source, object, and executable files are simply compared in a logical sequence; the assembler, compiler, linker, and other programming tools are invoked as appropriate.

The MAKE utility processes a plain ASCII text file called, as you might expect, a make file. You start the utility with a command-line entry in the following form:

MAKE makefile [options]

By convention, a make file has the same name as the executable file that is being maintained, but without an extension. The available MAKE switches are listed in Figure 4-7.

A simple make file contains one or more dependency statements separated by blank lines. Each dependency statement can be followed by a list of MS-DOS commands, in the following form:

targetfile : sourcefile ...

command

command

.

.

.

If the date and time of any source file are later than those of the target file, the accompanying list of commands is carried out. You may use comment lines, which begin with a # character, freely in a make file. MAKE can also process inference rules and macro definitions. For further details on these advanced capabilities, see the Microsoft or IBM documentation.

Switch Meaning

/D Display last modification date of each file as it is processed.

/I Ignore exit (return) codes returned by commands and programs

executed as a result of dependency statements.

/N Display commands that would be executed as a result of

dependency statements but do not execute those commands.

/S Do not display commands as they are executed.

/X Direct error messages from MAKE, or any program that MAKE runs,

<filename> to the specified file. If filename is a hyphen (-), direct

error messages to the standard output.

Figure 4-7. Switches for the MAKE utility.