NMAKE May Assume Inferred Dependent Files |
Q92735
The information in this article applies to:
- Microsoft NMAKE Utility for MS-DOS, versions 1.2, 1.3, 1.4
- Microsoft NMAKE Utility for Windows NT, versions 1.4, 1.5
SUMMARY
In a Microsoft NMAKE makefile, an inference rule can create one or more inferred dependent files. According to page 659 of the Microsoft C/C++ "Environment and Tools" manual for version 7.0, NMAKE considers inferred dependent files and places them into the dependency list. In some cases, this behavior may appear incorrect. However, as the first makefile in the text below illustrates, this is expected behavior.
The second makefile below illustrates the correct method. Changing the macro substitution from "$(?: = " to "$(obj: = " succeeds because the substitution creates an explicit macro [$(objs)] instead of a predefined macro [$(?)]. NMAKE uses the explicit macro as a source for inferred dependent files.
MORE INFORMATION
The following two makefiles compile TEST1.C, TEST2.C, and TEST3.C using the user-defined inference rule, and generates a linker response file for the Microsoft LINK utility.
NOTE: This is a 16-bit specific example.
Makefile 1 (Incorrect)
objs = test1.obj test2.obj test3.obj .c.obj: cl /c /AM /FPi87 /Od /f $*.c test1.exe : $(objs) link /NOI /NOPACKC /ST:2048 @<<make.lrf $(?: = +^ ) NUL my.def; <<NOKEEP
Makefile 2 (Correct)
objs = test1.obj test2.obj test3.obj .c.obj: cl /c /AM /FPi87 /Od /f $*.c test1.exe : $(objs) link /NOI /NOPACKC /ST:2048 @<<make.lrf $(objs: = +^ ) NUL my.def; <<NOKEEP
Additional query words: kbinf 1.20 1.30 1.40 1.50
Keywords : kb16bitonly
Issue type :
Technology : kbVCsearch kbAudDeveloper kbNMAKESearch kbNMAKE120DOS kbNMAKE130DOS kbNMAKE140DOS kbNMAKE140NT kbNMAKE150NT
Last Reviewed: October 24, 1999 |