Clean and update build output more intelligently

Fixes #183.
I'm not sure this is something we should change - the extension isn't really case-insensitive afaik (like in practice)