We expect you to turn in your labs with a working makefile, so here is a an example makefile to put you in the right direction. If you are familiar with makefiles and can modify this to suit your purposes, skip the rest of this page. If not, I will discuss makefiles briefly.
The most compicated part of this makefile is at the top where all the variables are defined. They are there to make it easy to relocate the class directory and run on different arcitectures. Needless to say, you don't need to touch this part to make things work except to uncomment the PROJECTLIB variable for the OS labs.
The EXECUTABLES variable tells the makfiles what you want to build when you type 'make'. Edit this variable to make changes. The .SUFFIXS block tells the makefile to build all files ending in .o using the specified rules, and I doubt you will need to change it. The final block, starting with 'foo:', gives rules for building the executable foo. You need to change this. The files that appear after foo: are the files that foo depends on. This means that all of these files will be updated before foo is built. After all of these files are up to date, the next line will be executed. Here you will want to link all of the object files and libraries togther to form foo.
Also, Rich has put togther a tutorial on compiling and linking code in c that can be found here.