Rewrote CMakeLists to be modular, support bundles

Also supports make install, few modifications to make code compile in
C11 mode