In order to understand how to use the more advanced
features, you must first understand how
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.
rules work by building a copy of the source tree and then archiving that copy. This copy is made in stages: a
in a particular directory updates the corresponding directory in the shadow tree. In some cases,
is run to create a new
in the new distribution tree.
After each directory's
has had a chance to update the distribution directory, the appropriate command is run to create the archive. Finally, the temporary directory is removed.
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
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
is defined during the
process and refers to the corresponding directory in the distribution tree;
refers to the root of the distribution tree.
Here is an example of removing a file from a distribution: