More fixes to the build system

1 more patches for fixing the build system on Windows for Visual Studio and one more for improved handling of LINKFLAGS and CFLAGS