some good change of Makefile and relevant code