automake: Staged Installs

1 
1 12.4 Staged Installs
1 ====================
1 
1 Automake generates support for the ‘DESTDIR’ variable in all install
1 rules.  ‘DESTDIR’ is used during the ‘make install’ step to relocate
1 install objects into a staging area.  Each object and path is prefixed
1 with the value of ‘DESTDIR’ before being copied into the install area.
1 Here is an example of typical DESTDIR usage:
1 
1      mkdir /tmp/staging &&
1      make DESTDIR=/tmp/staging install
1 
1    The ‘mkdir’ command avoids a security problem if the attacker creates
1 a symbolic link from ‘/tmp/staging’ to a victim area; then ‘make’ places
1 install objects in a directory tree built under ‘/tmp/staging’.  If
1 ‘/gnu/bin/foo’ and ‘/gnu/share/aclocal/foo.m4’ are to be installed, the
1 above command would install ‘/tmp/staging/gnu/bin/foo’ and
1 ‘/tmp/staging/gnu/share/aclocal/foo.m4’.
1 
1    This feature is commonly used to build install images and packages
1 (⇒DESTDIR).
1 
1    Support for ‘DESTDIR’ is implemented by coding it directly into the
1 install rules.  If your ‘Makefile.am’ uses a local install rule (e.g.,
1 ‘install-exec-local’) or an install hook, then you must write that code
1 to respect ‘DESTDIR’.
1 
1    ⇒(standards)Makefile Conventions, for another usage example.
1