Well, I don't know how to make a 'api-clean' command to Sphinx, but the proper way is to see how to implement this pattern in it. This way read-the-docs could use the command too. The solution with Makefile is not crossplatform, Makefiles are confusing for non-Linux hackers. If you still need the hack - why not to modify Makefile directly? Sphinx doesn't regenerate Makefiles..