More advanced makefile that detects changes and rebuilds. Fixes #229