Here’s a handy Developer Studio macro that I wrote to export a makefile from
a Visual C++ V5.0 project (.DSP) file. We had a bunch of batch files that
we use to build a software project; these broke when V5.0 moved from the
.MAK file to the .DSP file. This macro writes a .MAK file usable by the
NMAKE command. Instructions for installation and use are appended.
Installing the macro:
- Create a file “ExportMakefile.dsm” using the
code at the end of this article and copy to the
- Start Visual C++ (Developer Studio), select the Tools->Customize menu
item, select the “Add-ins and Macro Files” tab, click the check box next to
ExportMakefile, then click the Close pushbutton.
Using the macro:
Invoke the macro at a command line prompt via:
MSDEV [/nologo] project.DSP /Execute ExportMakefile
Then you can invoke the makefile via NMAKE /f project.MAK.
Note: If your project has already been opened by Developer Studio (i.e., if
a .DSW file already exists in the same directory as the .DSP file),
Developer Studio will display a dialog box that requires you to click on
“OK”. I haven’t figured out if there’s a way to suppress that dialog.
(Editors note: try renaming the DSW file before generating the MAK file
then restoring it after the build.)
‘FILE DESCRIPTION: Exports a makefile from a project and exits Visual Studio
Application.Visible = False
Updated 21 March 1998