Implement perfect dependency rebuilding

This means, if foo depends on blah, which in turn depends on blub and
blub changes, blah get's rebuild but stays the same then foo won't be
rebuild as it's dependencies (blah) have not changed.

Note that because our currently included sha1 implementation does not
work correctly, this doesn't either if the changes are small.
Work if called with /usr/bin/redo instead of redo