fakedestdir
Sometimes you have to package an application having makefiles which do not support DESTDIR or any equivalent variable. fakedestdir is a tool worth trying in desperate situations. It does some ugly tricks which aim to modify the commands run so that files get copied to temporary directory instead of their final target in e.g. /usr.
fakedestdir is far from perfect and doesn't work with every problematic application at all. Naturally it can be improved, although the results vary. In case of problems, start by checking the log files fakedestdir_make.log and fakedestdir_faked.log.
Note: Quite often an equivalent to DESTDIR exists, you just need to look for it. Simply setting different prefix e.g. make prefix=$PKG install might work fine and doesn't get the temporary installation directory to be hardcoded to any files.
Example
When commands like
make DESTDIR=/tmp/destdir installmake prefix=/tmp/destdir/usr libdir=/tmp/destdir/usr/lib install
fail or make wrong results (/tmp/destdir gets hardcoded to one or more files), you can try if fakedestdir is able to do anything better:
fakedestdir /tmp/destdir install
