Fix  makefile for compiling with mingw.
Multiple fixes for windows.