Wip automake prepare

These are all misc cleanups which I did for the makefile refactor. I separated them because they give me rebasing headaches, and I'd like them reviewed and hopefully some of them can be merged into master.