NMAKE can create “inline files” which contain any text you specify. One use of inline files is to write a response file for another utility such as LINK or LIB. This eliminates the need to maintain a separate response file and removes the restraint on the maximum length of a command line.
Use this syntax to create an inline file called filename:
target : dependents
command << [[filename]]
inlinetext
.
.
.
<<[[KEEP | NOKEEP]]
All inlinetext between the two sets of double angle brackets (<<) is placed in the inline file. The filename is optional. If you don't supply filename, NMAKE gives the inline file a unique name. NMAKE places the inline file in the directory specified by the TMP environment variable. If TMP is not defined, the inline file is placed in the current directory.
Directives are not allowed in an inline file. NMAKE treats a directive in an inline file as literal text.
The inline file can be temporary or permanent. If you don't specify the option, or if you specify NOKEEP, the file is temporary. Specify KEEP to retain the file after the build ends.
Example
The following description block creates a LIB response file named LIB.LRF:
OBJECTS=add.obj sub.obj mul.obj div.obj
math.lib : $(OBJECTS)
LIB @<<lib.lrf
$*.lib
-+$(OBJECTS: = &^
-+)
listing;
<<KEEP
The resulting response file tells LIB which library to use, the commands to execute, and the name of the listing file to produce:
math.lib
-+add.obj &
-+sub.obj &
-+mul.obj &
-+div.obj
listing;
The file MATH.LIB must exist beforehand for this example to work.
The inline file specification can create more than one inline file. For instance,
target.abc : depend.xyz
cat <<file1 <<file2
I am the contents of file1.
<<KEEP
I am the contents of file2.
<<KEEP
The example creates the two inline files, FILE1 and FILE2. All inline text is written to the files sequentially. Therefore, the text
I am the contents of file1.
goes into FILE1, not FILE2, even though the text is nested between the angle brackets for FILE2 and the <<KEEP statement which follows. NMAKE then executes the command
cat file1 file2
The KEEP keywords tell NMAKE not to delete FILE1 and FILE2 when done.