Export Makefile | CodeGuru

Export Makefile

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 […]

Written By
CodeGuru Staff
CodeGuru Staff
Aug 7, 1998
1 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

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:

  1. Create a file “ExportMakefile.dsm” using the
    code
    at the end of this article and copy to the
    ProgramFilesDevStudioSharedIDEMacros directory.
  2. 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: ExportMakefile.dsmFILE DESCRIPTION: Exports a makefile from a project and exits Visual Studio
‘—————————————————————————
Sub ExportMakefile
   Application.Visible = False
   Application.ExecuteCommandBuildProjectExportDocuments.SaveAll True
   Application.ExecuteCommandWorkspaceCloseApplication.Quit
end Sub

Updated 21 March 1998

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.