Updated makefiles

Changed makefiles and tested them in both mingw and FreeBSD unix.