CS 1206: Assignment 4

Due Thursday, July 29, 1999 by 5pm

100 Points


Writing A Makefile

Your assignment is to write a Makefile for a C program. The program is called ``flip''--a program that converts the line-ending characters on plain text files from MS-DOS conventions (CR-LF pairs) to Unix conventions (LF only) and vice versa.

The source files for flip are available in the tar file assign4.tar on ei.cs.vt.edu. The source files are:

Create a directory of your own and copy all of these files there. Then create your makefile (name it ``Makefile'') in that directory.

The Details of Your Makefile

Make sure you start off your makefile with a section of comments that describe its purpose and contain your name, PID, and lab section code. Then include target directives for every derived file produced during the compilation process (i.e., each program, each object file, and any other intermediate files produced during compilation). Make sure that each directive also lists all files that the derived file depends on in its dependency list.

The basic steps in compiling flip are:

Your makefile should be written so that ``make flip'' carries out these commands. Each command above generates a separate derived file, and so should be placed in a separate directive.

In addition, your makefile should be written so that ``make man'' carries out the following commands:

The "flip.1" file is the source file for the command's man page. Nroff is a program that formats the text of the man page. The command shown above formats the man page into a human-readable form and places the output in the file "flip.man".

Finally, your makefile should be written so that when make is invoked with no target specified on the command line, it carries out both sets of commands listed above, bringing everything (both the program and its formatted man page) up to date.

In your makefile, use descriptive comments to clarify your intentions whereever necessary.

Part III: Submitting Your Answers

Your submission must be a legal makefile, meaning that your name, PID, and lab section code, as well as a description of the makefile, should occur only as comments within the makefile.  You are to submit your assignment via email to the class account at cs1206@ei.cs.vt.edu.  Your subject line should read "HW 4".  You should immediately get an acknowledgement back.

Also, remember that no late assignments are accepted.