New Makefile and memory calculation routine