Autoconf, Automake, and Libtool: Implementation

| ## 13.5 Implementation In order to understand how to use the more advanced `dist`-related features, you must first understand how `make dist` is implemented. For most packages, what we've already covered will suffice. Few packages will need the more advanced features, though I note that many use them anyway. The `dist` rules work by building a copy of the source tree and then archiving that copy. This copy is made in stages: a ``Makefile'` in a particular directory updates the corresponding directory in the shadow tree. In some cases, `automake` is run to create a new ``Makefile.in'` in the new distribution tree. After each directory's ``Makefile'` has had a chance to update the distribution directory, the appropriate command is run to create the archive. Finally, the temporary directory is removed. If your ``Makefile.am'` defines a `dist-hook` rule, then Automake will arrange to run this rule when the copying work for this directory is finished. This rule can do literally anything to the distribution directory, so some care is required -- careless use will result in an unusable distribution. For instance, Automake will create the shadow tree using links, if possible. This means that it is inadvisable to modify the files in the ``dist'` tree in a dist hook. One common use for this rule is to remove files that erroneously end up in the distribution (in rare situations this can happen). The variable ``distdir'` is defined during the `dist` process and refers to the corresponding directory in the distribution tree; ``top_distdir'` refers to the root of the distribution tree. Here is an example of removing a file from a distribution:
    dist-hook:
            -rm $(distdir)/remove-this-file

This document was generated by Gary V. Vaughan on May, 24 2001 using texi2html