MakefileOverview

The Makefile system is constructed by a combination of elements:

The top-level Makefile is in the project directory, and is used to launch the auto-build. It consists of only a list of directories to build, and an included .mk file sets up the recursion targets. It assumes that there are no actual targets to build (actual code, that is).

Each application and library directory has its own Makefile, with a few assumptions:

This comprehensive structure provides a top-down recursive system that can be used to schedule automatic builds for the entire source tree. The objective is to provide a fully mixed environment (in terms of language), but a subdivided environment based on the style of build product. This largely breaks down into libraries and applications. Different applications run in different contexts, but the code is usually not shared. If code is shared, then it is a library. It is better to not let applications slop all over each other, because the cross-directory references lead to hidden dependencies that are hard to manage across a build tree. If the coding is shared, then the problem is magnified several-fold, and it is just better to create real libraries for anything that is shared. This leads to another problem, which is the design of namespaces and packages. It is my firm belief that it is better to put in the effort there, since it will lead to better library cohesiveness. It is less convenient, but worth it if you intend to have a long-run scenario on your hands.