Convert the makefile to a working shell script

Jonathan, I've converted the non working makefile into a working shell script.