Fixed deprecated Makefile setup, and added environment variable requirement to R scripts.