This adds support for setting the environment variable BUILDDIR to point to executables that are outside the source directory.
E.g. to invoke the tool when the build is in $PWD/build:
BUILDDIR=$PWD/build contrib/devtools/gen-manpages.sh
This avoids having to manually copy the generated manpages after they end up in the build instead of source path, when setting TOPDIR instead.