use autogenerated make dependencies

- write .deps files during compilation
- include .deps files in makefile
Merge pull request #2991 from MartinNowak/makedepends

use autogenerated make dependencies