Next: , Previous: , Up: GNU Automake   [Contents][Index]


12 What Gets Cleaned

The GNU Makefile Standards specify a number of different clean rules. See See Standard Targets for Users in The GNU Coding Standards.

Generally the files that can be cleaned are determined automatically by Automake. Of course, Automake also recognizes some variables that can be defined to specify additional files to clean. These variables are MOSTLYCLEANFILES, CLEANFILES, DISTCLEANFILES, and MAINTAINERCLEANFILES.

When cleaning involves more than deleting some hard-coded list of files, it is also possible to supplement the cleaning rules with your own commands. Simply define a rule for any of the mostlyclean-local, clean-local, distclean-local, or maintainerclean-local targets (see Extending Automake Rules). A common case is deleting a directory, for instance a directory created by the test suite:

clean-local:
        -rm -rf testSubDir

As the GNU Standards aren’t always explicit as to which files should be removed by which rule, we’ve adopted a heuristic which we believe was first formulated by François Pinard:

We recommend that you follow this same set of heuristics in your Makefile.am.


Next: What Goes in a Distribution, Previous: What Gets Installed, Up: GNU Automake   [Contents][Index]