Fix makefile portability 

Improve compatibility with mingw
Unfortunately mkdir -p does not work on windows. But maybe you can confirm if it is legal/ok to have directories as targets in makefiles. Problem was that mkdir on windows reports unsuccessful exit status when it tries to create the same directory again ... still not sure what the best portable way is.