158 GNU make
If possible, write the install target rule so that it does not modify anything in
the directory where the program was built, provided ‘make all’ has just been
done. This is convenient for building the program under one user name and
installing it under another.
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 15.3 [Command Variables], page 151), and then run the
install-info program if it is present. install-info is a program that edits
the Info dir file to add or update the menu entry for the given Info file; it is
part of the Texinfo package.
Here is a sample rule to install an Info file that also tries to handle some
additional situations, such as install-info not being present.
do-install-info: foo.info installdirs
$(NORMAL_INSTALL)
# Prefer an info file in . to one in srcdir.
if test -f foo.info; then d=.; \
else d="$(srcdir)"; fi; \
$(INSTALL_DATA) $$d/foo.info \
"$(DESTDIR)$(infodir)/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.
# Use ‘$(SHELL) -c’ because some shells do not
# fail gracefully when there is an unknown command.
$(POST_INSTALL)
if $(SHELL) -c ’install-info --version’ \
>/dev/null 2>&1; then \
install-info --dir-file="$(DESTDIR)$(infodir)/dir" \
"$(DESTDIR)$(infodir)/foo.info"; \
else true; fi
When writing the install target, you must classify all the commands into
three categories: normal ones, pre-installation commands and post-installation
commands. See Section 15.7 [Install Command Categories], page 162.
‘install-html’
‘install-dvi’
‘install-pdf’
‘install-ps’
These targets install documentation in formats other than Info; they’re intended
to be called explicitly by the person installing the package, if that format is
desired. GNU prefers Info files, so these must be installed by the install
target.
Kommentare zu diesen Handbüchern