Skip to main content

Make

Build System: A developers Chauffeur

"Working without a build system is like trying to assemble a jigsaw puzzle with a blindfold on and oven mitts for hands. It's a recipe for chaos and burnt fingers!"
- ChatGPT

The Boring task of compilation

Behind the scenes of the coding universe lies the secret superhero known as the compiler. With lightning speed and super heroic intelligence, it takes your human-readable code and transforms it into a symphony of ones and zeros that machines can understand.

To build a source file the developer invokes the compiler to compile that file into a format machine can understand. This looks handy for a single or couple of source files, but what if there are 10s or 100s of source files, compiling each of them by manually invoking a compiler does not look handy anymore.

However, this process can be automated by writing a tool that can search the list of sources and invoke the compiler on them one by one. Let's assume we have a tool that takes n number of source files and compiles them one by one to create a final binary.

Consider a scenario where you have a C program consisting of two files: main.c and add.c. The main.c file contains the main() function, and the add.c file contains the custom implementation of some add() function used in the program.