Implement automatic dependency generation in makefile. 

This implements automatic dependency generation in makefile.

Up until now, if one would for example change compat/pthread_mapping.h and then execute make, make would assume that nothing has changed and wouldn't recompile hooks.c, this commit changes this.

Code is based upon http://scottmcpeak.com/autodepend/autodepend.html see "One More Tweak".