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

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.


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.