Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Good techniques to use Makefiles in VisualStudio?

I know the ideal way to build projects is without requiring IDE based project files, since it theoretically causes all sort of trouble with automation and what not. But I've yet to work on a project that compiles on Windows that doesn't depend on the VisualStudio project (Ok, obviously some Open Source stuff gets done with Cygwin, but I'm being general here).

On the other hand if we just use VS to run a makefile, we loose all the benefits of the compile options window, and it becomes a pain to maintain the external makefile.

So how do people that use VS actually handle external makefiles? I have yet to find a painless system to do this...

Or in reality most people don't do this, although its preached as good practice?

like image 665
Robert Gould Avatar asked Feb 27 '09 07:02

Robert Gould


People also ask

Do people still use makefiles?

Makefiles are not obsolete, in the same way that text files are not obsolete. Storing all data in plain text is not always the right way of doing things, but if all you want is a Todo List then a plain text file is fine.

Should you use makefiles?

First, a Makefile for make is really useful when you build a program from several translation units (i.e. several *. c or *. cc files which are #include -ing some other header files) which are linked together (it is not very useful for a single source file tiny program).

What are makefiles used for?

Makefile sets a set of rules to determine which parts of a program need to be recompile, and issues command to recompile them. Makefile is a way of automating software building procedure and other complex tasks with dependencies. Makefile contains: dependency rules, macros and suffix(or implicit) rules.


1 Answers

Take a look at MSBuild!

  • MSBuild can work with the sln/csproj files from VS, so for simple projects you can just call them directly.
  • if you need more control, wrap the projects in your own build process, add your own tasks etc. - it is very extensible!

(I wanted to add a sample but this edior totally messed up the XML... sorry)

like image 184
laktak Avatar answered Sep 28 '22 08:09

laktak