Autofail

02/03/2015

Makefile.in is a file suitable for dirty hacks affecting Makefiles generated by autotools. Look what I’ve found:

# Bootstrapping right is difficult because of the circular dependencies.
# Furthermore, we have to deal with the fact that many compilation targets
# such as loaddefs.el or *.elc can typically be produced by any old
# Emacs executable, so we would like to avoid rebuilding them whenever
# we build a new Emacs executable.
# To solve the circularity, we use 2 different Emacs executables,
# "emacs" is the main target and "bootstrap-emacs" is the one used
# to build the *.elc and loaddefs.el files.
# To solve the freshness issue, we used to use a third file "witness-emacs"
# which was used to witness the fact that there is a bootstrap-emacs
# executable, and then have dependencies on witness-emacs rather than
# bootstrap-emacs, but that lead to problems in parallel builds (because
# witness-emacs needed to be free from dependencies (to avoid rebuilding
# it), so it was compiled in parallel, leading typically to having 2
# processes dumping bootstrap-emacs at the same time).
# So instead, we replace the witness-emacs dependencies by conditional
# bootstrap-dependencies (via $(BOOTSTRAPEMACS)).  Of course, since we do
# not want to rely on GNU Make features, we have to rely on an external
# script to do the conditional part of the dependency
# (i.e. see the $(SUBDIR) rule ../Makefile.in).

Sometimes I wish to be in an alternative universe where tup has taken over as build tool for any large project and GNU Make has been banished into something used by academia only.