Listing dependencies
project1: data.o main.o io.o
cc data.o main.o io.o -o project1
data.o: data.c data.h
cc -c data.c
main.o: data.h io.h main.c
cc -c main.c
io.o: io.h io.c
cc -c io.c
Note that in the Makefile shown above, the .h files are listed, but there are no references in their corresponding commands. This is because the .h files are referred within the corresponding .c files through the #include "file.h". If you do not explicitly include these in your Makefile, your program will not be updated if you make a change to your header (.h) files. Note: Comments can be placed in a Makefile by placing a pound s ign (#) in front of it. |
Author: Ben Yoshino (ben@wiliki.eng.hawaii.edu)Comments, Questions? | E-mail: webmaster@wiliki.eng.hawaii.edu Last updated on Monday, February 05, 2001 Copyright © 2001 University of Hawai`i, College of Engineering, Computer Facility All rights reserved. |