One of the subtle advantages of Unix
make over the dependency databases built
into many IDEs is that makefiles are simple text files — files
that can be generated by programs.
In the mid-1980s it was fairly common for large Unix program
distributions to include elaborate custom shellscripts that would
probe their environment and use the information they gathered to
construct custom makefiles. These custom configurators reached absurd
sizes. I wrote one once that was 3000 lines of shell, about twice as
large as any single module in the program it was configuring —
and this was not unusual.
The community eventually said “Enough!” and various
people set out to write tools that would automate away part or all of
the process of maintaining makefiles. These tools generally tried to
address two issues:
One issue is
portability
. Makefile
generators are commonly built to run on many different hardware
platforms and Unix variants. They generally try to deduce things about
the local system (including everything from machine word size up to
which tools, languages, service libraries, and even document
formatters it has available). They then try to use those deductions to
write makefiles that exploit the local system's facilities and
compensate for its quirks.
The other issue is
dependency
derivation
. It's possible to deduce a great deal about the
dependencies of a collection of C sources by analyzing the sources
themselves (especially by looking at what include files they use and
share). Many makefile generators do this in order to mechanically
generate make dependencies.
Each different makefile generator tackles these objectives in a
slightly different way. Probably a dozen or more generators have
been attempted, but most proved inadequate or too difficult to drive
or both, and only a few are still in live use. We'll survey the major
ones here. All are available as open-source software on the
Internet.