| CSC 201 | Grinnell College | Spring, 2005 |
| Data Representation, Memory Management, and Formal Methods | ||
Goals: This lab provides practice dividing a program into pieces,
compiling those pieces separately, linking components together to form an
executable, and automating this process using the Unix utilities
make and Makefile.
Reference: The main reference for this lab is:
Steps for this Lab: Using the discussion of trees in the Program Management material above as an example, consider the two linked list labs that appeared earlier this semester. Specifically, Lab 5 introduced singly linked lists, while Lab 6 added functionality for this work.
lists-divided.c.
list-node.h will contain the definition of a node
(together with the definition for the length of a string).
list-proc.h will contain all list prototypes.
list-add.c will contain the implementation of function
addName
list-count.c will contain the implementation of function
countList
list-delete.c will contain the implementation of function
delete
list-print.c will contain the implementation of function
print
list-print-last.c will contain the implementation of function
printLast
list-print-rev.c will contain the implementation of function
printReverse
list-put-first.c will contain the implementation of function
putFirst
list-main.c will contain the main program for the application.
Thus, the node and list prototypes will each have their own files, each operation will have its own implementation file, and the main program will have another implementation file.
script to record your work, compile each of
the implementation files using a relevant gcc command, and
then link all of the files together using gcc. Run the
resulting program to show that the various compiling and linking options
have worked appropriately.
Makefile to automate the process of compiling and
linking.
make command for each of the following cases.
Makefile for compiling the entire program.
.o files first.)
list-print.c, perhaps changing the message
printed at the beginning or the end of the list. Then run
make and describe which files are compiled and linked.
list-proc.h.c, adding only a comment to
the start of the file. Again, run
make and describe which files are compiled and linked.
Work to turn in:
submit file from Step 3.
Makefile.
This document is available on the World Wide Web as
http://www.cs.grinnell.edu/~walker/courses/201.sp05/lab-prog-mgmt.html
|
created 3 December 2001 last revised 2 May 2005 |
|
| For more information, please contact Henry M. Walker at walker@cs.grinnell.edu. |