The application's Makefile+
file contains
an ordinary install
target which is run
directly when the user does make+ install.
The purpose of the install
target is
to do whatever is necessary to install the program, but
in practice this means doing two things:
Making the installation directories.
Copying the program into the installation directories.
Here is an example install
target.
The first four commands are concerned with creating the
installation directories. The last five commands are concerned
with copying the built program (in this case, a library) to
the installation directories. Notice the use of several
make+ macros.
install: install -d $(DESTDIR)$(libdir) install -d $(DESTDIR)$(pkgincludedir) install -d $(DESTDIR)$(man3dir) install -d $(DESTDIR)$(datadir)/rws/symtabs/ $(MP_INSTALL_STATIC_LIB) libc2lib.a $(MP_INSTALL_DYNAMIC_LIB) libc2lib.so install -m 0644 $(HEADERS) $(DESTDIR)$(pkgincludedir) install -m 0644 *.3 $(DESTDIR)$(man3dir) install -m 0644 *.syms $(DESTDIR)$(datadir)/rws/symtabs/
$(DESTDIR)
must be prefixed onto every
install path. Normally it is empty, and so has no
effect. However when doing packaged builds (building RPMs for
example) it can be used to create a "fake root".
$(libdir)
, etc., are standard paths
for particular directories. For example if the prefix
is /usr/local
and we are building
on Linux, then
$(libdir)
will expand to
/usr/local/lib
and
$(man3dir)
to
/usr/local/share/man/man3
.