Makefile Pseudotargets

A pseudotarget is a target in a description block that is not a file. Instead, it is a name that serves as a handle for building a group of files or executing a group of commands. In the following example, UPDATE is a pseudotarget:

UPDATE: *.*
   !copy $** A:\PRODUCT

When the Make utility evaluates a pseudotarget, it always considers the dependent files to be out-of-date. In the description above, the utility copies each of the dependent files to the specified drive and directory.

Predefined Pseudotargets
The Make utility predefines several pseudotargets that provide special rules within a makefile:

.SILENT Syntax: .SILENT : dependents...

This pseudotarget suppresses the display of executed commands for a single description block. The /s option does the same thing for all description blocks.

Suppress Command Display (/s option)

.IGNORE Syntax: .IGNORE : dependents...

This pseudotarget ignores exit codes returned by programs for a single description block. The /i option does the same thing for all description blocks.

Ignore Exit Codes (/i option)

.SUFFIXES Syntax: .SUFFIXES : extensions ...

This pseudotarget defines file extensions to try when NMAKE needs to build a target file for which no dependent files are specified. the Make utility searches the current directory for a file with the same name as the target file and an extension in <extensions...>. If the Make utility finds such a file, and if an inference rule applies to the file, the Make utility treats the file as a dependent of the target.

The .SUFFIXES pseudotarget is predefined as

.SUFFIXES : .OBJ .EXE .C .ASM 

To add extensions to the list, specify .SUFFIXES : followed by the new extensions. To clear the list, specify:

.SUFFIXES: 

Note: Only those extensions specified in .SUFFIXES can have inference rules. the Make utility ignores inference rules unless the extensions have been specified in a .SUFFIXES list.

.PRECIOUS Syntax: .PRECIOUS : targets...

This pseudotarget tells the Make utility not to delete a target even if the commands that build it are terminated or interrupted. This pseudotarget overrides the the Make utility default. By default, the Make utility deletes the target if it cannot be sure that the target was built successfully.

For example,

.PRECIOUS : TOOLS.LIB
TOOLS.LIB : A2Z.OBJ Z2A.OBJ
 command
 .
 . 

If the commands to build TOOLS.LIB are interrupted, leaving an incomplete file, the Make utility does not delete the partially built TOOLS.LIB.

Note: The pseudotarget .PRECIOUS is useful only in limited circumstances. Most professional development tools have their own interrupt handlers and "clean up" when errors occur.



Supply input to the Make Utility from the Command Line
Supply input to the Make Utility from a Response File
Modify Commands in Makefiles