Flylib.com

Books Software

 
 
 

13.3 The distcheck rule

back: what goes in
forward: some caveats
 
fastback: some caveats
up: rolling distribution tarballs
fastforward: installing and uninstalling
top: autoconf, automake, and libtool
contents: table of contents
index: index
about: about this document

13.3 The distcheck rule

The make dist documentation sounds nice, and make dist did do something, but how do you know it really works? It is a terrible feeling when you realize your carefully crafted distribution is missing a file and won't compile on a user 's machine.

I wouldn't write such an introduction unless Automake provided a solution. The solution is a smoke test known as make distcheck . This rule performs a make dist as usual, but it doesn't stop there. Instead, it then proceeds to untar the new archive into a fresh directory, build it in a fresh build directory separate from the source directory, install it into a third fresh directory, and finally run make check in the build tree. If any step fails, distcheck aborts, leaving you to fix the problem before it will create a distribution.

While not a complete test -- it only tries one architecture, after all -- distcheck nevertheless catches most packaging errors (as opposed to portability bugs), and its use is highly recommended.


This document was generated by Gary V. Vaughan on May, 24 2001 using texi2html
back: the distcheck rule
forward: implementation
 
fastback: implementation
up: rolling distribution tarballs
fastforward: installing and uninstalling
top: autoconf, automake, and libtool
contents: table of contents
index: index
about: about this document

13.4 Some caveats

Earlier, if you were awake, you noticed that I recommended the use of make before make dist or make distcheck . This practice ensures that all the generated files are newer than their inputs. It also solves some problems related to dependency tracking (see section 19. Advanced GNU Automake Usage).

Note that currently Automake will allow you to make a distribution when maintainer mode is off, or when you do not have all the required maintainer tools. That is, you can make a subtly broken distribution if you are motivated or unlucky. This will be addressed in a future version of Automake.


This document was generated by Gary V. Vaughan on May, 24 2001 using texi2html
back: some caveats
forward: installing and uninstalling
 
fastback: rolling distribution tarballs
up: rolling distribution tarballs
fastforward: installing and uninstalling
top: autoconf, automake, and libtool
contents: table of contents
index: index
about: about this document

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