add Makefile and implement main function