4 ms·
I've had good luck with self-writing makefiles, where I write macros to generate the rules. Here's an example: http://sourceforge.net/p/wordgrinder/code/ci/def
by david-given 12y ago
I've had good luck with self-writing makefiles, where I write macros to generate the rules. Here's an example:
http://sourceforge.net/p/wordgrinder/code/ci/default/tree/Makefile http://sourceforge.net/p/wordgrinder/code/ci/default/tree/Ma...
While it looks crazy, it has the advantage that it avoids pattern rules completely, which means that everything's explicit and we get to avoid some of make's more annoying misfeatures. It makes the makefiles vastly easier to reason about, as well as allowing things like building the same binary multiple times with different flags, which is really hard with traditional makefiles. The downside is that it looks crazy (and GNU make macros are not what you'd call well-designed, either).
As for switching to a different build system... like what? Every other build system I've seen is horrible in other ways, and make is at least ubiquitous. Every time I need to install some software which uses a non-make build system I get this horrible sinking feeling as I have to go and install the thing I need to install the thing.
...
Incidentally, the craziest thing I ever did in make was this:
http://cowlark.com/2013-10-19-insane-make/index.html http://cowlark.com/2013-10-19-insane-make/index.html
I wrote a compiler for a statically-typed language which targeted GNU make macros as a backend. Surprisingly, it actually worked, although I never got round to finishing the arbitrary-precision maths library needed by the runtime system...