automake-history: First Take on Dependencies

1 
1 2.1 First Take on Dependency Tracking
1 =====================================
1 
1 Description
1 -----------
1 
1 Our first attempt at automatic dependency tracking was based on the
11 method recommended by GNU 'make'.  (⇒Generating Prerequisites
 Automatically (make)Automatic Prerequisites.)
1 
1    This version worked by precomputing dependencies ahead of time.  For
1 each source file, it had a special '.P' file that held the dependencies.
1 There was a rule to generate a '.P' file by invoking the compiler
1 appropriately.  All such '.P' files were included by the 'Makefile',
1 thus implicitly becoming dependencies of 'Makefile'.
1 
1 Bugs
1 ----
1 
1 This approach had several critical bugs.
1 
1    * The code to generate the '.P' file relied on 'gcc'.  (A limitation,
1      not technically a bug.)
1    * The dependency tracking mechanism itself relied on GNU 'make'.  (A
1      limitation, not technically a bug.)
1    * Because each '.P' file was a dependency of 'Makefile', this meant
1      that dependency tracking was done eagerly by 'make'.  For instance,
1      'make clean' would cause all the dependency files to be updated,
1      and then immediately removed.  This eagerness also caused problems
1      with some configurations; if a certain source file could not be
1      compiled on a given architecture for some reason, dependency
1      tracking would fail, aborting the entire build.
1    * As dependency tracking was done as a pre-pass, compile times were
1      doubled-the compiler had to be run twice per source file.
1    * 'make dist' re-ran 'automake' to generate a 'Makefile' that did not
1      have automatic dependency tracking (and that was thus portable to
1      any version of 'make').  In order to do this portably, Automake had
1      to scan the dependency files and remove any reference that was to a
1      source file not in the distribution.  This process was error-prone.
1      Also, if 'make dist' was run in an environment where some object
1      file had a dependency on a source file that was only conditionally
1      created, Automake would generate a 'Makefile' that referred to a
1      file that might not appear in the end user's build.  A special,
1      hacky mechanism was required to work around this.
1 
1 Historical Note
1 ---------------
1 
1 The code generated by Automake is often inspired by the 'Makefile' style
1 of a particular author.  In the case of the first implementation of
1 dependency tracking, I believe the impetus and inspiration was Jim
1 Meyering.  (I could be mistaken.  If you know otherwise feel free to
1 correct me.)
1