NMAKE May Assume Inferred Dependent Files

Last reviewed: February 15, 1995
Article ID: Q92735
The information in this article applies to:
  • Microsoft NMAKE for MS-DOS, versions 1.2, 1.3, and 1.4
  • Microsoft NMAKE Utility for Windows NT, versions 1.4 and 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 reference words: kbinf kbinf 1.20 1.30 1.40 1.50
KBCategory: kbtool
KBSubcategory: NmakeIss


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 15, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.