CIS307: Mailing Homeworks

The following instructions are so that we simplify our lives when doing or grading homeworks.

For each homework you should create a separate directory with simple names such as hmw1, hmw2, ....
Suppose that you are doing homework 3 and you are in directory hmw3. In directory hmw3 you should create a Makefile so that you can do a recompile by just saying

make
Inside of the Makefile you should have support for:

  1. A clean command so that you can say:
    make clean
    to remove all object files and possibly the "core" file and

  2. A strong clean command that also removes images:
    make sclean

Once you are satisfied with your homework and ready to send it to the TA, do the following:

  1. Use the "make sclean" command to remove all object, core, and images files.

  2. Change to the parent directory with "cd .."

  3. Tar the homework directory with the command
    tar -cvf hmw3.tar hmw3

  4. Get into pine and send to the TA your tar file as an attachment. [I have done this between roma and snowhite and between snowhite and thunder without any problem. The attachment will be in binary and not visible, but it will transfer as an attachment without any problem.]

The TA, or I, will just have to save the message, and execute the commands:

tar -xvf hmw3.tar
cd hmw3
make
to see what you have done.

Here is an example of a Makefile I have used:



OBJS = pqueuepmain.o pqueuep.o queuep.o
TGTS = pqueuepmain
THREAD = -pthread
LIB = 
CFLAGS = -g
.SUFFIXES : .o .c .h

${TGTS} : ${OBJS} ${LIB}
	${CC} ${CFLAGS} -o $@ ${OBJS} ${LIB} ${THREAD}

.c.o :
	${CC} ${CFLAGS} -c $<
.h.c :
	${CC} ${CFLAGS} -c $@
clean :
	/bin/rm -f core *.o
sclean:               # clean away also the targets
	/bin/rm -f core *.o ${TGTS}


Note that the indented lines must start with a tab. Beware that since HTML gets confused with "<" I had to represent it here as "& lt ;".

To use this Makefile in your homeworks you just need to change appropriately OBJS and TGTS to the values right in your case [respectively, the object and image files]. Also, if you are not using threads, you can define THREAD as follows

THREAD =

I am not an expert on "make" so you may come up with a better Makefile.

ingargiola@cis.temple.edu