Makefile: Clean up

Move some flags around and use the proper macros in the build rules.
Makefile: Build dynamic lib

Additional to the static library, build also a dynamic library.