Improved makefile to automatically generate dependencies