Special Characters in a .mak File
To use an Nmake.exe special character as a literal character, place a caret (^) in front of it. Nmake.exe ignores carets that precede other characters. The following table shows the Nmake.exe special characters.
|Special character||Name||Usage notes|
|#||Number sign||Precede a comment with a number sign (#). Nmake.exe ignores text between the number sign and the next newline character.
The following code examples show how to insert comments in a .mak file.
# Comment on line by itself OPTIONS = /MAP # Comment on macro definition line all.exe : one.obj two.obj # Comment on dependency line link one.obj two.obj # Comment in commands block # copy *.obj \objects # Command turned into comment copy one.exe \release .obj.exe: # Comment on inference rule line link $< my.exe : my.obj ; link my.obj # Err: cannot comment this # Error: # must be the first character .obj.exe: ; link $< # Error: cannot comment this
|^||Caret||A caret within a quoted string is treated as a literal caret character. A caret at the end of a line inserts a literal newline character in a string or macro.
The following code example shows how to specify a literal number sign, by preceding it with a caret (^).
DEF = ^#define #Macro for a C preprocessing directive
|\||Backslash||In macros, a backslash followed by a newline character is replaced by a space.|
|%||Percent sign||In commands, a percent sign is a file specifier. To represent a literal % in a command, specify two percent signs (%%) in place of a single one. In other situations, Nmake.exe interprets a single % literally, but it always interprets two %% as a single %. Therefore, to represent a literal %%, specify either three percent signs, %%%, or four percent signs, %%%%.|
|$||Dollar sign||To represent a literal $ in a command, specify two dollar signs ($$). This method can also be used in other situations where ^$ works.|
|*||Asterisk||A file name wildcard. Nmake.exe expands file name wildcards in dependency lines. A wildcard specified in a command is passed to the command; Nmake.exe does not expand it.|
|" "||Quotation marks||To use long file names, enclose them within quotation marks (" ").
The following code example shows how to use long file names.
All : "VeryLongFileName.exe"
Last updated on Friday, October 08, 2004
© 1992-2003 Microsoft Corporation. All rights reserved.