Add automatic build dependency generation

Add automatic generation of build dependencies for build targets. Slim down the
includes to only pull in what is actually used in the different C-files.