Check output directory exists before doing a clean

If the output directory does not exist the 'make clean' command fails, which also means that the 'make html' command which would otherwise create the output directory also fails without generating the output.

This a slightly more succinct version of pull request #733 but I couldn't figure out how to attach this commit to that pull request.