Microsoft KB Archive/150616

= BUG: Nmake Does Not Build Subproject of Type Makefile =

Article ID: 150616

Article Last Modified on 12/8/2003

-

APPLIES TO


 * Microsoft Visual C++ 4.0 Standard Edition
 * Microsoft Visual C++ 4.1 Subscription
 * Microsoft Visual C++ 4.2 Enterprise Edition
 * Microsoft Visual C++ 4.2 Professional Edition

-



This article was previously published under Q150616



SYMPTOMS
When you use the nmake utility to build a project containing a subproject of type makefile that does not use nmake as its command, the subproject is not built. However, the subproject can be built from Developer Studio.



RESOLUTION
There are two ways to resolve the problem:


 * Build the project and sub-project separately. This requires either typing in a batch file or makefile that calls nmake once for each configuration. -or-


 * When you insert a project of type makefile, rather than changing the Command line to execute something other than nmake, specify a makefile which you create. Then create a makefile that executes the command you would use instead of nmake.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.



Steps to Reproduce Problem
Method 1:

 Open the MFC sample DLLHusk. From Insert menu, choose Project. Select type Makefile, give it a generic name, and select it as a subproject of DLLHusk.  Click the Create button. Remove the line "NMAKE /f" from the general tab of subproject generic, and type: c:\msdev\samples\mfc\advanced\dllhusk\generic\generic.bat The batch file generic.bat is executed for the inserted subproject build. 

Method 2:


 * 1) Create a batch file named Generic.bat in the subproject directory generic.
 * 2) Add some REM lines in the batch file to verify that this file is being used in the build process, or you can add commands to build one of your other projects by using NMAKE.

Method 3:

From the Build menu of Developer Studio, build or rebuild your toplevel project DLLHusk. Note that the subprojects TestDll1 and TesDll2 are built, the generic project is built, and then the toplevel project DLLHusk is built.

Method 4:

 Go to a Command prompt.</li> Run Vcvars32.bat from the Msdev\Bin directory.</li>  Move to the DLLHusk project directory, and run this command: NMAKE /A /F DLLHusk.mak CFG="DLLHusk - Win32 Debug" NOTE: The subprojects TestDll1 and TesDll2 are built, and the toplevel project DLLHusk is also built. However, the generic project is not built. </li></ol>

Example Resolution
To implement the first resolution from the Resolution section of this article, follow these steps:

 Create a batch file in the toplevel project directory. In this example, the toplevel project directory is the Dllhusk directory.</li>  Add the following lines to the batch file, and name it Dllhusk.bat assuming C: as the root directory: call generic\generic.bat REM If current directory and environment variables got changed call c:\msdev\bin\vcvars32.bat cd c:\msdev\samples\mfc\advanced\dllhusk nmake %1 /D /F dllhusk.mak CFG=%2 </li>  From the Dllhusk directory, run the following command from the Command line: dllhusk /A "DLLHusk - Win32 Debug" </li></ol>

This command builds all the subprojects and the toplevel project.

<div class="references_section">