trig.lib : sin.obj cos.obj arctan.obj !ilib trig.lib $?
In this example, the macro $? represents the names of all dependent files that are out-of-date with respect to the target file. The exclamation point (!) preceding the ILIB command causes NMAKE to execute the ILIB command once for each dependent file in the list. As a result of this description, the ILIB command causes NMAKE to execute the ILIB command once for each dependent file in the list. As a result of this description, the ILIB command is executed up to three times, each time replacing a module with a newer version.
DIR=c:\include $(DIR)\globals.inc : globals.inc copy globals.inc $@ $(DIR)\types.inc : types.inc copy types.inc $@ $(DIR)\macros.inc : macros.inc copy macros.inc $@
This example shows how to update a group of include files. Each of the files, globals.inc, types.inc, and macros.inc, in the directory c:\include depends on its counterpart in the current directory. If one of the include files is out-of-date, NMAKE replaces it with the file of the same name from the current directory.
The following description file, which uses the special macro $$@, is equivalent:
DIR=c:\include $(DIR)\globals.inc $(DIR)\types.inc $(DIR)\macros.inc : $$(@F) !copy $? $@
The special macro $$(@F) signifies the file name (without the path) of the current target.
When NMAKE evaluates the description block, it evaluates the three targets, one at a time, with respect to their dependents. Thus, NMAKE first checks whether c:\include\globals.inc is out-of-date compared with globals.inc in the current directory. If so, it executes the command to copy the dependent file globals.inc to the target. NMAKE repeats the procedure for the other two targets.
Note that on the command line, the macro $? refers to the dependent for this target. The macro $@ specifies the full file specification of the target file.