Refactor makefile and require needed dependencies