Hi. I'm looking for a tool which can generate makefile for a C/C++ project for different compilers (gcc, microsoft vc++, borland etc) and different platforms (Win, Linux, Mac).

+3  A: 

Have you tried Automatic Makefile Generator?

It supports for the following compilers:

    Borland 3.1 
    Borland 5.0 
    Borland 5.0, 16 bit 
    Borland 5.5 
    Borland 5.6 
    Borland 5.8 
    Gnu g++ 
    Gnu g++, dynamic library 
    Intel 5, 6, 7 for Linux 
    Intel 5, 6, 7 for Linux, dynamic library 
    Intel 5, 6, 7 for windows 
    Intel 8,9,10 for Linux 
    Intel 8,9,10 for Linux, dynamic library 
    Intel 8,9 for windows 
    Intel 10 for windows 
    Visual C++ 5 
    Visual C++ 6, 7, 7.1 
    Visual C++ 8 
    Open Watcom 
    Watcom 10A 
    Watcom 10A, 16 bit
+1  A: 

Prakash writes

Have you tried Automatic Makefile Generator?

Thanks, I will. Meanwhile I found cmake. It seems good to me though I don't know whether it allows to specify preprocessor definitions for the specific target.

I don't much like cmake, my reasons are many, but the worst IMO is it forces your users to install cmake before they can build your project.
Max Howell

Thanks, CMake looks great! I will give a try..

+11  A: 

Other suggestions you may want to consider:

  • Scons is a cross-platform, cross-compiler build library, uses Python scruipting for the build systems. Used in a variety of large projects, and performs very well.

  • If you're using Qt, QMake is a nice build system too.

  • CMake is also pretty sweet.

  • Finally, If all else fails...



I'll also second CMake. I've been using it for quite a while on a multi-platform project and I'm very satisfied with it.


One issue to consider is do you want a "makefile" creator or a replacement build system? The problem with replacement build systems is that you typically don't get good IDE integration for platforms whose users expect this (Visual C++). If you do want a makefile creator instead of a replacement build system, take a look at MPC. It's free and open source.

Adam Mitz
+2  A: 

I've used Bakefile before with some success. It's fairly simple and seems to work well.

+1  A: 


Automatic generation of (M|m)akefiles makes me worry about what you're trying to do here.

Do you understand what goes on under the covers when you type make? Or gmake? I'm only asking because if you don't when things break, such as new code changes not being incorporated into the build, you'll have difficulties trying to work what has happened.

To start to understand make, can I suggest having a read of "Managing Projects with GNU Make" by Robert Mecklenberg. The early chapters cover how make is working. Getting your heard around the fact that make is backward chaining is one of the biggest things you can do.

If you don't, and your system appears to work, then you'll be, to use The Pragmatic Programmers' term, "programming by coincidence". (-:

BTW Great articles available at their site! And I'm not involved with them. YMMV. Yada-yada...

cheers, Rob

Rob Wells
+1  A: 

CMake is the only tool which can actually generate real Visual Studio projects (i.e. not "Makefile"-projects which call out to an external tool), and which automatically recreates the projects when the build input file (CMakeLists.txt) changes.

SCons performance issues are well-known and a thorougly debated topic on the SCons mailing lists.

+1  A: 

I would vote for OMake. It fixes all complains I had with GNU make:

  • it's a full-blown language.
  • uses MD5 instead of timestamps.
  • provides a minimal shell which implements the most useful unix commands on all platforms: find, sed, awk, etc...
  • works with either unix or dos style pathnames.
  • extensively documented.
  • supports parallel builds.
  • fast.