Makefile: Fix shared library building on various OSes

Versioned for OS not in (Windows, Android), and create a .dll.a implib on Windows
Merge pull request #1566 from nirbheek/master

Makefile: Fix shared library building on various OSes