Refactor configure step of Makefile