Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create a makefile from a Visual Studio solution file?

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?

like image 345
Alex319 Avatar asked May 15 '10 06:05

Alex319


1 Answers

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.

like image 116
Hans Passant Avatar answered Oct 01 '22 07:10

Hans Passant