Changed build system to support mingw

Caused by a relocation bug with ld.
Now modules are combined into *.a archives.