Since the CS Department does not use Windows machines for your programming assignments, we only discuss the way of compiling and running your programs on Linux. ThreadMentor uses Linux threads and Pthread on Linux.
Click here to download a copy of this file, and here to learn more about makefiles.CC = c++ FLAGS = CFLAGS = -g -O2 DFLAGS = -DPACKAGE=\"threadsystem\" -DVERSION=\"1.0\" -DPTHREAD=1 -DUNIX_MSG_Q=1 -DSTDC_HEADERS=1 IFLAGS = -I/local/eit-linux/apps/ThreadMentor/include TMLIB = /local/eit-linux/apps/ThreadMentor/Visual/libthreadclass.a TMLIB_NV = /local/eit-linux/apps/ThreadMentor/NoVisual/libthreadclass.a OBJ_FILE = quicksort.o quicksort-main.o EXE_FILE = quicksort ${EXE_FILE}: ${OBJ_FILE} ${CC} ${FLAGS} -o ${EXE_FILE} ${OBJ_FILE} ${TMLIB} -lpthread quicksort.o: quicksort.cpp ${CC} ${DFLAGS} ${IFLAGS} ${CFLAGS} -c quicksort.cpp quicksort-main.o: quicksort-main.cpp ${CC} ${DFLAGS} ${IFLAGS} ${CFLAGS} -c quicksort-main.cpp noVisual: ${OBJ_FILE} ${CC} ${FLAGS} -o ${EXE_FILE} ${OBJ_FILE} ${TMLIB_NV} -lpthread clean: rm -f ${OBJ_FILE} ${EXE_FILE}
By default, the above Makefile compiles a program with visualization activated. Thus, the following compiles the quicksort program with visualization:
To compile without visualization, use the following:make
make noVisual
Moreover, when you switch from visual to no visual and vice versa, you have to remove the previously generated *.o files. Use the following to remove *.o files:
make clean
To run your program successfully, one line must be added to your .cshrc file, which is in your home directory. You should modify the following if you use a different shell language.
This line permits the system to find the visualization system when you need it. After adding this line to your .cshrc, logout and then login again to make them in effect.set path=($path /local/eit-linux/apps/ThreadMentor/bin)