Use sphinx-apidoc. This uses some Makefile code from the Firedrake project.
Ignore build directories.