CS3157
Fall 2002
Homework #2 SCRIPT INFORMATION
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:
- an administrator program
- 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):
- The administrator executable file MUST be named:
admin-<yourCUNIXusername>.x
For example, mine would be called admin-eis2003.x.
- The game executable file MUST be named:
play-<yourCUNIXusername>.x
For example, mine would be called play-eis2003.x.
BE SURE TO NAME YOUR FILES USING ALL lower case LETTERS!!!
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.
- 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.)
- Rename the file by replacing "cs3157" with your CUNIX username:
hw2<yourCUNIXusername>.sh
Mine would be hw2eis2003.sh.
- 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.)
- 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
- Test the script by executing:
unix$ ./hw2eis2003.sh
which should then compile and link the two programs.
- You can run each of them by doing:
unix$ ./admin-eis2003.x
and
unix$ ./play-eis2003.x
That's all!