Updated makefile to intelligently install dependencies.