[task] Use dynamic library and refactor Makefile