Fall 2002

This page expands on step #5 in the homework assignment...
(5. write a compile and link script.(1.5 point)
Write a simple script file that will automatically compile and link each of the two programs you wrote for steps 3 and 4.)

5.A. NAME your files correctly.
You are writing two executable programs for this assignment:

  1. an administrator program
  2. the game program
You MUST follow these naming conventions (to ease the burden on the TAs in terms of compiling, linking and running your code):
  1. The administrator executable file MUST be named: admin-<yourCUNIXusername>.x
    For example, mine would be called admin-eis2003.x.

  2. The game executable file MUST be named: play-<yourCUNIXusername>.x
    For example, mine would be called play-eis2003.x.
Note that these rules are necessary to help us compile, link and run homeworks automatically. If you don't follow the rules, then it costs the TAs a lot of time to figure out what you named things and type in the compiling, linking and running commands manually. You will lose at least 1 point if you do not follow these rules.

5.B. WRITE a compile script.

  1. Copy the file hw2cs3157.sh into your working directory. (Note that this is just a plain text file, but the ".sh" extension may confuse some browsers, so you may have to just save it and then open it with a text editor like emacs.)
  2. Rename the file by replacing "cs3157" with your CUNIX username:
    Mine would be hw2eis2003.sh.
  3. Make the script an executable file by changing the permissions:
    unix$ chmod +x hw2eis2003.sh
    (Of course, you need to replace my CUNIX username from the line above with yours.)
  4. Edit the script as instructed in the file you've copied, replacing "cs3157" with your username and replacing references to the sample helper file ("profile.c" and "profile.o") with whatever name(s) you've used. If you have more than one helper file, then you can add more lines to the script. For each helper file, you'll need to add a line like this:
    gcc -c <yourfilename>.c -o <yourfilename>.o
  5. Test the script by executing:
    unix$ ./hw2eis2003.sh
    which should then compile and link the two programs.
  6. You can run each of them by doing:
    unix$ ./admin-eis2003.x
    unix$ ./play-eis2003.x

That's all!