Next: , Up: Distributing   [Contents][Index]

6.4.1 Basics of Distribution

The dist rule in the generated Makefile.in can be used to generate a gzipped tar file and other flavors of archive for distribution. The file is named based on the PACKAGE and VERSION variables automatically defined by either the AC_INIT invocation or by a deprecated two-arguments invocation of the AM_INIT_AUTOMAKE macro (see Macros supplied with Automake for how these variables get their values, from either defaults or explicit values — it’s slightly trickier than one would expect). More precisely the gzipped tar file is named ‘${PACKAGE}-${VERSION}.tar.gz’. You can use the make variable GZIP_ENV to control how gzip is run. The default setting is --best.

For the most part, the files to distribute are automatically found by Automake: all source files are automatically included in a distribution, as are all Makefile.am and Makefile.in files. Automake also has a built-in list of commonly used files that are automatically included if they are found in the current directory (either physically, or as the target of a Makefile.am rule); this list is printed by ‘automake --help’. Note that some files in this list are actually distributed only if other certain conditions hold (for example, the config.h.top and config.h.bot files are automatically distributed only if, e.g., ‘AC_CONFIG_HEADERS([config.h])’ is used in configure.ac). Also, files that are read by configure (i.e. the source files corresponding to the files specified in various Autoconf macros such as AC_CONFIG_FILES and siblings) are automatically distributed. Files included in a Makefile.am (using include) or in configure.ac (using m4_include), and helper scripts installed with ‘automake --add-missing’ are also distributed.

Still, sometimes there are files that must be distributed, but which are not covered in the automatic rules. These files should be listed in the EXTRA_DIST variable. You can mention files from subdirectories in EXTRA_DIST.

You can also mention a directory in EXTRA_DIST; in this case the entire directory will be recursively copied into the distribution. Please note that this will also copy everything in the directory, including, e.g., Subversion’s .svn private directories or CVS/RCS version control files; thus we recommend against using this feature as-is. However, you can use the dist-hook feature to ameliorate the problem; see The dist Hook.

If you define SUBDIRS, Automake will recursively include the subdirectories in the distribution. If SUBDIRS is defined conditionally (see Conditionals), Automake will normally include all directories that could possibly appear in SUBDIRS in the distribution. If you need to specify the set of directories conditionally, you can set the variable DIST_SUBDIRS to the exact list of subdirectories to include in the distribution (see Conditional Subdirectories).

Next: , Up: Distributing   [Contents][Index]