rewrite Makefile,refactoring