Cache dependencies, and only rebuild changed files.

This still needs some work, but is there any interest in adding the capability to cache dependencies and only rebuild when a dependent file has been changed? It would be enabled with an option. If so I'll clean this up and add tests.