Computer Science 121 - Project #1

Build Automation and Version Control

Spring 2007

Background

We have a problem with one of ACME's most popular products: a set of utilities to encode and decode messages, using the nearly legendary 1955 Captain Midnight Secret Decoder Ring algorithm.

The decoder ring (really a badge) was very popular, but actually quite awkward to use. One of ACME's founders (Dubaldie K. Fritz) wrote these utilities long ago (originally in 1950s on a Bendix G15, with subsequent ports to an IBM 1620, an SDS 940, a DEC pdp 8, an IBM 360, BSD UNIX, and finally Linux). They have revolutionized communication among Captain Midnight's millions of Secret Squadron members, and have been generating a surprising amount of revenue for ACME for the last thirty years.

Dubaldie was a brilliant programmer, who worked quickly and produced high quality code ... but he always worked alone and insisted on doing things his own way. Management tolerated his quirks because of his tenure, dedication, and productivity. A month ago he gave notice that he was retiring (to find inner peace at an Amish Tantric retreat in Tuvalu) ... and he is now totally unreachable.

Problem

Today ACME closed a major deal with the Strategic Air Command (who wants to shift their emergency traffic to Captain Midnight encoding, so they will have a mechanical decryption fall-back in case nuclear burst EMPs take down their computers and smart-cards. They need a few enhancements to the utilities ... and we just discovered that Dubaldie didn't believe in standard build tools and version control mechanisms. We are in trouble.

You have been chosen to:

  1. place all of his source files (as he left them) under version control, and then do all subsequent operations under version control.
  2. replace his shell scripts with Makefiles to correctly capture the dependencies and automate the building of this application.

    Note that we want to do correct builds (with correct dependencies). You do not have to worry about capturing incidental output or other behavior of his build scripts.

    Note that his shell scripts make reference to the environment variable ISA. This stands for Instruction Set Architecture. On systems where people care about such things (e.g. because their software has to run on multiple platforms) this variable is typically set to the output of the 'uname -m' command. It is acceptable for your Makefiles to assume that this environment variable has been set to the right value for the platform on which we are building.

  3. update all of his sources to use standard version keywords so that module names, dates, and versions will be filled in automatically rather than by hand.
  4. make the following changes to his program, one at a time, and checking each one in as soon as it works:

    1. automatically build a debug version

      It is inconvenient to have to go back and build a debug version after a problem is encountered.

      Instead of building either normal or debug versions of the utilities, change your Makefile to be able to simultaneously build both debug and non-debug versions in the same (src) directory.

      You will probably have to give the normal and debug object files different names.

    2. improved error checking

      Not specifying a code value is almost surely an error.

      Change src/getcode.c to print out a warning message (to stderr) whenever it has to use the default code value.

    3. add lower case and punctuation

      The original Captain Midnight functions operated only on upper-case text. Many customers now want to also be able to encode (and recover) lower case letters, white space (space, tab, newline), and basic punctuation (period, comma, query, bang).

      Change the translation order string (in lib/cm_set.c) to include these characters.

    4. enhance portability

      People are now running full 8-bit data through the utilities, and SPARC and x86 default to signed chars, resulting in negative indexing errors when high-bit characters are processed.

      Change the translation table size (in lib/cm_defs.h) from 128 to 256 and change the translate functions (in lib/{sparc,x86}/cm_trans.c) to declare the input array to be unsigned characters.

Materials

All of Dubaldie's sources and scripts have been packaged up into a Linux TAR or a Windows ZIP.

Rules, Submissions and Grading

This is an individual project. You are free to talk to other students about approaches, but you must do all of the work by yourself. In particular, you must create your own Makefiles. If you find it it necessary to use other existing Makefiles (other than examples in the manual) as a basis for creating your own:

If you merely these sources for inspiration on approach, there will be no loss of points.

When you are done, package together:

  1. your name
  2. the URL for your subversion repository
  3. a brief list of all the steps you you took in performing this project.
  4. a script (recommended) or a transcript of the commands you used to initially put the files under subversion control.
  5. a brief post-mortem assessment of this project:

And send all of these things to me in an e-mail with the subject "cs121 - proj1". If you will be submitting a project late, please notify me of this on or before the project due date. When you finally do submit it, please tell me how many of your (3) slip-days you want to use.

These are not merely perfunctory exercises. I want to see that you can correctly use advanced makefile features (like implicit rules, variables, includes, and dependencies), and understand reasonable put back procedures (versions, comments). So that you will know exactly what I expect to see, here is a pointer to the grading guidelines that will be used to score your submissions.