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 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 \ProgramFiles\DevStudio\SharedIDE\Macros 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.dsm
'FILE DESCRIPTION: Exports a makefile from a project and exits Visual Studio
Sub ExportMakefile
   Application.Visible = False
   Application.ExecuteCommand "BuildProjectExport"
   Documents.SaveAll True
   Application.ExecuteCommand "WorkspaceClose"
end Sub

Updated 21 March 1998


  • Export

    Posted by janneman on 05/06/2005 12:28pm

    Close to what I'm looking for.

  • Renaming DSW-Files

    Posted by Legacy on 07/16/2003 12:00am

    Originally posted by: Thomas Fenske


    I use this macro with VS 6.0.
    Problems occur if a dsw file exists.
    Renaming to .dsw_ calling msdev und renaming back to .dsw seems not to work.
    Reason: Calling 'msdev' starts msdev.com(!) which starts msdev.exe(!) then msdev.com ends and the batch job goes to the next statement which is renaming dsw_ to dsw.

    Unfortunately this normally happens before VS is started and reads the dsp file. So it will find the dsw file and the brings the message box.

    Therefor it is important to call

    msdev.exe project.DSP /Execute ExportMakefile

    to be sure the batch job waits until VS is closed.

    Maybe this information saves someone an hour of searching.


  • go to next function as macro

    Posted by Legacy on 07/07/2003 12:00am

    Originally posted by: rajib

    I tried recording a macro that'd go to next function.

    So I ran the wizard bar and kept clicking on "Go To Next Function"

    After clicking that menu 3 times I got the following.

    ExecuteCommand "WBMembersActivate"
    ExecuteCommand "WBMembersActivate"
    ExecuteCommand "WBMembersActivate"

    What I'd like to do is get the name of the function and it's parameters?

    I tried something like

    dim m
    m = ActiveDocument.Selection

    to get the details I wanted ... but nothing happened.

    What am I doing wrong? Is there a good reference ExecuteCommand?

    For the sake of simplicity I am staying away from regular expression at this time.

    When I try to run the above I go nowhere...

  • creating a makefile for visual .net project

    Posted by Legacy on 05/30/2003 12:00am

    Originally posted by: fabrizio

    how do I create a makefile (a batch file of commands) to compile a project with visual studio .net? Moreover, I didn't find an easy way to compile resources file (is there a resources compiler available?).

  • Export Makefile

    Posted by Legacy on 01/06/2002 12:00am

    Originally posted by: Muthukumaran

    I would like to know the purpose of this Export Makefile and where i can use this? I dont know even a single word about MSDEV:-) Thanks for your help

    Best Regards

  • Export Makefile

    Posted by Legacy on 03/22/2000 12:00am

    Originally posted by: Mike Morley

    This macro creates the makefile..*but*, the macro
    returns the following error while exiting:

    DDE Server Window: MSDEV.EXE - Application error
    Press return to exit, etc.

    The problem appears to originate from the DEVSHL.DLL,
    version 5.00.7128. I am using VC++ 4.0.

    I would be extremely grateful if someone could
    shed light on this problem.


    Mike Morley

  • use VC++ 6 MSDEV.EXE cmdline options without .MAK file

    Posted by Legacy on 01/05/2000 12:00am

    Originally posted by: Walter Lederer

    There is an easy way to avoid .MAK files and problems with multiple projects in VC++ 6. See online help under "Building a Project from the Command Line". This does not require .MAK files.

    Example command line for MSDEV.EXE:

    %MSDevDir%\Bin\MSDEV.EXE x:\x\dz_ol.dsw /MAKE "dz_ol - Win32 Debug" /OUT x:\x\msdev_log.txt

  • How to add this macro to Visual Studio 4.2

    Posted by Legacy on 12/22/1999 12:00am

    Originally posted by: unni

    How can i add this macro to visual C++ ver. 4.2

  • Multiple Projects

    Posted by Legacy on 04/21/1999 12:00am

    Originally posted by: Narasimhan

    Have multiple projects and then use this macro :-). A dialog box is thrown on attempting to export this macro when there are multiple projects, so this might pose problems.

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • The 2014 State of DevOps Report — based on a survey of 9,200+ people in IT operations, software development and technology management roles in 110 countries — reveals: Companies with high-performing IT organizations are twice as likely to exceed their profitability, market share and productivity goals. IT performance improves with DevOps maturity, and strongly correlates with well-known DevOps practices. Job satisfaction is the No. 1 predictor of performance against organizational …

  • Data integrity and ultra-high performance dictate the success and growth of many companies. One of these companies is BridgePay Network Solutions, a recently launched and rapidly growing financial services organization that allows merchants around the world to process millions of daily credit card transactions. Due to the nature of their business, their IT team needed to strike the perfect balance between meeting regulatory-mandated data security measures with the lowest possible levels of latency and …

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date