Fix build system, and src/makefile so it can support subfolders better