By default, ‘make install’ installs the package's commands under /usr/local/bin, include files under /usr/local/include, etc. You can specify an installation prefix other than /usr/local by giving configure the option --prefix=prefix, where prefix must be an absolute path.
You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option --exec-prefix=prefix to configure, the package uses prefix as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give options like --bindir=dir to specify different values for particular kinds of files. Run ‘configure --help’ for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of ‘${prefix}’, so that specifying just --prefix will affect all of the other directory specifications.
The most portable way to affect installation locations is to pass the correct locations to configure; however, many packages provide one or both of the following shortcuts of passing variable assignments to the ‘make install’ command line to change installation locations without having to reconfigure or recompile.
The first method involves providing an override variable for each affected directory. For example, ‘make install prefix=/path/to/alternate’ will choose an alternate location, as well as influencing all other directory configuration variables that were expressed in terms of ‘${prefix}’ (or, put another way, all directories specified during configure but not in terms of the common prefix must each be overridden at install time for the entire installation to be relocated). The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool.
The second method involves providing the ‘DESTDIR’ variable. For example, ‘make install DESTDIR=/path/to/alternate’ will prepend ‘/path/to/alternate’ before all installation paths. The approach of ‘DESTDIR’ overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of ‘${prefix}’ at configure time. For packages which support ‘DESTDIR’, the variable should remain undefined during configure and ‘make all’, and only be specified during ‘make install’.