Clean up code and added makefile

This revision fixes a few issues in the c code. There are still 200+ warning about unused variables.

Also, all include directives belong into the header files and not in the c file. The c file should only include its header file.

Also missing are the license file.