Go to the previous, next section.
All GNU programs should have the following targets in their Makefiles:
The commands should create all the directories in which files are to be
installed, if they don't already exist. This includes the directories
specified as the values of the variables prefix
and
exec_prefix
, as well as all subdirectories that are needed.
One way to do this is by means of an installdirs
target
as described below.
Use `-' before any command for installing a man page, so that
make
will ignore any errors. This is in case there are systems
that don't have the Unix man page documentation system installed.
The way to install Info files is to copy them into `$(infodir)'
with $(INSTALL_DATA)
(see section Variables for Specifying Commands), and then run
the install-info
program if it is present. install-info
is a script that edits the Info `dir' file to add or update the
menu entry for the given Info file; it will be part of the Texinfo package.
Here is a sample rule to install an Info file:
$(infodir)/foo.info: foo.info # There may be a newer info file in . than in srcdir. -if test -f foo.info; then d=.; \ else d=$(srcdir); fi; \ $(INSTALL_DATA) $$d/foo.info $@; \ # Run install-info only if it exists. # Use `if' instead of just prepending `-' to the # line so we notice real errors from install-info. # We use `$(SHELL) -c' because some shells do not # fail gracefully when there is an unknown command. if $(SHELL) -c 'install-info --version' \ >/dev/null 2>&1; then \ install-info --infodir=$(infodir) $$d/foo.info; \ else true; fi
Delete all files from the current directory that are normally created by building the program. Don't delete the files that record the configuration. Also preserve files that could be made by building, but normally aren't because the distribution comes with them.
Delete `.dvi' files here if they are not part of the distribution.
distclean
, plus more: C source files produced by Bison, tags tables,
Info files, and so on.
One exception, however: `make realclean' should not delete `configure' even if `configure' can be remade using a rule in the Makefile. More generally, `make realclean' should not delete anything that needs to exist in order to run `configure' and then begin to build the program.
info: foo.info foo.info: foo.texi chap1.texi chap2.texi $(MAKEINFO) $(srcdir)/foo.texi
You must define the variable MAKEINFO
in the Makefile. It should
run the makeinfo
program, which is part of the Texinfo
distribution.
dvi: foo.dvi foo.dvi: foo.texi chap1.texi chap2.texi $(TEXI2DVI) $(srcdir)/foo.texi
You must define the variable TEXI2DVI
in the Makefile. It should
run the program texi2dvi
, which is part of the Texinfo
distribution. Alternatively, write just the dependencies, and allow GNU
Make to provide the command.
For example, the distribution tar file of GCC version 1.40 unpacks into a subdirectory named `gcc-1.40'.
The easiest way to do this is to create a subdirectory appropriately
named, use ln
or cp
to install the proper files in it, and
then tar
that subdirectory.
The dist
target should explicitly depend on all non-source files
that are in the distribution, to make sure they are up to date in the
distribution.
See section 'Making Releases' in GNU Coding Standards.
The following targets are suggested as conventional names, for programs in which they are useful.
installcheck
installdirs
# Make sure all installation directories (e.g. $(bindir)) # actually exist by making them if necessary. installdirs: mkinstalldirs $(srcdir)/mkinstalldirs $(bindir) $(datadir) \ $(libdir) $(infodir) \ $(mandir)
Go to the previous, next section.