Allow user specified alloc functions, cleanup

+ Allow user to define malloc, free and realloc. For use with custom allocators, mempools etc.
+ Minor makefile fixes
+ Get rid of warnings in test file