makefile improvements

This is a fancier Makefile that allows make to see the dependencies correctly.