NMAKE provides a syntax that you can use in commands to represent components of the name of the first dependent file. This file is generally the first file listed to the right of the colon in a dependency line. However, if a dependent is implied from an inference rule, NMAKE considers the inferred dependent to be the first dependent file, ahead of any explicit dependents. If more than one inference rule applies, the .SUFFIXES list determines which dependent is first. The filename components are the file's drive, path, base name, and extension as you have specified it, not as it exists on disk.
You can represent the complete filename with the following syntax:
%s
For example, if a description block contains
sample.exe : c:\project\sample.obj
LINK %s;
NMAKE interprets the command as
LINK c:\project\sample.obj;
You can represent parts of the complete filename with the following syntax:
%|[[parts]]F
where parts can be zero or more of the following letters, in any order:
Letter | Description |
No letter | Complete name |
d | Drive |
p | Path |
f | File base name |
e | File extension |
Using this syntax, you can represent the full filename specification by %|F or by %|dpfeF, as well as by %s.
Example
The following description block uses filename-parts syntax:
sample.exe : c:\project\sample.obj
LINK %s, a:%|pfF.exe;
NMAKE interprets the first representation as the complete filename of the depen-dent. It interprets the second representation as a filename with the same path and base name as the dependent but on the specified drive and with the specified extension. It executes the following command:
LINK c:\project\sample.obj, a:\project\sample.exe;
Note:
For another way to represent components of a filename, see “Modifying Filename Macros”.