There are several threads about makefiles IIRC.
I can post one as well if you decide to go that route.
Rob