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"
   Application.Quit
end Sub

Updated 21 March 1998



Comments

  • Export

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

    Close to what I'm looking for.

    Reply
  • Renaming DSW-Files

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

    Originally posted by: Thomas Fenske

    Hi,

    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.

    Thomas

    Reply
  • 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...

    Reply
  • 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?).

    Reply
  • 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
    Muthukumaran

    Reply
  • 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.

    Thanks,

    Mike Morley
    MMorley@ebay.com

    Reply
  • 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

    Reply
  • 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

    Reply
  • 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.

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

Top White Papers and Webcasts

  • Today's agile organizations pose operations teams with a tremendous challenge: to deploy new releases to production immediately after development and testing is completed. To ensure that applications are deployed successfully, an automatic and transparent process is required. We refer to this process as Zero Touch Deployment™. This white paper reviews two approaches to Zero Touch Deployment--a script-based solution and a release automation platform. The article discusses how each can solve the key …

  • On-demand Event Event Date: October 29, 2014 It's well understood how critical version control is for code. However, its importance to DevOps isn't always recognized. The 2014 DevOps Survey of Practice shows that one of the key predictors of DevOps success is putting all production environment artifacts into version control. In this webcast, Gene Kim discusses these survey findings and shares woeful tales of artifact management gone wrong! Gene also shares examples of how high-performing DevOps …

Most Popular Programming Stories

More for Developers

RSS Feeds