We have already mentioned make dist
. This target collects all
your source files and the necessary parts of the build system to
create a tarball named package-version.tar.gz.
Another, more useful command is make distcheck
. The
distcheck
target constructs
package-version.tar.gz just as well as dist
,
but it additionally ensures most of the use cases presented so far
work:
make
, make dvi
, make check
, make install
,
as well as make installcheck
, and even make dist
,
make clean
, make distclean
, and make
uninstall
do not omit any file (see Standard Makefile Targets),
DESTDIR
installations work (see Building Binary Packages Using DESTDIR).
All of these actions are performed in a temporary directory, so that no root privileges are required. The exact location and the exact structure of such a subdirectory (where the extracted sources are placed, how the temporary build and install directories are named and how deeply they are nested, etc.) is to be considered an implementation detail, which can change at any time; so do not rely on it.
Releasing a package that fails make distcheck
means that one of
the scenarios we presented will not work and some users will be
disappointed. Therefore it is a good practice to release a package
only after a successful make distcheck
. This of course does
not imply that the package will be flawless, but at least it will
prevent some of the embarrassing errors you may find in packages
released by people who have never heard about distcheck
(like
DESTDIR
not working because of a typo, or a distributed file
being erased by make clean
, or even VPATH
builds not
working).
See Creating amhello-1.0.tar.gz, to recreate amhello-1.0.tar.gz using
make distcheck
. See Checking the Distribution, for more
information about distcheck
.