Add more intelligence to Makefile.