Home Page (Projects) | Overviews | How Do I... Topics | NMAKE Reference
If you want to use NMAKE to build a Visual C++ project, instead of building it from within the environment or by using the Visual C++ command line tools, you can it export it as a makefile (ProjectName.mak). However, you no longer need to use NMAKE to build a Visual C++ project from the command line. For more information, see Building a project from the command line.
Exporting a .mak file consists of two parts: creating the .mak file and creating or updating a corresponding .dep file. The first time you export a .mak file, Visual C++ creates an NMAKE-style include file (Projectname.dep), which contains information about any included files required to build the project source files. Within the .mak file, Visual C++ adds an !include directive that references the projectname.dep file. Once this .dep file exists, you can specify whether or not you want Visual C++ to export the dependency information when it exports the .mak file.
You can greatly increase the speed of exporting .mak files by exporting dependency information only when you explicitly want to update the .dep file. You may not wish to update dependency information, for example, if only compiler switches have changed since the last time you built the project.
By default, the information written to the .dep file is applied to all build configurations. If there are significant differences in the dependencies between build configurations, for example, extra header files for a "Win32 Debug" configuration, you can specify that the dependency information be written on a per-configuration basis.
You may also wish to create and maintain the .dep files yourself. If so, you must follow the NMAKE naming convention (ProjectName.dep) or your project will not build.
Here is an example .dep file for MyProject.mak:
FileName.cpp: MyDep1.h, MyDep2.h
FileName2.cpp: YourDep2.h
Automatically export a makefile whenever a project is updated
Automatically write dependency information when exporting a makefile
Specify different dependency information for different configurations
A separate .mak file is created for each project you select.
If you know that you want to automatically export the .mak file each time you update this project, use the following procedure.
To automatically export a makefile when the project is updated
Selecting this option increases the time it takes to save the project.
To automatically write dependency information every time you export a makefile
Selecting this option considerably increases the time it takes to write the .mak file.
To specify per-configuration dependency information
Selecting this option increases the time it takes to write the dependency information, according to the number of build configurations in the project.