Makefile improvements

See commits.