Generate NMAKE Makefile from VC++ project?

Posted on 2009-03-30
Last Modified: 2013-12-14
Is there a quick way to generate a valid makefile for nmake given an existing Visual C++ project? I'm using VS 2008.
Question by:mrjoltcola
  • 3
  • 2
LVL 49

Assisted Solution

DanRollins earned 200 total points
ID: 24023121
I beleive not.  VS6 had an "Export Makefile..." menu item, but Microsoft has changed to the MSBuild technique.
If all you want is a command-line way to do a build, you can use something like:
   MSBuild /target:Debug myproject.csproj
   MSBuild Reference
LVL 49

Assisted Solution

DanRollins earned 200 total points
ID: 24023203
> In older VS versions, I could generate Makefiles from the project.

We cut this feature in VC7 because it was a bug farm and we couldn't get
it to work properly without fundamentally changing the feature. The more
I get feedback on this, though, the more I get convinced that may be
this was not the right decision :(

LVL 39

Accepted Solution

itsmeandnobodyelse earned 300 total points
ID: 24031668
>>>> If all you want is a command-line way to do a build,

For VC compiling it is vcbuild and not msbuild (I hope they didn't change it from VS2005 cause I actually didn't use it for VS2008 projects til now).

You'll get the possible options by typing

   vcbuild /?

at the command prompt.
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

LVL 39

Expert Comment

ID: 24031722
The vcbuild is quite mighty and I didn't miss the nmake. In VC6 we were used to generate makefiles from dsp project files which indeed was a 'bug farm' and I was really happy when we ported to VC8 and vcbuild and dropped the OS/2 branch which was the major reason for using makefiles.
LVL 40

Author Comment

ID: 24031779
Thanks guys, my main problem is maintaining this for open source projects. On UNIX I used to use autoconf, and it may very well support nmake, but I doubt it.

Secondly, trying to run vcvars32.bat to get the right environment involves either asking the user, or detecting it, so I am just trying to figure out the best approach.

It would seem someone would have written a tool, by now, to export a makefile.

Anyway, to the answers, vcbuild will do for now. I will just continue to maintain a separate makefile for UNIX, and possibly will write a Perl script to generate one from the project file at some point.

Points to both of you!
LVL 39

Expert Comment

ID: 24032191
>>>> I will just continue to maintain a separate makefile for UNIX

Yes, I did the same for a dll project at Windows/VC7 and AIX/xlC and - though I made the AIX makefile programatically by evaluating the source files from vcproj it actually was *not* a conversion of a vcproj to a unix makefile but something very much less, i. e. updating the list of source files in an existing unix make file. And I don't think that more is senseful.

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Easy String Encryption Using CryptoAPI in C++ ( I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question