Makefile: Get rid of templating
We currently use templating to generate the Makefile, which causes us to split up build information across a set of multiple different files. The initial motivation for this was two-fold, where one reason was to make the Makefile more predictable and the second was performance. The downside of generating Makefiles is added complexity, though, and that reading Makefiles got kind of awkward because of huge generated lines.
This commit restructures our Makefile in order to get rid of the templating scheme in order to unify build information into a single place again. To make them predictable, the new Makefile makes strong use of variables that hold various information about paths. Furthermore, to not pay a performance penalty, the dynamic parts of discovering packages, source files and commands was moved into callable functions that only get executed when the current target actually requires that kind of information.
The resulting Makefile seems easier to manage in the long term and doesn't seem to perform any worse than the generated Makefile. It'll also make future refactoring and improvements a lot easier to implement.
I had been playing around in our Makefile yesterday and found it to be rather confusing. The root cause to me is the templating part, as I think the split of Makefile and generated parameters makes it much harder to reason about the Makefile. Furthermore, I found that the Makefile really could use some refactoring to make it easier to reason about and to make various parts more explicit, especially when it comes to paths. I thus decided to give it a go and do some refactoring, which culminates in this MR. If you ask me, the result is a lot easier to understand and also looks much cleaner, but that may be my personal take, only. I'd thus like to hear what your opinion is, @gl-gitaly.