write_makefile function

Writes a Makefile to a file