First clean-up pass.

- Moved to CMake to frame in buildsystem
- Corrected misuse of compiler directives by tool in generated C code.
- Moved to a directory structure that's cleaner than the flat one.