Fixed build break on MacOS and improved the Makefile