Implement amalgamation and doc generation test by checking whether build dirties the checkout

This simplifies the way we check for whether generated files are in sync.