modify makefile and add cg algo