Literally the best explanation of how to do Makefiles: http://nuclear.mutantstargoat.com/articles/make/
Makefile