CS 245
Nov. 25, 2002
In this lab you will learn how to set up dependencies within a make file.
cd
to this directory.
~kelliher/pub/cs245/Makefile
into the directory
you just created and open it for editing.
touch
it. For example, if
the target x
depends upon the files y
and z
we need
the following entry in the make file:
x: y z touch xRemember, the command line must begin with a Tab character and target specifications must be separated by at least one blank line.
Don't forget that the leaf targets must appear as targets with empty command lists.
Makefile
, adding the required targets.
make allThis will create the necessary test files, run a suite of tests, and remove the test files. (Check the make file for the details.)
For easy viewing, you may find it convenient to pipe the output to a pager:
make all | less
Notice that for each test run, the output will tell you what file was
touched before a
is made. Using this information, as well as the
dependency graph, you should be able to determine if the correct files are
being re-made and if they're being re-made in the correct order.
make all > results diff -w ~kelliher/pub/cs245/makeResults resultsIf
diff
runs without producing any output, you've passed the test.
Otherwise, compare your result file with my result file then correct your
make file.