3. Diversity Management

Let’s list some changes that the Makefiles need to handle.

  • Platform/Host used for compilation
    • Windows
    • Linux
    • Mac

Depending on the choice of platform, the build system may have to invoke a post processing script. The post processing script would be a shell script for Linux/Mac and would be a bat or cmd file for windows based systems.

  • Choice of the compiler.

    Assuming you are compiling on Windows, the build system may have many choices of the compilers.

    • Visual Studio 2003
    • Visual Studio 2005
    • Visual Studio 2010
    • Visual Studio 2013
    • GCC / GCC GNU C / GNUC G++

For visual studio, if you are maintaining IDE files, you may have to maintain VCPROJ Files, VCXPROJ Files.

If you are using Makefiles for compilation, the Makefiles have to provide same information to visual studio compiler CL and GCC Compilers gcc (e.g. Include paths and defiles) with different syntax. e.g. using -I and -D for gcc based systems to provide include paths and defines and /I and /D for Visual Studio based systems. The Makefiles have to handle such complexity. And, Makefiles have to

  • Choice of different libraries.

Assuming you are developing in C++ and you use the standard template library there are many options for the choice of implementation of the standard template library. See https://en.wikipedia.org/wiki/Standard_Template_Library#Implementations

Also when the choice of host platform where is it compilation happens (example Linux, Windows, Mac) there is an added complexity on the make files.

This is small decisions that this Makefiles make pile up and generally slows down in the build and make the build system little more complex.

Makefile generators take a pragmatic approach for this problem. The generators first detect what is the scope and parameters of build and then generate an optimized Makefiles.