refactoring Makefile to support cpp compiler