Compilation systems. Beyond simple configure, make, make install

All or almost all (and if you are not lucky) we have had to compile a program from the source code. Actually, in most projects it is enough to do a ./configure && make && make install to install the program, but we are going to see the different alternatives:

GNU Make

GNU Make is a low-level compilation system, few things are configured and no tests are performed:

Pros:

  • Very widespread
  • Simple to understand
  • Fast

Cons:

  • Little configurable
  • Difficult to maintain
  • Does not perform tests

make

BSD Make

BSD Make is another version of Make currently used by * BSD operating systems. It differs from GNU Make, being the most comprehensive BSD Make in functionality although it is less widespread.

Pros:

  • Fast
  • Simple to understand
  • More features than GNU Make

Cons:

  • Not widespread in the Linux world
  • Does not perform tests
  • Little configurable
  • Difficult to maintain

make

Autotools

Autotools is the official GNU system and generates a script called configure that we must call to generate the corresponding Makefile from GNU Make. It is widely used, however, more and more people (myself included) think that it is too cumbersome, difficult, slow and not very compatible.

Pros:

  • Highly configurable
  • Very widespread

Cons:

  • Little portability between Non-UNIX systems
  • Perform too many tests (check EVERYTHING, and EVERYTHING is EVERYTHING)
  • Very slow when setting
  • Poor backward compatibility

./configure && make

CMake

(My favorite system) CMake is a system that comes to make up for the shortcomings of Autotools in many aspects, such as its terrible backward compatibility and portability. Also improving the test system that are highly configurable for the needs of each project. The truth is that more and more projects use CMake such as KDE, PortAudio, Ogre3D, etc. We can recognize this type of systems thanks to a CMakeLists.txt file that will generate a Makefile or a project for Eclipse or CodeBlocks

Pros:

  • Fast
  • Great cross-platform support
  • You can define the tests in a very customizable way

Cons:

  • Hard to understand at first
  • You must work with an abstraction that can be scary at first
  • Little spread although little by little it grows

cmake . && make

QMake

QMake is a system designed by Trolltech to compile projects made in Qt. In this way qmake puts a lot of emphasis on Qt and is usually the format used by IDEs like QtCreator. It is quite popular in Qt projects but it is not found outside of this environment:

Pros:

  • Very well integrated with Qt
  • Fast
  • Good multiplatform within Qt

Cons:

  • Uncommon outside of Qt apps

qmake . && make

SCons

SCons is a Python-based system for compiling C / C ++ projects. Unlike Autotools, CMake or QMake; SCons does not build a Makefile. SCons is very modifiable but it is perhaps the slowest in simple operations
Pros:

  • Easy modification
  • Take the fair tests

Cons:

  • Little spread
  • Slow

scons

Boost.Jam

Boost.Jam is a version of Perforce Jam that is used in the popular C ++ Boost libraries, although the compilation system can be used separately. Unlike GNU Make, Boost.Jam uses Jamfiles, which are an improved version of Makefiles. They are quite popular in the BeOS / Zeta / Haiku environment.

Pros:

  • Fast
  • The shortest to write

Cons:

  • Little spread
  • Difficulty performing tests

bjam

Ninja

Ninja is a system developed by Google to provide an ultra-fast build system originally designed to be that of the Chromium project. Ninja is not designed to be easy to modify, according to its own authors, a system that generates Ninja must be found. The recommended ones are CMake and gyp.

Pros:

  • Very fast

Cons:

  • You need another system to spawn Ninja
  • Little spread

ninja

Others

You can use any other system such as your own bash or python script. There are also generators for other non-native languages ​​that can be used like Gradle, Maven, gyp, etc.


The content of the article adheres to our principles of editorial ethics. To report an error click here!.

4 comments, leave yours

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   abimaelmartell said

    Make is not a compilation system, it is a generator of binaries (or targets) from its source code. It can also be used as a task runner.

    I differ with you that the BSD make is broader in functionality, the GNU make is more complete, it has more functionality. And I say this from my own experience, in BSD I always have to install GNU make because BSD make is very simple compared to GNU make.

    I agree with you that Autotools is quite cumbersome, I prefer to just use the Makefile. Makefiles generated by Autotools are difficult to debug.

    Regards!

    1.    AdrianArroyoStreet said

      Thanks for comment!
      In my opinion GNU make has always been more traditional and faithful to the original make program and BSD make has always been more innovative but it may be that I have noticed other things when making the comparison.

      Autotools are really a big headache. As a contributor to the Haiku operating system I have had to port software with autotools and it is hell. There are not few cases that I ended up creating the Makefile or the CMakeLists.txt before fixing this mess.

  2.   Chuck daniels said

    I am currently using Premake4, very configurable and simple based on Lua scripts. Take a look if you don't know it.
    Congratulations on the article, simple and concise, excellent reference.

  3.   Bones said

    'make check' is used to check the compilation after using make
    Saludes