If once you get going, you get confused by makefiles, have a quick look at something I wrote.

##A MAKEFILE TUTORIAL###

Gotta make a plug, sorry.