views:

137

answers:

2

I have a Visual Studio project that uses a solution file to build it. I want to generate a makefile so that I can build it using the makefile instead of the solution file. (The reason I need to do this in case you are wondering is that I am incorporating my project into a larger software system that uses makefiles to build, and I want to be able to build the whole thing using the makefiles.)

Is there a way to automatically get the information from the Visual Studio solution and convert it into a makefile format, or do I need to do that manually?

A: 

Although I never used it, this might be an alternative. It's rather old and might not work well for new projects. It used to come with mingw but (don't know why) not anymore. Offtopic: Personally, if the project is not enormous, I would go with manually writing a Makefile.

nc3b
A: 

This used to be possible in VC6, it had an option to generate a makefile from a .dsp project file. No more, the build process has changed too much to make this achievable.

Not a real problem, you can have the makefile invoke the vcbuild.exe tool, it builds a .vcproj project. Important switches you'll want to use in your makefile:

  • /clean: use that in your clean: target
  • /rebuild: use in your rebuild: target
  • /nocolor: makes build output look battleship gray like other build tools
  • /platform: selects the configuration you want to build (e.g: /platform:win32)

For example:

vcbuild /platform:win32 example.vcproj release

Note that the build system got a major revision in VS2010, you'll use msbuild.exe instead to build the .vcxproj project.

Hans Passant
[VCBuild is deprecated](http://blogs.msdn.com/vcblog/archive/2010/01/11/vcbuild-vs-c-msbuild-on-the-command-line.aspx) in favour of MSBuild.
Alex
Check the last paragraph of my post.
Hans Passant
Ah, I must've missed it.
Alex