fix makefile and make it more general