Add makefile and fix the build

The threads.c file has been removed as it is not needed and it confuses the
makefile engine.
Merge pull request #1 from atalax/master

Add makefile and fix the build