Use platform specific file ending for library file

This PR tries to detect the platform and adjust the file extension accordingly. I'm no big Makefile hacker, but these lines are used with success in some of the Julia packages.

I have also removed some white space which blurs the changes a bit. Hopefully not too much.