Exporting an NMAKE Makefile

If you have a project created in the eMbedded Visual C++ development environment and want to build from the command line using NMAKE, you can export a makefile from the eMbedded Visual C++ development environment. If you don’t want to use NMAKE, you can use EVC to build the eMbedded Visual C++ project or workspace file from the command line. Both methods of building applications are described in Building Applications on the Command Line.

To export a .vcn file, you create a .vcn makefile and create or update the corresponding .dep dependency file. The first time you export a .vcn file, eMbedded 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 .vcn file, eMbedded Visual C++ adds an !include directive that references the Projectname.dep file. Once this .dep file exists, you can specify whether you want eMbedded Visual C++ to export the dependency information when it exports the .vcn file.

You can greatly increase the speed of exporting .vcn files by exporting dependency information only when you explicitly want to update the .dep file. You may not want 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 want 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

To export a makefile

  1. On the Project menu, choose Export Makefile.

  2. Under Projects, select the check box next to each project for which you want to create a .mak file.

    A separate .mak file is created for each project you select.

  3. If you want eMbedded Visual C++ to update dependency information, select the Write dependencies when writing makefiles checkbox.

You can automatically export the .mak file when you update the project. Note that doing so increases the time it takes to save the project.

To automatically export a makefile when the project is updated

  1. On the Tools menu, choose Options.
  2. On the Build tab, select the Export makefile when saving project file check box.

You can also automatically write dependency information when you update the project. Note that doing so may considerably increase the time it takes to write the .mak file.

To automatically write dependency information every time you export a makefile

  1. On the Tools menu, choose Options.
  2. On the Build tab, select the Always write dependencies when writing makefiles check box.

You can specify dependency information for different configurations. Selecting this option increases the time it takes to write the dependency information, according to the number of build configurations in the project.

To specify per-configuration dependency information

  1. On the Project menu, choose Settings.
  2. Under Settings For, select the top node for the project.
  3. On the General tab, check the Allow per-configuration dependencies check box.

See Also

Building Applications on the Command Line, Building Makefiles on the Command Line, NMAKE Reference