# on turing, use next line;  on other platforms use following
CROSS=-m32
#CROSS=

CC=g++
CFLAGS=-g -Wall $(CROSS)
LFLAGS=$(CROSS)

DOBJS=decode.o BitStreams.o
EOBJS=encode.o BitStreams.o
VOBJS=BitStreams.o Viewer.o

# rule for building the executable
default:  encode

decode: $(DOBJS)
	$(CC) -o decode $(LFLAGS) $(DOBJS)

encode: $(EOBJS)
	$(CC) -o encode $(LFLAGS) $(EOBJS)

Viewer: $(VOBJS)
	$(CC) -o Viewer $(LFLAGS) $(VOBJS)

all:      Viewer decode encode

# list of file dependencies
decode.o:           decode.cpp BitStreams.h BinaryTree.h VariousExceptions.h BinaryTree.tcc
encode.o:           encode.cpp BitStreams.h BinaryTree.h VariousExceptions.h BinaryTree.tcc PriorityQueue.h PriorityQueue.tcc
BitStreams.o:       BitStreams.h BitStreams.cpp
Viewer.o:           Viewer.cpp BitStreams.h

# the following rule is used to compile .cpp files to .o
.cpp.o:
	$(CC) $(CFLAGS) -c $<


# the following removes all .o files, but leaves the executable
clean:
	rm -f *.o