add makefile and simplify api