Set up .gitignore files in doc/ and build/ so that the dirs will be preserved.