add top level Makefile and fixs some build error