fix config.h inclusions

The rule is:
Each .c file (and just the .c files) must #include <config.h> once
before any other code/include.
remove unnecessary #include
place all generated files into the build directory
make sure builddir is created before revision.h is created